]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
libmisc/salt.c: bcrypt should use $2b$ as prefix for setting. 360/head
authorBjörn Esser <besser82@fedoraproject.org>
Sat, 12 Jun 2021 11:54:14 +0000 (13:54 +0200)
committerBjörn Esser <besser82@fedoraproject.org>
Tue, 22 Jun 2021 16:52:39 +0000 (18:52 +0200)
This prefix is the recommended one for new bcrypt hashes
for a long time.

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
libmisc/salt.c

index 1bfa015b2d60a5339f051caa4510aff0867c3e4b..5dc521ef8bfcda0ac6e9b82ec951871226059192 100644 (file)
@@ -90,12 +90,8 @@ static void seedRNG (void)
  */
 #define MAGNUM(array,ch)       (array)[0]=(array)[2]='$',(array)[1]=(ch),(array)[3]='\0'
 #ifdef USE_BCRYPT
-/* 
- * Using the Prefix $2a$ to enable an anti-collision safety measure in musl libc.
- * Negatively affects a subset of passwords containing the '\xff' character,
- * which is not valid UTF-8 (so "unlikely to cause much annoyance").
- */
-#define BCRYPTMAGNUM(array)    (array)[0]=(array)[3]='$',(array)[1]='2',(array)[2]='a',(array)[4]='\0'
+/* Use $2b$ as prefix for compatibility with OpenBSD's bcrypt. */
+#define BCRYPTMAGNUM(array)    (array)[0]=(array)[3]='$',(array)[1]='2',(array)[2]='b',(array)[4]='\0'
 #endif /* USE_BCRYPT */
 
 #if defined(USE_SHA_CRYPT) || defined(USE_BCRYPT)