Skip to content

Commit 7ba359a

Browse files
mohammad1603Patater
authored andcommitted
Update mbedtls importer to import mbed-crypto
1 parent 7995e8b commit 7ba359a

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

features/mbedtls/importer/Makefile

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,35 @@ MBED_TLS_RELEASE ?= mbedtls-2.13.1
3131

3232
# Translate between mbed TLS namespace and mbed namespace
3333
TARGET_PREFIX:=../
34+
TARGET_PREFIX_CRYPTO:=../mbed-crypto/
3435
TARGET_SRC:=$(TARGET_PREFIX)src
3536
TARGET_INC:=$(TARGET_PREFIX)inc
3637
TARGET_TESTS:=$(TARGET_PREFIX)TESTS
3738

39+
# New folder structure is introduced here for targets with Secured-Partition-Environment
40+
# and Non-Secured-Partition-Environment, below documentation for each folder:
41+
# COMPONENT_PSA_SRV_IMPL - include secure service business logic implementation
42+
# code. For example Mbed Crypto or secure time core logic
43+
TARGET_SRV_IMPL:=$(TARGET_PREFIX_CRYPTO)/platform/TARGET_PSA/COMPONENT_PSA_SRV_IMPL
44+
# COMPONENT_SPE - include code that compiles ONLY to secure image and never
45+
# compiles to non-secure image
46+
TARGET_SPE:=$(TARGET_PREFIX_CRYPTO)/platform/TARGET_PSA/COMPONENT_SPE
47+
# The folder contain specific target implementation using hardware.
48+
TARGET_PSA_DRIVERS:=$(TARGET_PREFIX_CRYPTO)/targets
49+
# COMPONENT_NSPE - include code that compiles ONLY to non-secure image and
50+
# never compiles to secure image
51+
TARGET_NSPE:=$(TARGET_SRV_IMPL)/COMPONENT_NSPE
52+
3853
# mbed TLS source directory - hidden from mbed via TARGET_IGNORE
3954
MBED_TLS_URL:[email protected]:ARMmbed/mbedtls-restricted.git
4055
MBED_TLS_DIR:=TARGET_IGNORE/mbedtls
4156
MBED_TLS_API:=$(MBED_TLS_DIR)/include/mbedtls
4257
MBED_TLS_GIT_CFG=$(MBED_TLS_DIR)/.git/config
4358

59+
# Mbed Crypto directory - hidden from mbed via TARGET_IGNORE
60+
MBED_CRYPTO_DIR:=$(MBED_TLS_DIR)/crypto
61+
MBED_CRYPTO_API:=$(MBED_CRYPTO_DIR)/include/psa
62+
4463
.PHONY: all deploy deploy-tests rsync mbedtls clean update
4564

4665
all: mbedtls
@@ -62,6 +81,23 @@ rsync:
6281
cp $(MBED_TLS_DIR)/LICENSE $(TARGET_PREFIX)
6382
cp $(MBED_TLS_DIR)/apache-2.0.txt $(TARGET_PREFIX)
6483
#
84+
# Create Mbed Crypto target folder
85+
mkdir -p $(TARGET_PREFIX_CRYPTO)
86+
#
87+
# Copying Mbed Crypto into Mbed OS..
88+
rm -rf $(TARGET_SRV_IMPL)
89+
rm -rf $(TARGET_SPE)
90+
91+
mkdir -p $(TARGET_SRV_IMPL)
92+
mkdir -p $(TARGET_SPE)
93+
mkdir -p $(TARGET_NSPE)
94+
mkdir -p $(TARGET_PSA_DRIVERS)
95+
96+
rsync -a --delete --exclude='crypto_struct.h' $(MBED_CRYPTO_API) $(TARGET_INC)
97+
rsync -a --delete $(MBED_CRYPTO_API)/crypto_struct.h $(TARGET_NSPE)
98+
rsync -a --delete $(MBED_CRYPTO_API)/crypto_struct.h $(TARGET_SPE)/crypto_struct_spe.h
99+
rsync -a --delete $(MBED_CRYPTO_DIR)/library/psa_*.c $(TARGET_SRV_IMPL)
100+
rsync -a --delete $(MBED_CRYPTO_DIR)/library/psa_*.h $(TARGET_SRV_IMPL)
65101

66102
deploy: rsync
67103
#
@@ -92,6 +128,9 @@ update: $(MBED_TLS_GIT_CFG) $(MBED_TLS_HA_GIT_CFG)
92128
# Checking out the required release
93129
git -C $(MBED_TLS_DIR) checkout $(MBED_TLS_RELEASE)
94130
#
131+
# Update and checkout git submodules
132+
git -C $(MBED_TLS_DIR) submodule update --init --recursive
133+
#
95134
# Updating checked out version tag
96135
echo $(MBED_TLS_RELEASE) > $(TARGET_PREFIX)VERSION.txt
97136

@@ -107,4 +146,5 @@ clean:
107146
rm -rf $(TARGET_SRC)
108147
rm -rf $(TARGET_INC)
109148
rm -rf $(MBED_TLS_DIR)
110-
149+
rm -rf $(TARGET_SRV_IMPL)
150+
rm -rf $(TARGET_SPE)

0 commit comments

Comments
 (0)