[git commit] libbb/yescrypt: remove unused variable

Denys Vlasenko vda.linux at googlemail.com
Sun Jul 6 01:22:46 UTC 2025


commit: https://git.busybox.net/busybox/commit/?id=1524540613427b22cc9acf9e8fb1748f5dd425f7
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-common.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/libbb/yescrypt/alg-yescrypt-common.c b/libbb/yescrypt/alg-yescrypt-common.c
index c04e074bd..388bf1a12 100644
--- a/libbb/yescrypt/alg-yescrypt-common.c
+++ b/libbb/yescrypt/alg-yescrypt-common.c
@@ -182,8 +182,7 @@ uint8_t *yescrypt_r(
 		uint8_t *buf, size_t buflen)
 {
 	unsigned char saltbin[64], hashbin[32];
-	const uint8_t *src, *saltstr, *salt;
-	const uint8_t *saltend;
+	const uint8_t *src, *saltstr, *saltend;
 	uint8_t *dst;
 	size_t need, prefixlen, saltstrlen, saltlen;
 	uint32_t flavor, N_log2;
@@ -265,19 +264,15 @@ uint8_t *yescrypt_r(
 	if (!saltend || (size_t)(saltend - saltstr) != saltstrlen)
 		goto fail;
 
-	salt = saltbin;
-
 	need = prefixlen + saltstrlen + 1 + HASH_LEN + 1;
 	if (need > buflen || need < saltstrlen)
 		goto fail;
 
-	if (yescrypt_kdf(local, passwd, passwdlen, salt, saltlen,
+	if (yescrypt_kdf(local, passwd, passwdlen, saltbin, saltlen,
 	    &params, hashbin, sizeof(hashbin)))
 		goto fail;
 
-	dst = buf;
-	memcpy(dst, setting, prefixlen + saltstrlen);
-	dst += prefixlen + saltstrlen;
+	dst = mempcpy(buf, setting, prefixlen + saltstrlen);
 	*dst++ = '$';
 
 	dst = encode64(dst, buflen - (dst - buf), hashbin, sizeof(hashbin));


More information about the busybox-cvs mailing list