From 78246e46d12a79a672016a7ed9743d7829b627e2 Mon Sep 17 00:00:00 2001 From: Ron Eldor Date: Mon, 15 Oct 2018 16:21:54 +0300 Subject: [PATCH] Change Mbed TLS platform error code and value Change error from `MBEDTLS_PLATFORM_HW_FAILED` to `MBEDTLS_PLATFORM_HW_ACCEL_FAILED` and the value to 0x70, as the previous value cannot be used as a low level error code. --- .../TARGET_MCU_NRF52840/crypto_platform.c | 2 +- features/mbedtls/platform/inc/platform_mbed.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/crypto_platform.c b/features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/crypto_platform.c index 7a5781fc43..8fccaebc93 100644 --- a/features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/crypto_platform.c +++ b/features/cryptocell/FEATURE_CRYPTOCELL310/TARGET_MCU_NRF52840/crypto_platform.c @@ -30,7 +30,7 @@ int crypto_platform_setup( crypto_platform_ctx *ctx ) NRF_CRYPTOCELL->ENABLE = 1; if( SaSi_LibInit( &ctx->rndState, &rndWorkBuff ) != 0 ) - return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); + return ( MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED ); return ( 0 ); } diff --git a/features/mbedtls/platform/inc/platform_mbed.h b/features/mbedtls/platform/inc/platform_mbed.h index efb5b6dc11..0da5014e97 100644 --- a/features/mbedtls/platform/inc/platform_mbed.h +++ b/features/mbedtls/platform/inc/platform_mbed.h @@ -25,4 +25,9 @@ #include "mbedtls_device.h" #endif +/* + * MBEDTLS_ERR_PLATFORM_HW_FAILED is deprecated and should not be used. + */ #define MBEDTLS_ERR_PLATFORM_HW_FAILED -0x0080 + +#define MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED -0x0070