Free hd_context if error.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -664,6 +664,7 @@ int cmd_cipher_sym() {
|
|||||||
secret[64] = { 0 };
|
secret[64] = { 0 };
|
||||||
mbedtls_aes_init(&ctx);
|
mbedtls_aes_init(&ctx);
|
||||||
if (hd_keytype != 0x3) {
|
if (hd_keytype != 0x3) {
|
||||||
|
mbedtls_ecdsa_free(&hd_context);
|
||||||
return SW_INCORRECT_PARAMS();
|
return SW_INCORRECT_PARAMS();
|
||||||
}
|
}
|
||||||
key_size = 32;
|
key_size = 32;
|
||||||
|
|||||||
@@ -284,11 +284,13 @@ int cmd_signature() {
|
|||||||
}
|
}
|
||||||
else if (p2 == ALGO_HD) {
|
else if (p2 == ALGO_HD) {
|
||||||
size_t olen = 0;
|
size_t olen = 0;
|
||||||
uint8_t buf[MBEDTLS_ECDSA_MAX_LEN];
|
uint8_t buf[MBEDTLS_ECDSA_MAX_LEN] = {0};
|
||||||
if (hd_context.grp.id == MBEDTLS_ECP_DP_NONE) {
|
if (hd_context.grp.id == MBEDTLS_ECP_DP_NONE) {
|
||||||
|
mbedtls_ecdsa_free(&hd_context);
|
||||||
return SW_CONDITIONS_NOT_SATISFIED();
|
return SW_CONDITIONS_NOT_SATISFIED();
|
||||||
}
|
}
|
||||||
if (hd_keytype != 0x1 && hd_keytype != 0x2) {
|
if (hd_keytype != 0x1 && hd_keytype != 0x2) {
|
||||||
|
mbedtls_ecdsa_free(&hd_context);
|
||||||
return SW_INCORRECT_PARAMS();
|
return SW_INCORRECT_PARAMS();
|
||||||
}
|
}
|
||||||
md = MBEDTLS_MD_SHA256;
|
md = MBEDTLS_MD_SHA256;
|
||||||
|
|||||||
Reference in New Issue
Block a user