mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
TLS 1.3 integrity only: initialize HMAC
Ensure the HMAC object is initialized when allocated.
This commit is contained in:
17
src/keys.c
17
src/keys.c
@ -2909,6 +2909,15 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
|||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enc) {
|
||||||
|
if (wc_HmacInit(enc->hmac, heap, devId) != 0) {
|
||||||
|
WOLFSSL_MSG("HmacInit failed in SetKeys");
|
||||||
|
XFREE(enc->hmac, heap, DYNAMIC_TYPE_CIPHER);
|
||||||
|
enc->hmac = NULL;
|
||||||
|
return ASYNC_INIT_E;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dec && dec->hmac == NULL) {
|
if (dec && dec->hmac == NULL) {
|
||||||
dec->hmac = (Hmac*)XMALLOC(sizeof(Hmac), heap,
|
dec->hmac = (Hmac*)XMALLOC(sizeof(Hmac), heap,
|
||||||
DYNAMIC_TYPE_CIPHER);
|
DYNAMIC_TYPE_CIPHER);
|
||||||
@ -2916,15 +2925,11 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs,
|
|||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enc) {
|
|
||||||
if (wc_HmacInit(enc->hmac, heap, devId) != 0) {
|
|
||||||
WOLFSSL_MSG("HmacInit failed in SetKeys");
|
|
||||||
return ASYNC_INIT_E;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (dec) {
|
if (dec) {
|
||||||
if (wc_HmacInit(dec->hmac, heap, devId) != 0) {
|
if (wc_HmacInit(dec->hmac, heap, devId) != 0) {
|
||||||
WOLFSSL_MSG("HmacInit failed in SetKeys");
|
WOLFSSL_MSG("HmacInit failed in SetKeys");
|
||||||
|
XFREE(dec->hmac, heap, DYNAMIC_TYPE_CIPHER);
|
||||||
|
dec->hmac = NULL;
|
||||||
return ASYNC_INIT_E;
|
return ASYNC_INIT_E;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user