mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
Make code more robust
Using return here is only correct if we know that group_load() is atomic (either succeeds, or allocates no ressources). I'm not sure it is, and even if it were, goto exit is more obviously correct, so let's use that. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
@@ -264,7 +264,7 @@ static int pk_ecc_set_pubkey_psa_ecp_fallback(mbedtls_pk_context *pk,
|
||||
mbedtls_ecp_keypair_init(&ecp_key);
|
||||
ret = mbedtls_ecp_group_load(&(ecp_key.grp), ecp_group_id);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
goto exit;
|
||||
}
|
||||
ret = mbedtls_ecp_point_read_binary(&(ecp_key.grp), &ecp_key.Q,
|
||||
pub, pub_len);
|
||||
|
||||
Reference in New Issue
Block a user