Module Name:    src
Committed By:   christos
Date:           Wed Mar 25 21:02:26 UTC 2020

Modified Files:
        src/lib/libcrypt: bcrypt.c pw_gensalt.3

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


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libcrypt/bcrypt.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libcrypt/pw_gensalt.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcrypt/bcrypt.c
diff -u src/lib/libcrypt/bcrypt.c:1.20 src/lib/libcrypt/bcrypt.c:1.21
--- src/lib/libcrypt/bcrypt.c:1.20	Wed Mar 25 14:36:29 2020
+++ src/lib/libcrypt/bcrypt.c	Wed Mar 25 17:02:26 2020
@@ -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 @@ __RCSID("$NetBSD: bcrypt.c,v 1.20 2020/0
 
 #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 @@ encode_salt(char *salt, u_int8_t *csalt,
 
 	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 @@ __bcrypt(const char *key, const char *sa
 	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 @@ encode_base64(u_int8_t *buffer, u_int8_t
 		*bp++ = Base64Code[c2 & 0x3f];
 	}
 	*bp = '\0';
-	return bp;
 }
 #if 0
 void

Index: src/lib/libcrypt/pw_gensalt.3
diff -u src/lib/libcrypt/pw_gensalt.3:1.3 src/lib/libcrypt/pw_gensalt.3:1.4
--- src/lib/libcrypt/pw_gensalt.3:1.3	Wed Mar 25 14:53:50 2020
+++ src/lib/libcrypt/pw_gensalt.3	Wed Mar 25 17:02:26 2020
@@ -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 @@ The minimum salt size is
 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.

Reply via email to