Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions wolfcrypt/src/asn.c
Original file line number Diff line number Diff line change
Expand Up @@ -12380,7 +12380,9 @@ int wc_DsaPublicKeyDecode(const byte* input, word32* inOutIdx, DsaKey* key,
ret = BAD_FUNC_ARG;
}

ALLOC_ASNGETDATA(dataASN, dsaPubKeyASN_Length, ret, key->heap);
if (ret == 0) {
ALLOC_ASNGETDATA(dataASN, dsaPubKeyASN_Length, ret, key->heap);
}

if (ret == 0) {
int i;
Expand Down Expand Up @@ -13010,7 +13012,7 @@ static int DsaKeyIntsToDer(DsaKey* key, byte* output, word32* inLen,
ret = (int)sz;
}

FREE_ASNSETDATA(dataASN, key->heap);
FREE_ASNSETDATA(dataASN, key != NULL ? key->heap : NULL);
return ret;
#endif /* WOLFSSL_ASN_TEMPLATE */
}
Expand Down Expand Up @@ -37127,7 +37129,9 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
}
#endif

CALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, key->heap);
if (ret == 0) {
CALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, key->heap);
}

if (ret == 0) {
/* Get the version and set the expected OID type. */
Expand Down Expand Up @@ -37538,7 +37542,9 @@ int wc_EccPublicKeyDecode(const byte* input, word32* inOutIdx,
ret = BAD_FUNC_ARG;
}

ALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, key->heap);
if (ret == 0) {
ALLOC_ASNGETDATA(dataASN, eccKeyASN_Length, ret, key->heap);
}

if (ret == 0) {
/* Clear dynamic data for ECC public key. */
Expand Down Expand Up @@ -37901,7 +37907,7 @@ int wc_BuildEccKeyDer(ecc_key* key, byte* output, word32 *inLen,
ret = (int)sz;
}

FREE_ASNSETDATA(dataASN, key->heap);
FREE_ASNSETDATA(dataASN, key != NULL ? key->heap : NULL);
return ret;
#endif
}
Expand Down
Loading