Use new PSA to mbedtls PK error mapping functions in rsa_verify_wrap()

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
This commit is contained in:
Neil Armstrong 2022-03-03 16:50:11 +01:00
parent 8a44bb47ac
commit 19e6bc4c9f

View File

@ -207,7 +207,7 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
&key_id ); &key_id );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
{ {
ret = mbedtls_psa_err_translate_pk( status ); ret = mbedtls_pk_error_from_psa( status );
goto cleanup; goto cleanup;
} }
@ -215,14 +215,7 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
sig, sig_len ); sig, sig_len );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
{ {
if ( status == PSA_ERROR_INVALID_SIGNATURE ) ret = mbedtls_pk_error_from_psa_rsa( status );
{
ret = MBEDTLS_ERR_RSA_VERIFY_FAILED;
}
else
{
ret = mbedtls_psa_err_translate_pk( status );
}
goto cleanup; goto cleanup;
} }
ret = 0; ret = 0;
@ -230,7 +223,7 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
cleanup: cleanup:
status = psa_destroy_key( key_id ); status = psa_destroy_key( key_id );
if( ret == 0 && status != PSA_SUCCESS ) if( ret == 0 && status != PSA_SUCCESS )
ret = mbedtls_psa_err_translate_pk( status ); ret = mbedtls_pk_error_from_psa( status );
return( ret ); return( ret );
} }