Fix scan-build warnings in gcrypt backend

This commit is contained in:
Milan Broz
2024-07-12 14:33:37 +02:00
parent 8accd612a3
commit 3839e2bf98

View File

@@ -51,7 +51,6 @@ static void crypt_hash_test_whirlpool_bug(void)
{ {
struct crypt_hash *h; struct crypt_hash *h;
char buf[2] = "\0\0", hash_out1[64], hash_out2[64]; char buf[2] = "\0\0", hash_out1[64], hash_out2[64];
int r;
if (crypto_backend_whirlpool_bug >= 0) if (crypto_backend_whirlpool_bug >= 0)
return; return;
@@ -61,16 +60,16 @@ static void crypt_hash_test_whirlpool_bug(void)
return; return;
/* One shot */ /* One shot */
if ((r = crypt_hash_write(h, &buf[0], 2)) || if (crypt_hash_write(h, &buf[0], 2) ||
(r = crypt_hash_final(h, hash_out1, 64))) { crypt_hash_final(h, hash_out1, 64)) {
crypt_hash_destroy(h); crypt_hash_destroy(h);
return; return;
} }
/* Split buf (crypt_hash_final resets hash state) */ /* Split buf (crypt_hash_final resets hash state) */
if ((r = crypt_hash_write(h, &buf[0], 1)) || if (crypt_hash_write(h, &buf[0], 1) ||
(r = crypt_hash_write(h, &buf[1], 1)) || crypt_hash_write(h, &buf[1], 1) ||
(r = crypt_hash_final(h, hash_out2, 64))) { crypt_hash_final(h, hash_out2, 64)) {
crypt_hash_destroy(h); crypt_hash_destroy(h);
return; return;
} }