Skip to content

Commit cafe743

Browse files
committed
Adjust Mbed TLS importer and config script
Mbed Crypto has been remerged back into Mbed TLS. Update the Mbed TLS importer script with the relevant parts of the Mbed Crypto importer.
1 parent ac21ee9 commit cafe743

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

features/mbedtls/importer/Makefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#
2828

2929
# Set the mbed TLS release to import (this can/should be edited before import)
30-
MBED_TLS_RELEASE ?= mbedtls-2.20.0d1
30+
MBED_TLS_RELEASE ?= mbedtls-2.22.0
3131
MBED_TLS_REPO_URL ?= git@github.com:ARMmbed/mbedtls.git
3232

3333
# Translate between mbed TLS namespace and mbed namespace
@@ -36,9 +36,23 @@ TARGET_SRC:=$(TARGET_PREFIX)src
3636
TARGET_INC:=$(TARGET_PREFIX)inc
3737
TARGET_TESTS:=$(TARGET_PREFIX)TESTS
3838

39+
# A folder structure is introduced here for targets that have both a Secure
40+
# Processing Environment (SPE) targets and Non-secure Processing Environment
41+
# (NSPE). Documentation for each folder as follows:
42+
# COMPONENT_PSA_SRV_IMPL - Include secure service implementation code. For
43+
# example PSA Crypto or PSA Secure Time implementations
44+
TARGET_SRV_IMPL:=$(TARGET_PREFIX)/platform/COMPONENT_PSA_SRV_IMPL
45+
# COMPONENT_SPE - Include code that compiles ONLY to the SPE image and never
46+
# compiles to the NSPE image
47+
TARGET_SPE:=$(TARGET_PREFIX)/platform/COMPONENT_SPE
48+
# COMPONENT_NSPE - Include code that compiles ONLY to the NSPE image and never
49+
# compiles to the SPE image
50+
TARGET_NSPE:=$(TARGET_SRV_IMPL)/COMPONENT_NSPE
51+
3952
# mbed TLS source directory - hidden from mbed via TARGET_IGNORE
4053
MBED_TLS_DIR:=TARGET_IGNORE/mbedtls
4154
MBED_TLS_API:=$(MBED_TLS_DIR)/include/mbedtls
55+
CRYPTO_API:=$(MBED_TLS_DIR)/include/psa
4256
MBED_TLS_GIT_CFG=$(MBED_TLS_DIR)/.git/config
4357

4458
.PHONY: all deploy deploy-tests rsync mbedtls clean update
@@ -57,10 +71,27 @@ rsync:
5771
rm -rf $(TARGET_INC)
5872
mkdir -p $(TARGET_INC)
5973
rsync -a --delete $(MBED_TLS_API) $(TARGET_INC)
74+
rsync -a --delete --exclude='crypto_struct.h' $(CRYPTO_API) $(TARGET_INC)/
6075
#
6176
# Copying licenses
6277
cp $(MBED_TLS_DIR)/LICENSE $(TARGET_PREFIX)
6378
#
79+
# Copying Mbed Crypto into Mbed OS...
80+
rm -rf $(TARGET_SRV_IMPL)
81+
rm -rf $(TARGET_SPE)
82+
83+
mkdir -p $(TARGET_SRV_IMPL)
84+
mkdir -p $(TARGET_SPE)
85+
mkdir -p $(TARGET_NSPE)
86+
87+
rsync -a --delete $(CRYPTO_API)/crypto_struct.h $(TARGET_NSPE)/
88+
rsync -a --delete $(CRYPTO_API)/crypto_struct.h $(TARGET_SPE)/crypto_struct_spe.h
89+
rsync -a --delete $(MBED_TLS_DIR)/library/psa_*.c $(TARGET_SRV_IMPL)/
90+
rsync -a --delete $(MBED_TLS_DIR)/library/psa_*.h $(TARGET_SRV_IMPL)/
91+
#
92+
# Remove PSA-specific C & H files (they go into $(TARGET_SRV_IMPL))
93+
rm -rf $(TARGET_SRC)/psa_*.c
94+
rm -rf $(TARGET_SRC)/psa_*.h
6495

6596
deploy: rsync
6697
#
@@ -110,3 +141,5 @@ clean:
110141
rm -rf $(TARGET_SRC)
111142
rm -rf $(TARGET_INC)
112143
rm -rf $(MBED_TLS_DIR)
144+
rm -rf $(TARGET_SRV_IMPL)
145+
rm -rf $(TARGET_SPE)

features/mbedtls/importer/adjust-config.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ conf unset MBEDTLS_TIMING_C
7979
# not supported on all targets with mbed OS, nor used by mbed Client
8080
conf unset MBEDTLS_HAVE_TIME_DATE
8181
conf unset MBEDTLS_FS_IO
82+
conf unset MBEDTLS_PSA_ITS_FILE_C
83+
conf unset MBEDTLS_PSA_CRYPTO_STORAGE_C
8284
conf set MBEDTLS_NO_PLATFORM_ENTROPY
8385

8486
conf unset MBEDTLS_CIPHER_MODE_CFB

0 commit comments

Comments
 (0)