• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2022 Huawei Technologies Co., Ltd.
2# Licensed under the Mulan PSL v2.
3# You can use this software according to the terms and conditions of the Mulan PSL v2.
4# You may obtain a copy of Mulan PSL v2 at:
5#     http://license.coscl.org.cn/MulanPSL2
6# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
7# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
8# PURPOSE.
9# See the Mulan PSL v2 for more details.
10
11# Targets
12MODULE := libelf_verify${TARG}.a
13
14SOURCE_DIR := $(SYSLIB)/libelf_verify
15
16# Source files required to build the target
17CFILES := $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_load_ext_mf.c))
18CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify.c))
19CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_load_key_ops.c))
20
21ifeq ($(CONFIG_ELF_DECRYPT_ENABLE),y)
22CFLAGS += -DELF_DECRYPT_ENABLE
23CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_load_dec_key_ops.c))
24ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), mbedtls)
25CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify_mbedtls.c))
26else
27CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify_openssl.c))
28endif
29else
30CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_elf_verify_stub.c))
31endif
32
33ifneq ($(findstring y, $(CONFIG_APP_TEE_PERM) $(CONFIG_APP_TEE_PERM_A32)),)
34CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_perm_img.c))
35else
36CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_perm_img_stub.c))
37endif
38
39ifeq ($(CONFIG_DYN_TA_FORMAT),1)
40CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_comm_elf_verify.c))
41CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_v3_elf_verify.c))
42else ifeq ($(CONFIG_DYN_TA_FORMAT),2)
43CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_comm_elf_verify.c))
44CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_v3_elf_verify.c))
45else ifeq ($(CONFIG_DYN_TA_FORMAT),3)
46CFILES += $(patsubst $(SOURCE_DIR)/%,%,$(wildcard $(SOURCE_DIR)/src/tee_v3_elf_verify.c))
47endif
48
49LDFLAGS += -z noexecstack
50
51CPPFLAGS += -I$(SYSLIB)/libelf_verify/include
52CPPFLAGS += -I$(TEELIB)/libteeos/include/legacy
53CPPFLAGS += -I$(TEELIB)/libteeos/include
54CPPFLAGS += -I$(TEELIB)/libpermission_service/src
55CPPFLAGS += -I$(SERVICES_PATH)/permission_service/src
56CPPFLAGS += -I$(TEELIB)/libteeos/include/tee # ta_framework.h
57CPPFLAGS += -I$(TEELIB)/libcrypto/include
58CPPFLAGS += -I$(TEELIB)/libswcrypto_engine/include
59CPPFLAGS += -I$(TEELIB)/libcrypto_hal/include
60CPPFLAGS += -I$(SYSLIB)/libelf_verify_key/include/
61CPPFLAGS += -I$(SYSLIB)/libelf_verify_key/src/
62CPPFLAGS += -I$(TEELIB)/libteemem/include
63CPPFLAGS += -I$(SYSLIB)/libdynconfmgr/include
64CPPFLAGS += -I$(SYSLIB)/libdynconfbuilder/include
65CPPFLAGS += -I$(FRAMEWORK_PATH)/drvmgr/src
66CPPFLAGS += -I$(DRIVERS_PATH)/include
67CPPFLAGS += -I$(TEELIB)/libtimer/include/
68CPPFLAGS += -I$(SYSLIB)/libspawn_common/include/
69CPPFLAGS += -I$(TEELIB)/libdrv/include
70
71ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),)
72CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/include
73CPPFLAGS += -I$(TEELIB)/libopenssl/openssl/crypto
74endif
75
76# Source files required to build the target
77CPPFLAGS += -I$(SOURCE_DIR)/include/
78CPPFLAGS += -I$(TEELIB)/libteeagentcommon_client/include
79
80ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE), openssl3)
81CFLAGS += -DOPENSSL3_ENABLE
82else
83CFLAGS += -DOPENSSL_ENABLE
84endif
85
86ifeq ($(CONFIG_DYN_TA_FORMAT),1)
87CFLAGS += -DDYN_TA_SUPPORT_V3
88else ifeq ($(CONFIG_DYN_TA_FORMAT),2)
89CFLAGS += -DDYN_TA_SUPPORT_V3
90else ifeq ($(CONFIG_DYN_TA_FORMAT),3)
91CFLAGS += -DDYN_TA_SUPPORT_V3
92else
93$(error "dynamic TA format not supported, please check CONFIG_DYN_TA_FORMAT")
94endif
95
96include $(BUILD_LIB)/lib-common.mk
97include $(BUILD_CONFIG)/feature-macro.mk
98