From 4bb166a2a83efc62e94cac7e687a9e6f7586833c Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Thu, 4 Mar 2021 22:10:07 +0100 Subject: [PATCH] bcrypt_pbkdf.c: fix clang10 false positive warning (#563) File: bcrypt_pbkdf.c Notes: blf_enc() takes a number of 64-bit blocks to encrypt, but using sizeof(uint64_t) in the calculation triggers a warning with clang 10 because the actual data type is uint32_t. Pass BCRYPT_BLOCKS / 2 for the number of blocks like libc bcrypt(3) does. Ref: https://github.com/openbsd/src/commit/04a2240bd8f465bcae6b595d912af3e2965856de Fixes #562 Credit: Viktor Szakats --- src/bcrypt_pbkdf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bcrypt_pbkdf.c b/src/bcrypt_pbkdf.c index f9a97580..f782bcac 100644 --- a/src/bcrypt_pbkdf.c +++ b/src/bcrypt_pbkdf.c @@ -81,7 +81,7 @@ bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out) cdata[i] = Blowfish_stream2word(ciphertext, sizeof(ciphertext), &j); for(i = 0; i < 64; i++) - blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t)); + blf_enc(&state, cdata, BCRYPT_BLOCKS / 2); /* copy out */ for(i = 0; i < BCRYPT_BLOCKS; i++) {