pw_encrypt.c: musl doesn't have yescrypt, so disable it

Seo Suchan tjtncks at gmail.com
Tue Jun 2 22:58:51 UTC 2026


crypt_make_pw_salt enables all algorithems if we don't use BB_CRYPT, but 
because musl doesn't support yescrypt (it supports bcrypts instead), due 
to bug or design choice of musl side it will use des-encrypted password 
hash with $y as salt: so not offer yescrypt when

I think patch below should work, but not sure

diff --git include/usage.src.h include/usage.src.h
index 0881337f8..213323b19 100644
--- include/usage.src.h
+++ include/usage.src.h
@@ -18,8 +18,13 @@
  #define scripted_full_usage ""

  #if !ENABLE_USE_BB_CRYPT
-# define CRYPT_METHODS_HELP_STR "des,md5,sha256/512,yescrypt" \
+# if !LIBC_IS_MUSL
+#  define CRYPT_METHODS_HELP_STR "des,md5,sha256/512,yescrypt" \
      " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")"
+# else
+#  define CRYPT_METHODS_HELP_STR "des,md5,sha256/512" \
+    " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")"
+# endif
  #else
  # define CRYPT_METHODS_HELP_STR 
"des,md5"IF_USE_BB_CRYPT_SHA(",sha256/512")IF_USE_BB_CRYPT_YES(",yescrypt") 
\
      " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")"
diff --git libbb/pw_encrypt.c libbb/pw_encrypt.c
index 93653de9f..c5b954718 100644
--- libbb/pw_encrypt.c
+++ libbb/pw_encrypt.c
@@ -34,7 +34,7 @@ char* FAST_FUNC crypt_make_pw_salt(char 
salt[MAX_PW_SALT_LEN], const char *algo)
              len = 16 / 2;
          }
  #endif
-#if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_YES
+#if (!ENABLE_USE_BB_CRYPT && !LIBC_IS_MUSL) || ENABLE_USE_BB_CRYPT_YES 
// musl doesn't have yescrypt
          if ((algo[0]|0x20) == 'y') { /* yescrypt */
              int rnd;
              salt[1] = 'y';




More information about the busybox mailing list