Source-Changes-HG archive

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

[src/trunk]: src/lib/libcrypt crypt-argon2: Properly honor user's version num...



details:   https://anonhg.NetBSD.org/src/rev/c35ebc3485a2
branches:  trunk
changeset: 1024196:c35ebc3485a2
user:      nia <nia%NetBSD.org@localhost>
date:      Tue Oct 12 10:51:33 2021 +0000

description:
crypt-argon2: Properly honor user's version number.

Follow upstream by defaulting to 0x10 if it's not specified.

diffstat:

 lib/libcrypt/crypt-argon2.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r c3c4f90d934b -r c35ebc3485a2 lib/libcrypt/crypt-argon2.c
--- a/lib/libcrypt/crypt-argon2.c       Tue Oct 12 09:40:38 2021 +0000
+++ b/lib/libcrypt/crypt-argon2.c       Tue Oct 12 10:51:33 2021 +0000
@@ -100,7 +100,7 @@
                a += 2;
                if ((getnum(a, &tmp))<0) { /* on error, default to current */
                        /* should start thinking about aborting */
-                       ctx->version = ARGON2_VERSION_NUMBER;
+                       ctx->version = ARGON2_VERSION_10;
                } else {
                        ctx->version = tmp;
                }
@@ -110,7 +110,7 @@
                 * This is a parameter list, not a version number, use the
                 * default version.
                 */
-               ctx->version = ARGON2_VERSION_NUMBER;
+               ctx->version = ARGON2_VERSION_10;
        }
 
        /* parse labelled argon2 params */
@@ -184,7 +184,6 @@
        /* argon2 variable, default to id */
        argon2_type atype = Argon2_id;
        /* default to current argon2 version */
-       int version=ARGON2_VERSION_NUMBER;
        /* argon2 context to collect params */
        argon2_context ctx = ARGON2_CONTEXT_INITIALIZER;
        /* argon2 encoded buffer */
@@ -247,7 +246,7 @@
        /* same encoding format as argon2 api, but with original salt */
        snprintf(rbuf, sizeof(rbuf)-1, "$%s$v=%d$m=%d,t=%d,p=%d$%s$%s",
                        argon2_type2string(atype,0),
-                       version,
+                       ctx.version,
                        ctx.m_cost,
                        ctx.t_cost,
                        ctx.threads,



Home | Main Index | Thread Index | Old Index