Skip to content

Commit d33da83

Browse files
davidvinczeAnton-TF
authored andcommitted
Crypto: Replace MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
Use the MBEDTLS_ALLOW_PRIVATE_ACCESS macro to allow access to private identifiers in TF-PSA-Crypto instead of MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS. The latter is set automatically as a consequence of the former. Define the macro with a file scope where possible to avoid redefinition warnings. Change-Id: I45312bcb11633c796266e272daf507a518e7aeba Signed-off-by: David Vincze <david.vincze@arm.com>
1 parent 2f733ef commit d33da83

5 files changed

Lines changed: 13 additions & 10 deletions

File tree

lib/ext/cryptocell-312-runtime/codesafe/src/crypto_api/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ target_compile_definitions(${CC312_LIB_TARGET}
114114
PRIVATE
115115
# The driver needs to access private identifiers from TF-PSA-Crypto,
116116
# which were previously exposed in Mbed TLS.
117-
MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
117+
MBEDTLS_ALLOW_PRIVATE_ACCESS
118118
)
119119

120120
########################## CDMPU ###############################################

platform/ext/target/arm/corstone1000/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,6 @@ target_compile_definitions(platform_bl1_1
219219
# can be used if the BL1 target needs different implementation than
220220
# the TFM_S target.
221221
BL1_BUILD
222-
PRIVATE
223-
# c312_rom_crypto.c refers to private identifiers from drivers/builtin/src/sha512.c
224-
# Fixme: BL1 crypto layer will need to be be re-implemented using the PSA Crypto API only.
225-
# For now, we need to expose the private identifiers to BL1 code to avoid build errors.
226-
MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
227222
)
228223

229224
target_include_directories(platform_bl1_1_interface

platform/ext/target/arm/corstone1000/bl1/cc312_rom_crypto.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
*
66
*/
77

8+
/* BL1 crypto layer still calls mbedtls functions directly which are now
9+
* considered a private interface of TF-PSA-Crypto. For now, we need to expose
10+
* these private identifiers to avoid build errors.
11+
*/
12+
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
13+
814
#include "bl1_crypto.h"
915

1016
#include <stdint.h>

platform/ext/target/arm/mps4/common/bl1/crypto_mbedcrypto.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
*
66
*/
77

8+
/* BL1 crypto layer still calls mbedtls functions directly which are now
9+
* considered a private interface of TF-PSA-Crypto. For now, we need to expose
10+
* these private identifiers to avoid build errors.
11+
*/
12+
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
13+
814
#include "bl1_crypto.h"
915

1016
#include <string.h>

platform/ext/target/arm/mps4/common/common.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,10 +362,6 @@ target_sources(bl1_1_psa_crypto
362362
$<$<BOOL:${TFM_BL1_SOFTWARE_CRYPTO}>:${TF_PSA_CRYPTO_PATH}/drivers/builtin/src/psa_crypto_cipher.c>
363363
)
364364

365-
# Fixme: BL1 crypto layer will need to be be re-implemented using PSA Crypto API only.
366-
# For now, we need to expose the private identifiers to MPS4 BL1 code to avoid build errors.
367-
target_compile_definitions(bl1_1_psa_crypto PRIVATE MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
368-
369365
#========================= Platform BL1_2 =====================================#
370366

371367
target_add_scatter_file(bl1_2

0 commit comments

Comments
 (0)