Module Name: src
Committed By: agc
Date: Mon Nov 1 03:09:59 UTC 2021
Modified Files:
src/external/apache2/argon2/dist/phc-winner-argon2/src: argon2.c core.c
src/lib/libcrypt: Makefile
Log Message:
Remove the
COPTS.*+= -Wno-error=.*
lines for building argon2 sources, by fixing the problems at source.
Addresses Rin Okuyama's concerns on tech-userlevel/tech-crypto in
Message-ID: <[email protected]>
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c
cvs rdiff -u -r1.32 -r1.33 src/lib/libcrypt/Makefile
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c
diff -u src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c:1.1 src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c:1.2
--- src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c:1.1 Wed Oct 9 13:13:09 2019
+++ src/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c Mon Nov 1 03:09:59 2021
@@ -283,7 +283,7 @@ int argon2_verify(const char *encoded, c
goto fail;
}
- ctx.pwd = (uint8_t *)pwd;
+ ctx.pwd = __UNCONST(pwd);
ctx.pwdlen = (uint32_t)pwdlen;
ret = decode_string(&ctx, encoded, type);
@@ -346,7 +346,7 @@ int argon2_verify_ctx(argon2_context *co
return ret;
}
- if (argon2_compare((uint8_t *)hash, context->out, context->outlen)) {
+ if (argon2_compare((const uint8_t *)hash, context->out, context->outlen)) {
return ARGON2_VERIFY_MISMATCH;
}
Index: src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c
diff -u src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c:1.2 src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c:1.3
--- src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c:1.2 Sun Oct 17 10:44:21 2021
+++ src/external/apache2/argon2/dist/phc-winner-argon2/src/core.c Mon Nov 1 03:09:59 2021
@@ -414,7 +414,7 @@ int validate_inputs(const argon2_context
}
}
- if (ARGON2_MIN_PWD_LENGTH > context->pwdlen) {
+ if (ARGON2_MIN_PWD_LENGTH + 1 > context->pwdlen + 1) {
return ARGON2_PWD_TOO_SHORT;
}
@@ -443,7 +443,7 @@ int validate_inputs(const argon2_context
return ARGON2_SECRET_PTR_MISMATCH;
}
} else {
- if (ARGON2_MIN_SECRET > context->secretlen) {
+ if (ARGON2_MIN_SECRET + 1 > context->secretlen + 1) {
return ARGON2_SECRET_TOO_SHORT;
}
if (ARGON2_MAX_SECRET < context->secretlen) {
@@ -457,7 +457,7 @@ int validate_inputs(const argon2_context
return ARGON2_AD_PTR_MISMATCH;
}
} else {
- if (ARGON2_MIN_AD_LENGTH > context->adlen) {
+ if (ARGON2_MIN_AD_LENGTH + 1 > context->adlen + 1) {
return ARGON2_AD_TOO_SHORT;
}
if (ARGON2_MAX_AD_LENGTH < context->adlen) {
@@ -470,7 +470,7 @@ int validate_inputs(const argon2_context
return ARGON2_MEMORY_TOO_LITTLE;
}
- if (ARGON2_MAX_MEMORY < context->m_cost) {
+ if (ARGON2_MAX_MEMORY - 1 < context->m_cost - 1) {
return ARGON2_MEMORY_TOO_MUCH;
}
Index: src/lib/libcrypt/Makefile
diff -u src/lib/libcrypt/Makefile:1.32 src/lib/libcrypt/Makefile:1.33
--- src/lib/libcrypt/Makefile:1.32 Sun Oct 31 09:16:08 2021
+++ src/lib/libcrypt/Makefile Mon Nov 1 03:09:58 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.32 2021/10/31 09:16:08 nia Exp $
+# $NetBSD: Makefile,v 1.33 2021/11/01 03:09:58 agc Exp $
USE_FORT?= yes # cryptographic software
@@ -28,8 +28,6 @@ SRCS+= crypt-argon2.c
SRCS+= ${src}
COPTS.${src}+= -fvisibility=hidden
. endfor
-COPTS.argon2.c+= -Wno-error=cast-qual
-COPTS.core.c+= -Wno-error=type-limits
. if ${MACHINE} == "vax"
COPTS.blake2b.c+= -O0
. endif