Reverted the Hmac_UpdateFinal
change to call final as it causing constant timing issues. Improved the wc_HmacFree
to handle the case were final isn't called for Crypto callbacks.
This commit is contained in:
parent
95db819d45
commit
d98ebc4da2
@ -1112,9 +1112,6 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
/* call final to cleanup */
|
||||
if (ret == 0)
|
||||
ret = wc_HmacFinal(hmac, dummy);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -1076,6 +1076,17 @@ void wc_HmacFree(Hmac* hmac)
|
||||
if (hmac == NULL)
|
||||
return;
|
||||
|
||||
#ifdef WOLF_CRYPTO_CB
|
||||
/* handle cleanup case where final is not called */
|
||||
if (hmac->devId != INVALID_DEVID && hmac->devCtx != NULL) {
|
||||
int ret;
|
||||
byte finalHash[WC_HMAC_BLOCK_SIZE];
|
||||
ret = wc_CryptoCb_Hmac(hmac, hmac->macType, NULL, 0, finalHash);
|
||||
(void)ret; /* must ignore return code here */
|
||||
(void)finalHash;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (hmac->macType) {
|
||||
#ifndef NO_MD5
|
||||
case WC_MD5:
|
||||
|
Loading…
x
Reference in New Issue
Block a user