From bce4dc028f439e7ead2a8786be75fd249a1eb711 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 9 Nov 2020 15:06:57 +0100 Subject: [PATCH] Include config_psa.h from psa/crypto.h When the new PSA crypto configuration mechanism MBEDTLS_PSA_CRYPTO_CONFIG is disabled, legacy configurations must keep working, even if they don't include the new header file mbedtls/config_psa.h. Code that uses or implements PSA crypto interfaces needs some of the symbols defined by the new header file. Therefore, include the new header file via PSA crypto headers, which are included everywhere mbedtls/config_psa.h is needed. Include it early, in psa/crypto_platform.h, just after including mbedtls/config.h, so that its symbols are available wherever the symbols from mbedtls/config.h is available. This fixes the unit tests with configs/config-psa-crypto.h: some unit tests were failing, revealing that library features controlled with the new symbols were no longer getting built. Signed-off-by: Gilles Peskine --- include/psa/crypto_platform.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/psa/crypto_platform.h b/include/psa/crypto_platform.h index c64f61d58c..4582a865f8 100644 --- a/include/psa/crypto_platform.h +++ b/include/psa/crypto_platform.h @@ -41,6 +41,10 @@ #include MBEDTLS_CONFIG_FILE #endif +/* Translate between classic MBEDTLS_xxx feature symbols and PSA_xxx + * feature symbols. */ +#include "mbedtls/config_psa.h" + /* PSA requires several types which C99 provides in stdint.h. */ #include