Skip to content

Commit 8e03d05

Browse files
committed
wolfssl/test.h: add missing wc_HmacFree()s in myMacEncryptCb(), myDecryptVerifyCb(), myEncryptMacCb(), myVerifyDecryptCb().
1 parent 15fcf70 commit 8e03d05

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

wolfssl/test.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,7 @@ static WC_INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut,
28302830
ret = wc_HmacFinal(&hmac, macOut);
28312831
if (ret != 0)
28322832
return ret;
2833-
2833+
wc_HmacFree(&hmac);
28342834

28352835
/* encrypt setup on first time */
28362836
if (encCtx->keySetup == 0) {
@@ -2959,6 +2959,7 @@ static WC_INLINE int myDecryptVerifyCb(WOLFSSL* ssl,
29592959
ret = wc_HmacFinal(&hmac, verify);
29602960
if (ret != 0)
29612961
return ret;
2962+
wc_HmacFree(&hmac);
29622963

29632964
if (XMEMCMP(verify, decOut + decSz - digestSz - pad - padByte,
29642965
(size_t) digestSz) != 0) {
@@ -3041,7 +3042,9 @@ static WC_INLINE int myEncryptMacCb(WOLFSSL* ssl, unsigned char* macOut,
30413042
ret = wc_HmacUpdate(&hmac, encOut, encSz);
30423043
if (ret != 0)
30433044
return ret;
3044-
return wc_HmacFinal(&hmac, macOut);
3045+
ret = wc_HmacFinal(&hmac, macOut);
3046+
wc_HmacFree(&hmac);
3047+
return ret;
30453048
}
30463049

30473050

@@ -3088,6 +3091,7 @@ static WC_INLINE int myVerifyDecryptCb(WOLFSSL* ssl,
30883091
ret = wc_HmacFinal(&hmac, verify);
30893092
if (ret != 0)
30903093
return ret;
3094+
wc_HmacFree(&hmac);
30913095

30923096
if (XMEMCMP(verify, decOut + decSz, (size_t) digestSz) != 0) {
30933097
printf("myDecryptVerify verify failed\n");

0 commit comments

Comments
 (0)