From 80aedd2f3932fbbe3a45846dee14c45781dcfa85 Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Wed, 16 Nov 2016 14:52:13 +0000 Subject: [PATCH 1/3] Move crypto hardware acceleration configuration The crypto hardware acceleration might require defining a lot of mbed TLS specific macros. Enumerating all of them in `targets.json` creates too much noise, therefore we move it into a target specific mbed TLS header. The target with crypto hardware acceleration has to - indicate its capability in `targets.json` by adding "CRYPTO" to the "device_has" section - has to define his crypto hardware acceleration related macros in an `mbedtls_device.h` header - place the `mbedtls_device.h` file in the `features/mbedtls/targets/TARGET_XXXX` directory specific to the target --- features/mbedtls/importer/Makefile | 1 - features/mbedtls/platform/inc/platform_mbed.h | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/features/mbedtls/importer/Makefile b/features/mbedtls/importer/Makefile index 2c5cad3eb2..9fcf84bcf6 100644 --- a/features/mbedtls/importer/Makefile +++ b/features/mbedtls/importer/Makefile @@ -93,7 +93,6 @@ clean: rm -f $(TARGET_PREFIX)apache-2.0.txt rm -f $(TARGET_PREFIX)VERSION.txt rm -f $(TARGET_PREFIX)AUTHORS.txt - rm -rf $(TARGET_PREFIX)/targets rm -rf $(TARGET_SRC) rm -rf $(TARGET_INC) rm -rf $(MBED_TLS_DIR) diff --git a/features/mbedtls/platform/inc/platform_mbed.h b/features/mbedtls/platform/inc/platform_mbed.h index 53b2fca16a..6c562a7a0e 100644 --- a/features/mbedtls/platform/inc/platform_mbed.h +++ b/features/mbedtls/platform/inc/platform_mbed.h @@ -20,3 +20,7 @@ #if defined(DEVICE_TRNG) #define MBEDTLS_ENTROPY_HARDWARE_ALT #endif + +#if defined(DEVICE_CRYPTO) +#include "mbedtls_device.h" +#endif From 9137574e4d330370df242a0fa6c914f2f0eb5528 Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Fri, 18 Nov 2016 09:55:16 +0000 Subject: [PATCH 2/3] Move mbed TLS configuration symbol to macro section The configuration option for the mbed TLS specific hardware acceleration has to be in the macro section and not in the device capabilities section in targets.json. The option has also been renamed to better reflect its function. --- features/mbedtls/platform/inc/platform_mbed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/mbedtls/platform/inc/platform_mbed.h b/features/mbedtls/platform/inc/platform_mbed.h index 6c562a7a0e..3c22a7479f 100644 --- a/features/mbedtls/platform/inc/platform_mbed.h +++ b/features/mbedtls/platform/inc/platform_mbed.h @@ -21,6 +21,6 @@ #define MBEDTLS_ENTROPY_HARDWARE_ALT #endif -#if defined(DEVICE_CRYPTO) +#if defined(MBEDTLS_HW_SUPPORT) #include "mbedtls_device.h" #endif From e9144ad771ae3bae8672c4d5492e3901b68a13cf Mon Sep 17 00:00:00 2001 From: Janos Follath Date: Fri, 18 Nov 2016 15:01:01 +0000 Subject: [PATCH 3/3] Apply new naming convention to mbed TLS macros --- features/mbedtls/platform/inc/platform_mbed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/mbedtls/platform/inc/platform_mbed.h b/features/mbedtls/platform/inc/platform_mbed.h index 3c22a7479f..8632ec0328 100644 --- a/features/mbedtls/platform/inc/platform_mbed.h +++ b/features/mbedtls/platform/inc/platform_mbed.h @@ -21,6 +21,6 @@ #define MBEDTLS_ENTROPY_HARDWARE_ALT #endif -#if defined(MBEDTLS_HW_SUPPORT) +#if defined(MBEDTLS_CONFIG_HW_SUPPORT) #include "mbedtls_device.h" #endif