From cacea588b5ec647ca6479b5ab99d6c9f694cd6e8 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 8 Sep 2020 10:22:32 -0700 Subject: [PATCH] Add calls to wc_HmacFree(). Normally, HMAC isn't allocating resources. This is future proofing when using wolfSSH with async crypto. --- src/internal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internal.c b/src/internal.c index 6dac8a7..34b4406 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5244,6 +5244,7 @@ static INLINE int CreateMac(WOLFSSH* ssh, const byte* in, word32 inSz, ret = wc_HmacFinal(&hmac, digest); if (ret == WS_SUCCESS) WMEMCPY(mac, digest, SHA1_96_SZ); + wc_HmacFree(&hmac); } break; @@ -5261,6 +5262,7 @@ static INLINE int CreateMac(WOLFSSH* ssh, const byte* in, word32 inSz, ret = wc_HmacUpdate(&hmac, in, inSz); if (ret == WS_SUCCESS) ret = wc_HmacFinal(&hmac, mac); + wc_HmacFree(&hmac); } break; @@ -5279,6 +5281,7 @@ static INLINE int CreateMac(WOLFSSH* ssh, const byte* in, word32 inSz, ret = wc_HmacUpdate(&hmac, in, inSz); if (ret == WS_SUCCESS) ret = wc_HmacFinal(&hmac, mac); + wc_HmacFree(&hmac); } break; @@ -5347,6 +5350,7 @@ static INLINE int VerifyMac(WOLFSSH* ssh, const byte* in, word32 inSz, default: ret = WS_INVALID_ALGO_ID; } + wc_HmacFree(&hmac); } return ret;