From 7132dd97965299b319f32bc043f6c7385057bb77 Mon Sep 17 00:00:00 2001 From: itayzafrir Date: Tue, 29 Jan 2019 14:23:52 +0200 Subject: [PATCH] Prepare support for 64 bit key ids in a PSA system. Preparation for type separation between SPE and NSPE. --- library/psa_crypto_storage.c | 14 ++++++++++++++ library/psa_crypto_storage_its.c | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/library/psa_crypto_storage.c b/library/psa_crypto_storage.c index b4e4076e1a..296ed34aeb 100644 --- a/library/psa_crypto_storage.c +++ b/library/psa_crypto_storage.c @@ -29,6 +29,20 @@ #include #include +/* + * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM + * (Secure Partition Manager) integration which separates the code into two + * parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing + * Environment). When building for the SPE, an additional header file should be + * included. + */ +#if defined(MBEDTLS_PSA_CRYPTO_SPM) +/* + * PSA_CRYPTO_SECURE means that this file is compiled for the SPE. + * Some headers will be affected by this flag. + */ +#define PSA_CRYPTO_SECURE 1 +#endif #include "psa/crypto.h" #include "psa_crypto_storage.h" diff --git a/library/psa_crypto_storage_its.c b/library/psa_crypto_storage_its.c index bb0d0cdf19..4f6701626e 100644 --- a/library/psa_crypto_storage_its.c +++ b/library/psa_crypto_storage_its.c @@ -26,6 +26,20 @@ #endif #if defined(MBEDTLS_PSA_CRYPTO_STORAGE_ITS_C) +/* + * When MBEDTLS_PSA_CRYPTO_SPM is defined, the code is being built for SPM + * (Secure Partition Manager) integration which separates the code into two + * parts: NSPE (Non-Secure Processing Environment) and SPE (Secure Processing + * Environment). When building for the SPE, an additional header file should be + * included. + */ +#if defined(MBEDTLS_PSA_CRYPTO_SPM) +/* + * PSA_CRYPTO_SECURE means that this file is compiled for the SPE. + * Some headers will be affected by this flag. + */ +#define PSA_CRYPTO_SECURE 1 +#endif #include "psa/error.h" #include "psa/crypto.h"