Source-Changes-HG archive

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

[src/trunk]: src/lib/libcrypt Revert putting a $ as the final character for b...



details:   https://anonhg.NetBSD.org/src/rev/7bee9d04bee3
branches:  trunk
changeset: 850130:7bee9d04bee3
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Mar 25 21:02:26 2020 +0000

description:
Revert putting a $ as the final character for blowfish. It is not required by
MCF and we want to be compatible.

diffstat:

 lib/libcrypt/bcrypt.c     |  15 ++++++---------
 lib/libcrypt/pw_gensalt.3 |   4 ++--
 2 files changed, 8 insertions(+), 11 deletions(-)

diffs (79 lines):

diff -r 28756b5a7a5d -r 7bee9d04bee3 lib/libcrypt/bcrypt.c
--- a/lib/libcrypt/bcrypt.c     Wed Mar 25 20:19:46 2020 +0000
+++ b/lib/libcrypt/bcrypt.c     Wed Mar 25 21:02:26 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcrypt.c,v 1.20 2020/03/25 18:36:29 christos Exp $     */
+/*     $NetBSD: bcrypt.c,v 1.21 2020/03/25 21:02:26 christos Exp $     */
 /*     $OpenBSD: bcrypt.c,v 1.16 2002/02/19 19:39:36 millert Exp $     */
 
 /*
@@ -46,7 +46,7 @@
  *
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bcrypt.c,v 1.20 2020/03/25 18:36:29 christos Exp $");
+__RCSID("$NetBSD: bcrypt.c,v 1.21 2020/03/25 21:02:26 christos Exp $");
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -66,12 +66,12 @@
 
 #define BCRYPT_VERSION '2'
 #define BCRYPT_MAXSALT 16      /* Precomputation is just so nice */
-#define BCRYPT_MAXSALTLEN      (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 2)
+#define BCRYPT_MAXSALTLEN      (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 1)
 #define BCRYPT_BLOCKS 6                /* Ciphertext blocks */
 #define BCRYPT_MINROUNDS 16    /* we have log2(rounds) in salt */
 
 static void encode_salt(char *, u_int8_t *, u_int16_t, u_int8_t);
-static u_int8_t *encode_base64(u_int8_t *, u_int8_t *, u_int16_t);
+static void encode_base64(u_int8_t *, u_int8_t *, u_int16_t);
 static void decode_base64(u_int8_t *, u_int16_t, const u_int8_t *);
 
 char *__bcrypt(const char *, const char *);    /* XXX */
@@ -146,9 +146,7 @@
 
        snprintf(salt + 4, 4, "%2.2u$", logr);
 
-       csalt = encode_base64((u_int8_t *) salt + 7, csalt, clen);
-       *csalt++ = '$';
-       *csalt = '\0';
+       encode_base64((u_int8_t *) salt + 7, csalt, clen);
 }
 
 int
@@ -320,7 +318,7 @@
        return encrypted;
 }
 
-static u_int8_t *
+static void
 encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len)
 {
        u_int8_t *bp = buffer;
@@ -348,7 +346,6 @@
                *bp++ = Base64Code[c2 & 0x3f];
        }
        *bp = '\0';
-       return bp;
 }
 #if 0
 void
diff -r 28756b5a7a5d -r 7bee9d04bee3 lib/libcrypt/pw_gensalt.3
--- a/lib/libcrypt/pw_gensalt.3 Wed Mar 25 20:19:46 2020 +0000
+++ b/lib/libcrypt/pw_gensalt.3 Wed Mar 25 21:02:26 2020 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pw_gensalt.3,v 1.3 2020/03/25 18:53:50 wiz Exp $
+.\"    $NetBSD: pw_gensalt.3,v 1.4 2020/03/25 21:02:26 christos Exp $
 .\"
 .\" Copyright (c) 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -121,7 +121,7 @@
 and the number of rounds needs to be specified in
 .Ar option .
 This is of the form:
-.Li $2a$nrounds$??????????????????????$ .
+.Li $2a$nrounds$?????????????????????? .
 The
 .Li 2
 in the salt string indicates the current blowfish version.



Home | Main Index | Thread Index | Old Index