mirror of https://github.com/ARMmbed/mbed-os.git
platform_mbed.h: Fix and align EXPERIMENTAL_API check
Some of the lines in `platform_mbed.h` only have `FEATURE_PSA` checked, which is always set for Mbed OS PSA targets but the PSA APIs are not actually available unless `FEATURE_EXPERIMENTAL_API` is also enabled. To fix this and improve readability, group all PSA-related lines and check both macros.pull/14815/head
parent
8ce87194fd
commit
fbca8e9c84
|
@ -21,7 +21,9 @@
|
|||
#ifndef __PLATFORM_MBED__H__
|
||||
#define __PLATFORM_MBED__H__
|
||||
|
||||
#if (defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA) && defined(MBEDTLS_ENTROPY_NV_SEED))
|
||||
#if defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA)
|
||||
|
||||
#if defined(MBEDTLS_ENTROPY_NV_SEED)
|
||||
|
||||
#include "default_random_seed.h"
|
||||
|
||||
|
@ -37,7 +39,18 @@
|
|||
* MBEDTLS_ENTROPY_NV_SEED is enabled. */
|
||||
#define MBEDTLS_PSA_INJECT_ENTROPY
|
||||
|
||||
#endif // (defined(FEATURE_PSA) && defined(MBEDTLS_ENTROPY_NV_SEED))
|
||||
#endif // defined(MBEDTLS_ENTROPY_NV_SEED)
|
||||
|
||||
/* The following configurations are a needed for Mbed Crypto submodule.
|
||||
* They are related to the persistent key storage feature.
|
||||
*/
|
||||
#define MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
#define MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
|
||||
#undef MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
|
||||
|
||||
#define MBEDTLS_ENTROPY_HARDWARE_ALT
|
||||
|
||||
#endif // defined(FEATURE_EXPERIMENTAL_API) && defined(FEATURE_PSA)
|
||||
|
||||
#if DEVICE_TRNG
|
||||
#if !defined(MBEDTLS_ENTROPY_HARDWARE_ALT)
|
||||
|
@ -49,17 +62,6 @@
|
|||
#include "mbedtls_device.h"
|
||||
#endif
|
||||
|
||||
#if defined(FEATURE_PSA)
|
||||
/* The following configurations are a needed for Mbed Crypto submodule.
|
||||
* They are related to the persistent key storage feature.
|
||||
*/
|
||||
#define MBEDTLS_PSA_CRYPTO_STORAGE_C
|
||||
#define MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C
|
||||
#undef MBEDTLS_PSA_CRYPTO_STORAGE_FILE_C
|
||||
|
||||
#define MBEDTLS_ENTROPY_HARDWARE_ALT
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MBEDTLS_ERR_PLATFORM_HW_FAILED is deprecated and should not be used.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue