mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
pk: fix return codes' precedence and code style
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
This commit is contained in:
@@ -1107,7 +1107,7 @@ cleanup:
|
||||
static int eckey_check_pair_psa(const mbedtls_ecp_keypair *pub,
|
||||
const mbedtls_ecp_keypair *prv)
|
||||
{
|
||||
psa_status_t status;
|
||||
psa_status_t status, destruction_status;
|
||||
psa_key_attributes_t key_attr = PSA_KEY_ATTRIBUTES_INIT;
|
||||
mbedtls_ecp_keypair *prv_ctx = (mbedtls_ecp_keypair *) prv;
|
||||
mbedtls_ecp_keypair *pub_ctx = (mbedtls_ecp_keypair *) pub;
|
||||
@@ -1134,20 +1134,21 @@ static int eckey_check_pair_psa(const mbedtls_ecp_keypair *pub,
|
||||
}
|
||||
|
||||
status = psa_import_key(&key_attr, prv_key_buf, curve_bytes, &key_id);
|
||||
if (status != PSA_SUCCESS) {
|
||||
ret = PSA_PK_TO_MBEDTLS_ERR(status);
|
||||
ret = PSA_PK_TO_MBEDTLS_ERR(status);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
mbedtls_platform_zeroize(prv_key_buf, sizeof(prv_key_buf));
|
||||
|
||||
ret = PSA_PK_TO_MBEDTLS_ERR(psa_export_public_key(key_id,
|
||||
prv_key_buf,
|
||||
sizeof(prv_key_buf),
|
||||
&prv_key_len));
|
||||
status = psa_destroy_key(key_id);
|
||||
if (ret != 0 || status != PSA_SUCCESS) {
|
||||
return (ret != 0) ? ret : PSA_PK_TO_MBEDTLS_ERR(status);
|
||||
status = psa_export_public_key(key_id, prv_key_buf, sizeof(prv_key_buf),
|
||||
&prv_key_len);
|
||||
ret = PSA_PK_TO_MBEDTLS_ERR(status);
|
||||
destruction_status = psa_destroy_key(key_id);
|
||||
if (ret != 0) {
|
||||
return ret;
|
||||
} else if (destruction_status != PSA_SUCCESS) {
|
||||
return PSA_PK_TO_MBEDTLS_ERR(destruction_status);
|
||||
}
|
||||
|
||||
ret = mbedtls_ecp_point_write_binary(&pub_ctx->grp, &pub_ctx->Q,
|
||||
|
Reference in New Issue
Block a user