aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-07-17 17:34:14 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2025-07-17 17:34:14 +0200
commitdde90f1d4746a2efef20fc227cd38bbcb58d546c (patch)
treea40d739cc4b857219d914679fdedcf88f47cebe6
parentb823735b7eb6428e827cf463123d3caaa48804ff (diff)
downloadbusybox-w32-dde90f1d4746a2efef20fc227cd38bbcb58d546c.tar.gz
busybox-w32-dde90f1d4746a2efef20fc227cd38bbcb58d546c.tar.bz2
busybox-w32-dde90f1d4746a2efef20fc227cd38bbcb58d546c.zip
libbb.h: increase MAX_PW_SALT_LEN
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--include/libbb.h12
-rw-r--r--loginutils/cryptpw.c3
2 files changed, 7 insertions, 8 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 79427fb31..4f44680aa 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1825,14 +1825,14 @@ extern int obscure(const char *old, const char *newval, const struct passwd *pwd
1825extern int crypt_make_rand64encoded(char *p, int cnt /*, int rnd*/) FAST_FUNC; 1825extern int crypt_make_rand64encoded(char *p, int cnt /*, int rnd*/) FAST_FUNC;
1826/* Size of char salt[] to hold randomly-generated salt string 1826/* Size of char salt[] to hold randomly-generated salt string
1827 * sha256/512: 1827 * sha256/512:
1828 * "$5$<sha_salt_16_chars><NUL>" 1828 * "$5$" ["rounds=999999999$"] "<sha_salt_16_chars><NUL>"
1829 * "$6$<sha_salt_16_chars><NUL>" 1829 * "$6$" ["rounds=999999999$"] "<sha_salt_16_chars><NUL>"
1830 * #define MAX_PW_SALT_LEN (3 + 16 + 1) 1830 * #define MAX_PW_SALT_LEN (3 + sizeof("rounds=999999999$")-1 + 16 + 1)
1831 * yescrypt: 1831 * yescrypt:
1832 * "$y$" <up to 8 params of up to 6 chars each> "$" <up to 84 chars salt><NUL> 1832 * "$y$" <up to 8 params of up to 6 chars each> "$" <up to 86 chars salt><NUL>
1833 * (84 chars are ascii64-encoded 64 binary bytes) 1833 * (86 chars are ascii64-encoded 64 binary bytes)
1834 */ 1834 */
1835#define MAX_PW_SALT_LEN (3 + 8*6 + 1 + 84 + 1) 1835#define MAX_PW_SALT_LEN (3 + 8*6 + 1 + 86 + 1)
1836extern char* crypt_make_pw_salt(char p[MAX_PW_SALT_LEN], const char *algo) FAST_FUNC; 1836extern char* crypt_make_pw_salt(char p[MAX_PW_SALT_LEN], const char *algo) FAST_FUNC;
1837 1837
1838/* Returns number of lines changed, or -1 on error */ 1838/* Returns number of lines changed, or -1 on error */
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index 1c338540f..c0f6280cd 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -84,8 +84,7 @@ to cryptpw. -a option (alias for -m) came from cryptpw.
84int cryptpw_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 84int cryptpw_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
85int cryptpw_main(int argc UNUSED_PARAM, char **argv) 85int cryptpw_main(int argc UNUSED_PARAM, char **argv)
86{ 86{
87 /* Supports: cryptpw -m sha256 PASS 'rounds=999999999$SALT' */ 87 char salt[MAX_PW_SALT_LEN];
88 char salt[MAX_PW_SALT_LEN + sizeof("rounds=999999999$")];
89 char *salt_ptr; 88 char *salt_ptr;
90 char *password; 89 char *password;
91 const char *opt_m, *opt_S; 90 const char *opt_m, *opt_S;