Check HMAC_Init_ex() return value

This commit is contained in:
Nicolas Williams
2022-01-12 21:10:45 -06:00
parent 52f3dc6aa4
commit 05e8c0ede6
11 changed files with 125 additions and 65 deletions

View File

@@ -276,7 +276,8 @@ check_hmac(void)
"\x6f\xd1\x52\x4d\x54\x58\x73\x0f\xf3\x24";
HMAC_CTX_init(&c);
HMAC_Init_ex(&c, hmackey, hmackey_size, EVP_sha1(), NULL);
if (HMAC_Init_ex(&c, hmackey, hmackey_size, EVP_sha1(), NULL) == 0)
errx(1, "HMAC_Init_ex() out of memory");
HMAC_Update(&c, buf, sizeof(buf));
HMAC_Final(&c, hmac, &hmaclen);
HMAC_CTX_cleanup(&c);