Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcrypt Remove the



details:   https://anonhg.NetBSD.org/src/rev/da6cabd0ff4e
branches:  trunk
changeset: 990649:da6cabd0ff4e
user:      agc <agc%NetBSD.org@localhost>
date:      Mon Nov 01 03:09:58 2021 +0000

description:
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: <f1eab199-3607-bb05-15cc-033e38721ba4%gmail.com@localhost>

diffstat:

 external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c |  4 ++--
 external/apache2/argon2/dist/phc-winner-argon2/src/core.c   |  8 ++++----
 lib/libcrypt/Makefile                                       |  4 +---
 3 files changed, 7 insertions(+), 9 deletions(-)

diffs (78 lines):

diff -r 89563fbbd78e -r da6cabd0ff4e external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c
--- a/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c       Sun Oct 31 23:33:12 2021 +0000
+++ b/external/apache2/argon2/dist/phc-winner-argon2/src/argon2.c       Mon Nov 01 03:09:58 2021 +0000
@@ -283,7 +283,7 @@
         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 @@
         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;
     }
 
diff -r 89563fbbd78e -r da6cabd0ff4e external/apache2/argon2/dist/phc-winner-argon2/src/core.c
--- a/external/apache2/argon2/dist/phc-winner-argon2/src/core.c Sun Oct 31 23:33:12 2021 +0000
+++ b/external/apache2/argon2/dist/phc-winner-argon2/src/core.c Mon Nov 01 03:09:58 2021 +0000
@@ -414,7 +414,7 @@
         }
     }
 
-    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 @@
             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 @@
             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 @@
         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;
     }
 
diff -r 89563fbbd78e -r da6cabd0ff4e lib/libcrypt/Makefile
--- a/lib/libcrypt/Makefile     Sun Oct 31 23:33:12 2021 +0000
+++ b/lib/libcrypt/Makefile     Mon Nov 01 03:09:58 2021 +0000
@@ -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+=         ${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



Home | Main Index | Thread Index | Old Index