From 3110c7b340f04a438cedc8465d88d94a1f7fddf7 Mon Sep 17 00:00:00 2001 From: pespacek Date: Mon, 14 Feb 2022 15:07:41 +0100 Subject: [PATCH] Changing error codes. Change from MBEDTLS_ERR_ERROR_GENERIC_ERROR to MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED where PSA crypto is used. Signed-off-by: pespacek --- library/x509_crt.c | 2 +- library/x509write_crt.c | 4 ++-- library/x509write_csr.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/x509_crt.c b/library/x509_crt.c index b7eb617180..b0c2d481a9 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -2464,7 +2464,7 @@ static int x509_crt_check_signature( const mbedtls_x509_crt *child, &hash_len ); if( status != PSA_SUCCESS ) { - return MBEDTLS_ERR_ERROR_GENERIC_ERROR; + return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ); } #endif /* MBEDTLS_USE_PSA_CRYPTO */ diff --git a/library/x509write_crt.c b/library/x509write_crt.c index 44a97296f0..b0589cc20e 100644 --- a/library/x509write_crt.c +++ b/library/x509write_crt.c @@ -243,7 +243,7 @@ int mbedtls_x509write_crt_set_authority_key_identifier( mbedtls_x509write_cert * &hash_length ); if( status != PSA_SUCCESS ) { - return( MBEDTLS_ERR_ERROR_GENERIC_ERROR ); + return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ); } #else ret = mbedtls_sha1( buf + sizeof( buf ) - len, len, @@ -527,7 +527,7 @@ int mbedtls_x509write_crt_der( mbedtls_x509write_cert *ctx, &hash_length ); if( status != PSA_SUCCESS ) { - return MBEDTLS_ERR_ERROR_GENERIC_ERROR; + return( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ); } #else if( ( ret = mbedtls_md( mbedtls_md_info_from_type( ctx->md_alg ), c, diff --git a/library/x509write_csr.c b/library/x509write_csr.c index a9fc8ba1ac..a58374f3da 100644 --- a/library/x509write_csr.c +++ b/library/x509write_csr.c @@ -225,7 +225,7 @@ static int x509write_csr_der_internal( mbedtls_x509write_csr *ctx, PSA_HASH_MAX_SIZE, &hash_len ) != PSA_SUCCESS ) { - return ( MBEDTLS_ERR_X509_FATAL_ERROR ); + return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ); } #else /* MBEDTLS_USE_PSA_CRYPTO */ ret = mbedtls_md( mbedtls_md_info_from_type( ctx->md_alg ), c, len, hash );