Skip to content

Commit

Permalink
argon2: Avoid unitialized warning in cppcheck
Browse files Browse the repository at this point in the history
Thsi patch avoids this cppcheck warning:

Error: CPPCHECK_WARNING (CWE-457): [#def1]
cryptsetup-main/lib/crypto_backend/argon2/blake2/blake2b.c:369: warning[uninitvar]: Uninitialized variable: out_buffer

It is a false positive, but wiping buffer is cheap a and similar approach is used
in other Argon2 implementations (OpenSSL).
  • Loading branch information
mbroz committed Nov 8, 2024
1 parent 46289f9 commit c397237
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/crypto_backend/argon2/blake2/blake2b.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
TRY(blake2b_final(&blake_state, out, outlen));
} else {
uint32_t toproduce;
uint8_t out_buffer[BLAKE2B_OUTBYTES];
uint8_t out_buffer[BLAKE2B_OUTBYTES] = {0};
uint8_t in_buffer[BLAKE2B_OUTBYTES];
TRY(blake2b_init(&blake_state, BLAKE2B_OUTBYTES));
TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
Expand Down

0 comments on commit c397237

Please sign in to comment.