Update how MBEDTLS_PSA_CRYPTO_CONFIG is handled

Originally, MBEDTLS_PSA_CRYPTO_CONFIG was being used to allow
inclusion of mbedlts/config_psa.h, but that needed to be updated
so that mbedtls/config_psa.h is always included and the definitions
specific to PSA configuration are now guarded by
MBEDTLS_PSA_CRYPTO_CONFIG. This will allow for the standard setup
to continue working while new PSA configuration items to also work.

Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
This commit is contained in:
John Durkop 2020-09-24 04:30:10 -07:00
parent d8959390c5
commit 2dfaf9ca23
3 changed files with 20 additions and 13 deletions

View file

@ -3824,10 +3824,7 @@
* \name SECTION: PSA Crypto settings
*
*/
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
#include "mbedtls/config_psa.h"
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
#include "mbedtls/check_config.h"

View file

@ -32,22 +32,25 @@
extern "C" {
#endif
//#define PSA_WANT_ALG_ECDSA
//#define MBEDTLS_PSA_ACCEL_ALG_ECDSA
//#define PSA_WANT_ALG_ECDSA_DETERMINISTIC
//#define MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC
#if defined(MBEDTLS_PSA_CRYPTO_CONFIG)
#if defined(PSA_WANT_ALG_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
#if defined(PSA_WANT_ALG_ECDSA)
#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)
#define MBEDTLS_PSA_BUILTIN_ALG_ECDSA
#else /* defined(PSA_WANT_ALG_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)*/
#else /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) */
#define MBEDTLS_ECDSA_C
#endif /* defined(PSA_WANT_ALG_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA)*/
#endif /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA) */
#endif /* defined(PSA_WANT_ALG_ECDSA) */
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC)
#if defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA)
#if !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC)
#define MBEDTLS_PSA_BUILTIN_ALG_DETERMINISTIC_ECDSA
#else /* defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */
#else /* && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */
#define MBEDTLS_ECDSA_DETERMINISTIC
#endif /* defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) && !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */
#endif /* !defined(MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC) */
#endif /* defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) */
#endif /* MBEDTLS_PSA_CRYPTO_CONFIG */
#ifdef __cplusplus
}

View file

@ -30,6 +30,13 @@
extern "C" {
#endif
#define PSA_WANT_ALG_ECDSA
#define PSA_WANT_ALG_ECDSA_DETERMINISTIC
//#define MBEDTLS_PSA_ACCEL_ALG_ECDSA
//#define MBEDTLS_PSA_ACCEL_ALG_ECDSA_DETERMINISTIC
#ifdef __cplusplus
}
#endif