Skip to content

Commit 509dcb4

Browse files
authored
Merge pull request #543 from chipitsine/master
test_pkcs12_rfc9337: check HMAC result and init MAC buffer
2 parents 51925d3 + 26fb960 commit 509dcb4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎test_pkcs12_rfc9337.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,10 @@ static int run_case(EVP_PKEY *pkey, X509 *cert,
408408
ASN1_STRING_length(salt),
409409
(int)iters, md, sizeof(dk), dk) == 1);
410410
memcpy(hmac_key, dk + 64, 32);
411-
unsigned char mac9548[64]; unsigned int mac9548_len = sizeof(mac9548);
412-
HMAC(md, hmac_key, sizeof(hmac_key), adata, alen, mac9548, &mac9548_len);
411+
unsigned char mac9548[64] = {0};
412+
unsigned int mac9548_len = sizeof(mac9548);
413+
ASSERT(HMAC(md, hmac_key, sizeof(hmac_key), adata, alen, mac9548,
414+
&mac9548_len) != NULL);
413415
ASSERT((int)mac9548_len == ASN1_STRING_length(macval) &&
414416
memcmp(mac9548, ASN1_STRING_get0_data(macval), mac9548_len) == 0);
415417

0 commit comments

Comments
 (0)