From 19e6bc4c9f617f06426bcd405b015bed88f1baca Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Thu, 3 Mar 2022 16:50:11 +0100 Subject: [PATCH] Use new PSA to mbedtls PK error mapping functions in rsa_verify_wrap() Signed-off-by: Neil Armstrong --- library/pk_wrap.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/library/pk_wrap.c b/library/pk_wrap.c index 2447cf688..4b834ea0a 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -207,7 +207,7 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg, &key_id ); if( status != PSA_SUCCESS ) { - ret = mbedtls_psa_err_translate_pk( status ); + ret = mbedtls_pk_error_from_psa( status ); goto cleanup; } @@ -215,14 +215,7 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg, sig, sig_len ); if( status != PSA_SUCCESS ) { - if ( status == PSA_ERROR_INVALID_SIGNATURE ) - { - ret = MBEDTLS_ERR_RSA_VERIFY_FAILED; - } - else - { - ret = mbedtls_psa_err_translate_pk( status ); - } + ret = mbedtls_pk_error_from_psa_rsa( status ); goto cleanup; } ret = 0; @@ -230,7 +223,7 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg, cleanup: status = psa_destroy_key( key_id ); if( ret == 0 && status != PSA_SUCCESS ) - ret = mbedtls_psa_err_translate_pk( status ); + ret = mbedtls_pk_error_from_psa( status ); return( ret ); }