Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcrypt Add missing trailing $ for blowfish
details: https://anonhg.NetBSD.org/src/rev/18c4d9a6ecda
branches: trunk
changeset: 970487:18c4d9a6ecda
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 25 18:36:29 2020 +0000
description:
Add missing trailing $ for blowfish
diffstat:
lib/libcrypt/bcrypt.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (61 lines):
diff -r e97c33f9c125 -r 18c4d9a6ecda lib/libcrypt/bcrypt.c
--- a/lib/libcrypt/bcrypt.c Wed Mar 25 18:08:34 2020 +0000
+++ b/lib/libcrypt/bcrypt.c Wed Mar 25 18:36:29 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcrypt.c,v 1.19 2013/08/28 17:47:07 riastradh Exp $ */
+/* $NetBSD: bcrypt.c,v 1.20 2020/03/25 18:36:29 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.19 2013/08/28 17:47:07 riastradh Exp $");
+__RCSID("$NetBSD: bcrypt.c,v 1.20 2020/03/25 18:36:29 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 + 1)
+#define BCRYPT_MAXSALTLEN (7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 2)
#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 void encode_base64(u_int8_t *, u_int8_t *, u_int16_t);
+static u_int8_t *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,7 +146,9 @@
snprintf(salt + 4, 4, "%2.2u$", logr);
- encode_base64((u_int8_t *) salt + 7, csalt, clen);
+ csalt = encode_base64((u_int8_t *) salt + 7, csalt, clen);
+ *csalt++ = '$';
+ *csalt = '\0';
}
int
@@ -318,7 +320,7 @@
return encrypted;
}
-static void
+static u_int8_t *
encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len)
{
u_int8_t *bp = buffer;
@@ -346,6 +348,7 @@
*bp++ = Base64Code[c2 & 0x3f];
}
*bp = '\0';
+ return bp;
}
#if 0
void
Home |
Main Index |
Thread Index |
Old Index