diff --git a/src/core/config/platform.h b/src/core/config/platform.h index f00bef8ca..f191a89c5 100644 --- a/src/core/config/platform.h +++ b/src/core/config/platform.h @@ -34,6 +34,7 @@ #ifndef OT_CORE_CONFIG_PLATFORM_H_ #define OT_CORE_CONFIG_PLATFORM_H_ +#include "config/crypto.h" #include "config/srp_server.h" /** @@ -156,7 +157,8 @@ * Define to 1 if you want to enable key ref usage support as defined by platform. */ #ifndef OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE -#define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE 0 +#define OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE \ + (OPENTHREAD_CONFIG_CRYPTO_LIB == OPENTHREAD_CONFIG_CRYPTO_LIB_PSA) #endif /** diff --git a/src/core/crypto/crypto_platform_psa.cpp b/src/core/crypto/crypto_platform_psa.cpp index 8f2e2bdf0..9ce2eec26 100644 --- a/src/core/crypto/crypto_platform_psa.cpp +++ b/src/core/crypto/crypto_platform_psa.cpp @@ -58,6 +58,10 @@ using namespace Crypto; #if OPENTHREAD_CONFIG_CRYPTO_LIB == OPENTHREAD_CONFIG_CRYPTO_LIB_PSA +#if !OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE +#error "`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required when `CONFIG_CRYPTO_LIB_PSA` is selected" +#endif + //--------------------------------------------------------------------------------------------------------------------- // Default/weak implementation of crypto platform APIs