| # Normally this makefile shouldn't be called directly and we expect the output |
| # path to be on a certain location to fit together with the other OP-TEE |
| # gits and helper scripts. |
| |
| include ../../scripts/common.mk |
| out-dir := $(call strip-trailing-slashes-and-dots,$(O)) |
| ifeq ($(out-dir),) |
| $(error invalid output directory (O=$(O))) |
| endif |
| |
| include $(TA_DEV_KIT_DIR)/host_include/conf.mk |
| |
| # By default we expect optee_client exported folder to be on a certain relative |
| # path, but if the client specifies the OPTEE_CLIENT_EXPORT then that path will |
| # be used instead. |
| OPTEE_CLIENT_EXPORT ?= ../../../optee_client/out/export |
| |
| CC ?= $(CROSS_COMPILE)gcc |
| CPP ?= $(CROSS_COMPILE)cpp |
| LD ?= $(CROSS_COMPILE)ld |
| AR ?= $(CROSS_COMPILE)ar |
| NM ?= $(CROSS_COMPILE)nm |
| OBJCOPY ?= $(CROSS_COMPILE)objcopy |
| OBJDUMP ?= $(CROSS_COMPILE)objdump |
| READELF ?= $(CROSS_COMPILE)readelf |
| |
| srcs := regression_1000.c |
| |
| ifeq ($(CFG_GP_SOCKETS),y) |
| srcs += regression_2000.c \ |
| sock_server.c \ |
| rand_stream.c |
| endif |
| |
| srcs += adbg/src/adbg_case.c \ |
| adbg/src/adbg_enum.c \ |
| adbg/src/adbg_expect.c \ |
| adbg/src/adbg_log.c \ |
| adbg/src/adbg_run.c \ |
| adbg/src/security_utils_hex.c \ |
| aes_perf.c \ |
| benchmark_1000.c \ |
| benchmark_2000.c \ |
| regression_4000.c \ |
| regression_5000.c \ |
| regression_6000.c \ |
| regression_7000.c \ |
| regression_8000.c \ |
| sha_perf.c \ |
| xtest_helpers.c \ |
| xtest_main.c \ |
| xtest_test.c |
| |
| ifeq ($(CFG_SECSTOR_TA_MGMT_PTA),y) |
| srcs += install_ta.c |
| endif |
| |
| ifeq ($(CFG_SECURE_DATA_PATH),y) |
| srcs += sdp_basic.c |
| endif |
| |
| ifdef CFG_GP_PACKAGE_PATH |
| CFLAGS += -DWITH_GP_TESTS |
| |
| srcs += gp_7000.c \ |
| gp_7500.c \ |
| gp_8000.c \ |
| gp_8500.c \ |
| gp_9000.c |
| endif |
| |
| objs := $(patsubst %.c,$(out-dir)/xtest/%.o, $(srcs)) |
| |
| CFLAGS += -I./ |
| CFLAGS += -I./adbg/include |
| CFLAGS += -I./xml/include |
| ifeq ($(CFG_GCM_NIST_VECTORS),y) |
| CFLAGS += -I$(out-dir)/xtest |
| endif |
| |
| CFLAGS += -I$(OPTEE_CLIENT_EXPORT)/include |
| CFLAGS += -I$(TA_DEV_KIT_DIR)/host_include |
| |
| CFLAGS += -I../../ta/create_fail_test/include |
| CFLAGS += -I../../ta/crypt/include |
| CFLAGS += -I../../ta/enc_fs/include |
| CFLAGS += -I../../ta/os_test/include |
| CFLAGS += -I../../ta/rpc_test/include |
| CFLAGS += -I../../ta/sims/include |
| CFLAGS += -I../../ta/storage/include |
| CFLAGS += -I../../ta/storage_benchmark/include |
| CFLAGS += -I../../ta/concurrent/include |
| CFLAGS += -I../../ta/concurrent_large/include |
| CFLAGS += -I../../ta/sha_perf/include |
| CFLAGS += -I../../ta/aes_perf/include |
| CFLAGS += -I../../ta/socket/include |
| CFLAGS += -I../../ta/sdp_basic/include |
| |
| ifdef CFG_GP_PACKAGE_PATH |
| CFLAGS += -I../../ta/GP_TTA_Arithmetical |
| CFLAGS += -I../../ta/GP_TTA_Crypto |
| CFLAGS += -I../../ta/GP_TTA_DS |
| CFLAGS += -I../../ta/GP_TTA_TCF |
| CFLAGS += -I../../ta/GP_TTA_TCF_ICA |
| CFLAGS += -I../../ta/GP_TTA_TCF_ICA2 |
| CFLAGS += -I../../ta/GP_TTA_TCF_MultipleInstanceTA |
| CFLAGS += -I../../ta/GP_TTA_TCF_SingleInstanceTA |
| CFLAGS += -I../../ta/GP_TTA_Time |
| CFLAGS += -I../../ta/GP_TTA_answerErrorTo_Invoke |
| CFLAGS += -I../../ta/GP_TTA_answerErrorTo_OpenSession |
| CFLAGS += -I../../ta/GP_TTA_answerSuccessTo_OpenSession_Invoke |
| CFLAGS += -I../../ta/GP_TTA_check_OpenSession_with_4_parameters |
| CFLAGS += -I../../ta/GP_TTA_testingClientAPI |
| |
| # need more include: openssl |
| CFLAGS += -Ifor_gp/include |
| |
| # by default, the client application is compiled as the kernel of optee-os |
| ifeq ($(CFG_ARM32_core),y) |
| COMPILE_NS_USER ?= 32 |
| else |
| COMPILE_NS_USER ?= 64 |
| endif |
| |
| ifeq ($(COMPILE_NS_USER),32) |
| LDFLAGS += ../lib/armv7/libcrypto.a |
| else |
| LDFLAGS += ../lib/armv8/libcrypto.a |
| endif |
| |
| endif |
| |
| TA_DIR ?= /lib/optee_armtz |
| CFLAGS += -DTA_DIR=\"$(TA_DIR)\" |
| |
| # Include configuration file generated by OP-TEE OS (CFG_* macros) |
| CFLAGS += -include conf.h |
| |
| ifndef CFG_GP_PACKAGE_PATH |
| CFLAGS += -Wall -Wcast-align -Werror \ |
| -Werror-implicit-function-declaration -Wextra -Wfloat-equal \ |
| -Wformat-nonliteral -Wformat-security -Wformat=2 -Winit-self \ |
| -Wmissing-declarations -Wmissing-format-attribute \ |
| -Wmissing-include-dirs -Wmissing-noreturn \ |
| -Wmissing-prototypes -Wnested-externs -Wpointer-arith \ |
| -Wshadow -Wstrict-prototypes -Wswitch-default \ |
| -Wwrite-strings \ |
| -Wno-missing-field-initializers -Wno-format-zero-length |
| endif |
| |
| CFLAGS += -g3 |
| |
| LDFLAGS += -L$(OPTEE_CLIENT_EXPORT)/lib -lteec |
| LDFLAGS += -lpthread -lm |
| |
| .PHONY: all |
| all: xtest |
| |
| xtest: $(objs) |
| @echo " LD $(out-dir)/xtest/$@" |
| $(q)$(CC) -o $(out-dir)/xtest/$@ $+ $(LDFLAGS) |
| |
| $(out-dir)/xtest/%.o: $(CURDIR)/%.c |
| $(q)mkdir -p $(out-dir)/xtest/adbg/src |
| @echo ' CC $<' |
| $(q)$(CC) $(CFLAGS) -c $< -o $@ |
| |
| RMDIR := rmdir --ignore-fail-on-non-empty |
| define rm-build-dirs |
| $(q)for d in $1; do $(RMDIR) $(out-dir)/xtest/$$d 2> /dev/null; true; done |
| $(q)$(RMDIR) $(out-dir)/xtest 2> /dev/null; true |
| $(q)$(RMDIR) $(out-dir) 2> /dev/null; true |
| endef |
| |
| ifeq ($(CFG_GCM_NIST_VECTORS),y) |
| GCM_NIST_VECTORS_DECRYPT = gcmDecrypt128 gcmDecrypt192 gcmDecrypt256 |
| GCM_NIST_VECTORS_ENCRYPT = gcmEncryptExtIV128 gcmEncryptExtIV192 \ |
| gcmEncryptExtIV256 |
| |
| cleanfiles += $(out-dir)/gcmtestvectors.zip |
| $(out-dir)/gcmtestvectors.zip: |
| @echo ' DL $@' |
| $(q)curl https://csrc.nist.gov/csrc/media/projects/cryptographic-algorithm-validation-program/documents/mac/gcmtestvectors.zip -o $@ |
| |
| define create-nist-gcm-vectors |
| cleanfiles += $(out-dir)/xtest/$(1).h $(out-dir)/$(1).rsp |
| |
| $(out-dir)/$(1).rsp: $(out-dir)/gcmtestvectors.zip |
| @echo ' UNZIP $$@' |
| $(q)unzip -o $$< $$(notdir $$@) -d $$(dir $$@) |
| $(q)touch $$@ |
| |
| |
| $(out-dir)/xtest/$(1).h: $(out-dir)/$(1).rsp |
| @echo ' GEN $$@' |
| $(q)../../scripts/rsp_to_gcm_test.py --inf $$< --outf $$@ --mode=$(2) \ |
| $(if $(filter y,$(CFG_GCM_NIST_VECTORS_LIMITED)),--limited) |
| |
| $(CURDIR)/regression_4000.c: $(out-dir)/xtest/$(1).h |
| endef |
| |
| $(foreach v, $(GCM_NIST_VECTORS_DECRYPT), $(eval $(call \ |
| create-nist-gcm-vectors,$v,decrypt))) |
| $(foreach v, $(GCM_NIST_VECTORS_ENCRYPT), $(eval $(call \ |
| create-nist-gcm-vectors,$v,encrypt))) |
| endif |
| |
| |
| .PHONY: clean |
| clean: |
| @echo ' CLEAN $(out-dir)' |
| $(q)rm -f $(out-dir)/xtest/xtest |
| $(q)$(foreach obj,$(objs), rm -f $(obj)) |
| $(q)rm -f $(cleanfiles) |
| $(call rm-build-dirs,adbg/src adbg) |