diff --git a/features/mbedtls/importer/Makefile b/features/mbedtls/importer/Makefile index a8d55cf91a..d239397190 100644 --- a/features/mbedtls/importer/Makefile +++ b/features/mbedtls/importer/Makefile @@ -31,16 +31,35 @@ MBED_TLS_RELEASE ?= mbedtls-2.13.1 # Translate between mbed TLS namespace and mbed namespace TARGET_PREFIX:=../ +TARGET_PREFIX_CRYPTO:=../mbed-crypto/ TARGET_SRC:=$(TARGET_PREFIX)src TARGET_INC:=$(TARGET_PREFIX)inc TARGET_TESTS:=$(TARGET_PREFIX)TESTS +# New folder structure is introduced here for targets with Secured-Partition-Environment +# and Non-Secured-Partition-Environment, below documentation for each folder: +# COMPONENT_PSA_SRV_IMPL - include secure service business logic implementation +# code. For example Mbed Crypto or secure time core logic +TARGET_SRV_IMPL:=$(TARGET_PREFIX_CRYPTO)/platform/TARGET_PSA/COMPONENT_PSA_SRV_IMPL +# COMPONENT_SPE - include code that compiles ONLY to secure image and never +# compiles to non-secure image +TARGET_SPE:=$(TARGET_PREFIX_CRYPTO)/platform/TARGET_PSA/COMPONENT_SPE +# The folder contain specific target implementation using hardware. +TARGET_PSA_DRIVERS:=$(TARGET_PREFIX_CRYPTO)/targets +# COMPONENT_NSPE - include code that compiles ONLY to non-secure image and +# never compiles to secure image +TARGET_NSPE:=$(TARGET_SRV_IMPL)/COMPONENT_NSPE + # mbed TLS source directory - hidden from mbed via TARGET_IGNORE MBED_TLS_URL:=git@github.com:ARMmbed/mbedtls-restricted.git MBED_TLS_DIR:=TARGET_IGNORE/mbedtls MBED_TLS_API:=$(MBED_TLS_DIR)/include/mbedtls MBED_TLS_GIT_CFG=$(MBED_TLS_DIR)/.git/config +# Mbed Crypto directory - hidden from mbed via TARGET_IGNORE +MBED_CRYPTO_DIR:=$(MBED_TLS_DIR)/crypto +MBED_CRYPTO_API:=$(MBED_CRYPTO_DIR)/include/psa + .PHONY: all deploy deploy-tests rsync mbedtls clean update all: mbedtls @@ -62,6 +81,23 @@ rsync: cp $(MBED_TLS_DIR)/LICENSE $(TARGET_PREFIX) cp $(MBED_TLS_DIR)/apache-2.0.txt $(TARGET_PREFIX) # + # Create Mbed Crypto target folder + mkdir -p $(TARGET_PREFIX_CRYPTO) + # + # Copying Mbed Crypto into Mbed OS.. + rm -rf $(TARGET_SRV_IMPL) + rm -rf $(TARGET_SPE) + + mkdir -p $(TARGET_SRV_IMPL) + mkdir -p $(TARGET_SPE) + mkdir -p $(TARGET_NSPE) + mkdir -p $(TARGET_PSA_DRIVERS) + + rsync -a --delete --exclude='crypto_struct.h' $(MBED_CRYPTO_API) $(TARGET_INC) + rsync -a --delete $(MBED_CRYPTO_API)/crypto_struct.h $(TARGET_NSPE) + rsync -a --delete $(MBED_CRYPTO_API)/crypto_struct.h $(TARGET_SPE)/crypto_struct_spe.h + rsync -a --delete $(MBED_CRYPTO_DIR)/library/psa_*.c $(TARGET_SRV_IMPL) + rsync -a --delete $(MBED_CRYPTO_DIR)/library/psa_*.h $(TARGET_SRV_IMPL) deploy: rsync # @@ -92,6 +128,9 @@ update: $(MBED_TLS_GIT_CFG) $(MBED_TLS_HA_GIT_CFG) # Checking out the required release git -C $(MBED_TLS_DIR) checkout $(MBED_TLS_RELEASE) # + # Update and checkout git submodules + git -C $(MBED_TLS_DIR) submodule update --init --recursive + # # Updating checked out version tag echo $(MBED_TLS_RELEASE) > $(TARGET_PREFIX)VERSION.txt @@ -107,4 +146,5 @@ clean: rm -rf $(TARGET_SRC) rm -rf $(TARGET_INC) rm -rf $(MBED_TLS_DIR) - + rm -rf $(TARGET_SRV_IMPL) + rm -rf $(TARGET_SPE)