1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-12-08 03:42:13 +03:00

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: 04a2240bd8

Fixes #562

Credit:
Viktor Szakats
This commit is contained in:
Viktor Szakats
2021-03-04 22:10:07 +01:00
committed by GitHub
parent ae26886671
commit 4bb166a2a8

View File

@@ -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++) {