libbb/yescrypt: remove unused yescrypt_shared_t
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)
| @@ -185,7 +185,6 @@ fail: | |
| } | |
| uint8_t *yescrypt_r( | |
| - | const yescrypt_shared_t *shared, |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *setting, | |
| @@ -309,7 +308,7 @@ uint8_t *yescrypt_r( | |
| if (need > buflen || need < saltstrlen) | |
| goto fail; | |
| - | if (yescrypt_kdf(shared, local, passwd, passwdlen, salt, saltlen, |
| + | if (yescrypt_kdf(local, passwd, passwdlen, salt, saltlen, |
| ¶ms, hashbin, sizeof(hashbin))) | |
| goto fail; | |
| @@ -333,11 +332,6 @@ fail: | |
| return NULL; | |
| } | |
| - | int yescrypt_free_shared(yescrypt_shared_t *shared) |
| - | { |
| - | return free_region(shared); |
| - | } |
| - | |
| int yescrypt_init_local(yescrypt_local_t *local) | |
| { | |
| init_region(local); | |
| @@ -800,7 +800,7 @@ static void smix(uint8_t *B, size_t r, uint32_t N, uint32_t p, uint32_t t, | |
| * This optimized implementation currently limits N to the range from 4 to | |
| * 2^31, but other implementations might not. | |
| */ | |
| - | static int yescrypt_kdf_body(const yescrypt_shared_t *shared, |
| + | static int yescrypt_kdf_body( |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *salt, size_t saltlen, | |
| @@ -865,23 +865,8 @@ static int yescrypt_kdf_body(const yescrypt_shared_t *shared, | |
| } | |
| VROM = NULL; | |
| - | if (shared) { |
| - | uint64_t expected_size = (size_t)128 * r * NROM; |
| - | if ((NROM & (NROM - 1)) != 0 || |
| - | NROM <= 1 || NROM > UINT32_MAX || |
| - | shared->aligned_size < expected_size) |
| - | goto out_EINVAL; |
| - | if (!(flags & YESCRYPT_INIT_SHARED)) { |
| - | uint64_t *tag = (uint64_t *) |
| - | ((uint8_t *)shared->aligned + expected_size - 48); |
| - | if (tag[0] != YESCRYPT_ROM_TAG1 || tag[1] != YESCRYPT_ROM_TAG2) |
| - | goto out_EINVAL; |
| - | } |
| - | VROM = shared->aligned; |
| - | } else { |
| - | if (NROM) |
| - | goto out_EINVAL; |
| - | } |
| + | if (NROM) |
| + | goto out_EINVAL; |
| /* Allocate memory */ | |
| V = NULL; | |
| @@ -1013,7 +998,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). | |
| */ | |
| - | int yescrypt_kdf(const yescrypt_shared_t *shared, |
| + | int yescrypt_kdf( |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *salt, size_t saltlen, | |
| @@ -1041,7 +1026,7 @@ int yescrypt_kdf(const yescrypt_shared_t *shared, | |
| && N / p >= 0x100 | |
| && N / p * r >= 0x20000 | |
| ) { | |
| - | if (yescrypt_kdf_body(shared, local, |
| + | if (yescrypt_kdf_body(local, |
| passwd, passwdlen, salt, saltlen, | |
| flags | YESCRYPT_ALLOC_ONLY, N, r, p, t, NROM, | |
| buf, buflen) != -3 | |
| @@ -1049,7 +1034,7 @@ int yescrypt_kdf(const yescrypt_shared_t *shared, | |
| errno = EINVAL; | |
| return -1; | |
| } | |
| - | retval = yescrypt_kdf_body(shared, local, |
| + | retval = yescrypt_kdf_body(local, |
| passwd, passwdlen, salt, saltlen, | |
| flags | YESCRYPT_PREHASH, N >> 6, r, p, 0, NROM, | |
| dk, sizeof(dk)); | |
| @@ -1059,7 +1044,7 @@ int yescrypt_kdf(const yescrypt_shared_t *shared, | |
| passwdlen = sizeof(dk); | |
| } | |
| - | retval = yescrypt_kdf_body(shared, local, |
| + | retval = yescrypt_kdf_body(local, |
| passwd, passwdlen, salt, saltlen, | |
| flags, N, r, p, t, NROM, buf, buflen); | |
| #ifndef SKIP_MEMZERO | |
| @@ -41,7 +41,6 @@ typedef struct { | |
| /** | |
| * Types for shared (ROM) and thread-local (RAM) data structures. | |
| */ | |
| - | typedef yescrypt_region_t yescrypt_shared_t; |
| typedef yescrypt_region_t yescrypt_local_t; | |
| /** | |
| @@ -80,8 +79,6 @@ typedef uint32_t yescrypt_flags_t; | |
| #define YESCRYPT_SBOX_192K 0x280 | |
| #define YESCRYPT_SBOX_384K 0x300 | |
| #define YESCRYPT_SBOX_768K 0x380 | |
| - | /* Only valid for yescrypt_init_shared() */ |
| - | #define YESCRYPT_SHARED_PREALLOCATED 0x10000 |
| #ifdef YESCRYPT_INTERNAL | |
| /* Private */ | |
| #define YESCRYPT_MODE_MASK 0x003 | |
| @@ -101,7 +98,6 @@ typedef uint32_t yescrypt_flags_t; | |
| #ifdef YESCRYPT_INTERNAL | |
| #define YESCRYPT_KNOWN_FLAGS \ | |
| (YESCRYPT_MODE_MASK | YESCRYPT_RW_FLAVOR_MASK | \ | |
| - | YESCRYPT_SHARED_PREALLOCATED | \ |
| YESCRYPT_INIT_SHARED | YESCRYPT_ALLOC_ONLY | YESCRYPT_PREHASH) | |
| #endif | |
| @@ -139,47 +135,6 @@ typedef union { | |
| #define HASH_SIZE sizeof(yescrypt_binary_t) /* bytes */ | |
| #define HASH_LEN BYTES2CHARS(HASH_SIZE) | |
| - | |
| - | /** |
| - | * yescrypt_init_shared(shared, seed, seedlen, params): |
| - | * Optionally allocate memory for and initialize the shared (ROM) data |
| - | * structure. The parameters flags, NROM, r, p, and t specify how the ROM is |
| - | * to be initialized, and seed and seedlen specify the initial seed affecting |
| - | * the data with which the ROM is filled. |
| - | * |
| - | * Return 0 on success; or -1 on error. |
| - | * |
| - | * If bit YESCRYPT_SHARED_PREALLOCATED in flags is set, then memory for the |
| - | * ROM is assumed to have been preallocated by the caller, with shared->aligned |
| - | * being the start address of the ROM and shared->aligned_size being its size |
| - | * (which must be sufficient for NROM, r, p). This may be used e.g. when the |
| - | * ROM is to be placed in a SysV shared memory segment allocated by the caller. |
| - | * |
| - | * MT-safe as long as shared is local to the thread. |
| - | */ |
| - | extern int yescrypt_init_shared(yescrypt_shared_t *shared, |
| - | const uint8_t *seed, size_t seedlen, const yescrypt_params_t *params); |
| - | |
| - | /** |
| - | * yescrypt_digest_shared(shared): |
| - | * Extract the previously stored message digest of the provided yescrypt ROM. |
| - | * |
| - | * Return pointer to the message digest on success; or NULL on error. |
| - | * |
| - | * MT-unsafe. |
| - | */ |
| - | extern yescrypt_binary_t *yescrypt_digest_shared(yescrypt_shared_t *shared); |
| - | |
| - | /** |
| - | * yescrypt_free_shared(shared): |
| - | * Free memory that had been allocated with yescrypt_init_shared(). |
| - | * |
| - | * Return 0 on success; or -1 on error. |
| - | * |
| - | * MT-safe as long as shared is local to the thread. |
| - | */ |
| - | extern int yescrypt_free_shared(yescrypt_shared_t *shared); |
| - | |
| /** | |
| * yescrypt_init_local(local): | |
| * Initialize the thread-local (RAM) data structure. Actual memory allocation | |
| @@ -239,7 +194,7 @@ 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(const yescrypt_shared_t *shared, |
| + | extern int yescrypt_kdf( |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *salt, size_t saltlen, | |
| @@ -261,11 +216,10 @@ extern int yescrypt_kdf(const yescrypt_shared_t *shared, | |
| * | |
| * MT-safe as long as local and buf are local to the thread. | |
| */ | |
| - | extern uint8_t *yescrypt_r(const yescrypt_shared_t *shared, |
| + | extern uint8_t *yescrypt_r( |
| yescrypt_local_t *local, | |
| const uint8_t *passwd, size_t passwdlen, | |
| const uint8_t *setting, | |
| - | //KEY: const yescrypt_binary_t *key, |
| uint8_t *buf, size_t buflen); | |
| extern const uint8_t *decode64(uint8_t *dst, size_t *dstlen, | |