[git commit] libbb/yescrypt: 64-bit build fixes

Denys Vlasenko vda.linux at googlemail.com
Mon Jul 7 19:52:39 UTC 2025


commit: https://git.busybox.net/busybox/commit/?id=e5d3a87633eac2a8a17d909b98a1e6dd21f80489
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 libbb/yescrypt/alg-yescrypt-kdf.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libbb/yescrypt/alg-yescrypt-kdf.c b/libbb/yescrypt/alg-yescrypt-kdf.c
index 13ae62b7c..d24b05150 100644
--- a/libbb/yescrypt/alg-yescrypt-kdf.c
+++ b/libbb/yescrypt/alg-yescrypt-kdf.c
@@ -823,6 +823,7 @@ static int yescrypt_kdf32_body(
 	salsa20_blk_t *V, *XY;
 	uint8_t sha256[32];
 	uint8_t dk[sizeof(sha256)], *dkp = buf32;
+	uint32_t r, p;
 
 	/* Sanity-check parameters */
 	switch (flags___YESCRYPT_MODE_MASK) {
@@ -849,13 +850,9 @@ static int yescrypt_kdf32_body(
 	default:
 		goto out_EINVAL;
 	}
-#if SIZE_MAX > UINT32_MAX
-	if (buflen > (((uint64_t)1 << 32) - 1) * 32)
-		goto out_EINVAL;
-#endif
-    {
-	const uint32_t r = YCTX_param_r;
-	const uint32_t p = YCTX_param_p;
+
+	r = YCTX_param_r;
+	p = YCTX_param_p;
 	if ((uint64_t)r * (uint64_t)p >= 1 << 30)
 		goto out_EINVAL;
 	if (N > UINT32_MAX)
@@ -982,7 +979,6 @@ static int yescrypt_kdf32_body(
 out_EINVAL:
 	errno = EINVAL;
 	return -1;
-    }
 }
 
 /**


More information about the busybox-cvs mailing list