From 059a80c212cb9ab593d1a8f78974c7ff5b32078e Mon Sep 17 00:00:00 2001 From: Neil Armstrong Date: Thu, 24 Feb 2022 15:23:42 +0100 Subject: [PATCH] Map INVALID_PADDING from PSA to MbedTLS error in rsa_verify_wrap() Signed-off-by: Neil Armstrong --- library/pk_wrap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/pk_wrap.c b/library/pk_wrap.c index b3db3d764..71b60398d 100644 --- a/library/pk_wrap.c +++ b/library/pk_wrap.c @@ -215,7 +215,14 @@ static int rsa_verify_wrap( void *ctx, mbedtls_md_type_t md_alg, sig, sig_len ); if( status != PSA_SUCCESS ) { - ret = mbedtls_psa_err_translate_pk( status ); + if ( status == PSA_ERROR_INVALID_PADDING ) + { + ret = MBEDTLS_ERR_RSA_INVALID_PADDING; + } + else + { + ret = mbedtls_psa_err_translate_pk( status ); + } goto cleanup; } ret = 0;