1From b543f78b0d9a103bcfec0ec1f8f3e1cb77b87f05 Mon Sep 17 00:00:00 2001
2From: Antonio de Angelis <Antonio.deAngelis@arm.com>
3Date: Tue, 9 Apr 2024 15:26:59 +0100
4Subject: [PATCH 7/7] Enable sources when MCUBOOT_USE_PSA_CRYPTO and not
5 MBEDTLS_PSA_CRYPTO_C
6
7Gate relevant files for the thin PSA crypto core on MCUBOOT_USE_PSA_CRYPTO
8during BL2 build instead of MBEDTLS_PSA_CRYPTO_C which is not defined in
9such case. A full solution might require a change in config strategy of
10Mbed TLS with the definition
11
12Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
13---
14 include/mbedtls/psa_util.h           | 2 +-
15 library/psa_crypto_driver_wrappers.h | 2 +-
16 library/psa_crypto_ecp.c             | 2 +-
17 library/psa_crypto_hash.c            | 2 +-
18 library/psa_crypto_rsa.c             | 2 +-
19 5 files changed, 5 insertions(+), 5 deletions(-)
20
21diff --git a/include/mbedtls/psa_util.h b/include/mbedtls/psa_util.h
22index c78cc2333..7350eafcb 100644
23--- a/include/mbedtls/psa_util.h
24+++ b/include/mbedtls/psa_util.h
25@@ -21,7 +21,7 @@
26  * otherwise error codes would be unknown in test_suite_psa_crypto_util.data.*/
27 #include <mbedtls/asn1write.h>
28
29-#if defined(MBEDTLS_PSA_CRYPTO_CLIENT)
30+#if defined(MBEDTLS_PSA_CRYPTO_CLIENT) || defined(MCUBOOT_USE_PSA_CRYPTO)
31
32 /** The random generator function for the PSA subsystem.
33  *
34diff --git a/library/psa_crypto_driver_wrappers.h b/library/psa_crypto_driver_wrappers.h
35index 9ba856145..2d566f5f8 100644
36--- a/library/psa_crypto_driver_wrappers.h
37+++ b/library/psa_crypto_driver_wrappers.h
38@@ -23,7 +23,7 @@
39 #include "mbedtls/constant_time.h"
40 /* END-common headers */
41
42-#if defined(MBEDTLS_PSA_CRYPTO_C)
43+#if defined(MBEDTLS_PSA_CRYPTO_C) || defined(MCUBOOT_USE_PSA_CRYPTO)
44
45 /* BEGIN-driver headers */
46 /* Headers for mbedtls_test opaque driver */
47diff --git a/library/psa_crypto_ecp.c b/library/psa_crypto_ecp.c
48index 95baff6a0..317554bfb 100644
49--- a/library/psa_crypto_ecp.c
50+++ b/library/psa_crypto_ecp.c
51@@ -8,7 +8,7 @@
52
53 #include "common.h"
54
55-#if defined(MBEDTLS_PSA_CRYPTO_C)
56+#if defined(MBEDTLS_PSA_CRYPTO_C) || defined(MCUBOOT_USE_PSA_CRYPTO)
57
58 #include <psa/crypto.h>
59 #include "psa_crypto_core.h"
60diff --git a/library/psa_crypto_hash.c b/library/psa_crypto_hash.c
61index eeb7666c1..5c025b335 100644
62--- a/library/psa_crypto_hash.c
63+++ b/library/psa_crypto_hash.c
64@@ -8,7 +8,7 @@
65
66 #include "common.h"
67
68-#if defined(MBEDTLS_PSA_CRYPTO_C)
69+#if defined(MBEDTLS_PSA_CRYPTO_C) || defined(MCUBOOT_USE_PSA_CRYPTO)
70
71 #include <psa/crypto.h>
72 #include "psa_crypto_core.h"
73diff --git a/library/psa_crypto_rsa.c b/library/psa_crypto_rsa.c
74index 38dc3b8ed..20540d356 100644
75--- a/library/psa_crypto_rsa.c
76+++ b/library/psa_crypto_rsa.c
77@@ -8,7 +8,7 @@
78
79 #include "common.h"
80
81-#if defined(MBEDTLS_PSA_CRYPTO_C)
82+#if defined(MBEDTLS_PSA_CRYPTO_C) || defined(MCUBOOT_USE_PSA_CRYPTO)
83
84 #include <psa/crypto.h>
85 #include "psa/crypto_values.h"
86--
872.34.1
88
89