libbb/yescrypt: make some functions static
This commit was genuinely broken at the time (not related to our build system): libbb/yescrypt eklenirken (2025-07-06 - 2025-07-07 arasi) once unutulan kaynak dosyalari (pw_encrypt_yes.c, hash_sha256_block.c, pw_ascii64.c), ardindan 64-bit'te derlenmeyen bir 'buflen' degiskeni (alg-yescrypt-kdf.c) vardi - busybox'in kendi kodundaki gercek hatalar (e5d3a8763 ile duzeltildi)
No binary (build failed)
—
(log yok)
| @@ -18,7 +18,12 @@ | |
| * SUCH DAMAGE. | |
| */ | |
| - | static inline uint32_t atoi64(uint8_t src) |
| + | /* Not inlining: |
| + | * decode64 fuinctions are only used to read |
| + | * yescrypt_params_t field, and convert salt ti binary - |
| + | * both of these are negligible compared to main hashing operation |
| + | */ |
| + | static NOINLINE uint32_t atoi64(uint8_t src) |
| { | |
| static const uint8_t atoi64_partial[77] = { | |
| 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, | |
| @@ -34,8 +39,9 @@ static inline uint32_t atoi64(uint8_t src) | |
| return 64; | |
| } | |
| - | static const uint8_t *decode64_uint32(uint32_t *dst, |
| - | const uint8_t *src, uint32_t min) |
| + | static NOINLINE const uint8_t *decode64_uint32( |
| + | uint32_t *dst, |
| + | const uint8_t *src, uint32_t min) |
| { | |
| uint32_t start = 0, end = 47, chars = 1, bits = 0; | |
| uint32_t c; | |
| @@ -70,8 +76,9 @@ fail: | |
| return NULL; | |
| } | |
| - | static uint8_t *encode64_uint32_fixed(uint8_t *dst, size_t dstlen, |
| - | uint32_t src, uint32_t srcbits) |
| + | static uint8_t *encode64_uint32_fixed( |
| + | uint8_t *dst, size_t dstlen, |
| + | uint32_t src, uint32_t srcbits) |
| { | |
| uint32_t bits; | |
| @@ -91,8 +98,9 @@ static uint8_t *encode64_uint32_fixed(uint8_t *dst, size_t dstlen, | |
| return dst; | |
| } | |
| - | uint8_t *encode64(uint8_t *dst, size_t dstlen, |
| - | const uint8_t *src, size_t srclen) |
| + | static uint8_t *encode64( |
| + | uint8_t *dst, size_t dstlen, |
| + | const uint8_t *src, size_t srclen) |
| { | |
| size_t i; | |
| @@ -118,8 +126,9 @@ uint8_t *encode64(uint8_t *dst, size_t dstlen, | |
| return dst; | |
| } | |
| - | const uint8_t *decode64(uint8_t *dst, size_t *dstlen, |
| - | const uint8_t *src, size_t srclen) |
| + | static const uint8_t *decode64( |
| + | uint8_t *dst, size_t *dstlen, |
| + | const uint8_t *src, size_t srclen) |
| { | |
| size_t dstpos = 0; | |
| @@ -976,6 +976,7 @@ out_EINVAL: | |
| * to this function are the same as those for yescrypt_kdf_body() above, with | |
| * the addition of g, which controls hash upgrades (0 for no upgrades so far). | |
| */ | |
| + | static |
| int yescrypt_kdf( | |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| @@ -184,12 +184,14 @@ extern int yescrypt_free_local(yescrypt_local_t *local); | |
| * | |
| * MT-safe as long as local and buf are local to the thread. | |
| */ | |
| - | extern int yescrypt_kdf( |
| + | #ifdef YESCRYPT_INTERNAL |
| + | static int yescrypt_kdf( |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *salt, size_t saltlen, | |
| const yescrypt_params_t *params, | |
| uint8_t *buf, size_t buflen); | |
| + | #endif |
| /** | |
| * yescrypt_r(shared, local, passwd, passwdlen, setting, key, buf, buflen): | |
| @@ -211,8 +213,3 @@ extern uint8_t *yescrypt_r( | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *setting, | |
| uint8_t *buf, size_t buflen); | |
| - | |
| - | extern const uint8_t *decode64(uint8_t *dst, size_t *dstlen, |
| - | const uint8_t *src, size_t srclen); |
| - | extern uint8_t *encode64(uint8_t *dst, size_t dstlen, |
| - | const uint8_t *src, size_t srclen); |