Closed falko-strenzke closed 1 year ago
HMAC test ignores failure when setting key
tests/basic.c:
tests/basic.c
static void check_one_hmac (int algo, const char *data, int datalen, const char *key, int keylen, const char *expect) { gcry_md_hd_t hd, hd2; unsigned char *p; int mdlen; int i; gcry_error_t err = 0; [...] err = gcry_md_setkey( hd, key, keylen ); if (err) { if (in_fips_mode) { if (verbose) fprintf (stderr, " shorter key (%d) rejected correctly in fips mode\n", keylen); } gcry_md_close (hd); return; }
The equivalent MAC test does it correctly, though:
err = gcry_mac_setkey (hd, key, keylen); if (err) { if (in_fips_mode) { if (verbose) fprintf (stderr, " shorter key (%d) rejected correctly in fips mode\n", keylen); } else fail("algo %d, mac gcry_mac_setkey failed: %s\n", algo, gpg_strerror (err)); goto out; }
HMAC test ignores failure when setting key
tests/basic.c
:The equivalent MAC test does it correctly, though: