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 11MODULE := libswcrypto_engine${TARG}.a 12 13c-flags += -DARM_PAE=1 -D__ARM_ARCH_=7 -DTARGET_PRODUCT_VAL=\"$(TARGET_BOARD_PLATFORM)\" 14 15inc-flags += -I$(TEELIB)/libswcrypto_engine/include 16inc-flags += -I$(TEELIB)/libcrypto_hal/include 17inc-flags += -I$(TEELIB)/libteeos/include 18inc-flags += -I$(TEELIB)/libteeos/include/tee 19inc-flags += -I$(TEELIB)/libcrypto/include 20inc-flags += -I$(TEELIB)/libteeconfig/include 21inc-flags += -I$(TEELIB)/libssa/include 22inc-flags += -I$(TEELIB)/libhuk/include 23inc-flags += -I$(TEELIB)/libtee_shared/include 24inc-flags += -I$(PREBUILD_HEADER)/sys 25 26ifneq ($(findstring $(CONFIG_CRYPTO_SOFT_ENGINE), openssl openssl3),) 27inc-flags += -I$(TEELIB)/libopenssl/openssl/include 28inc-flags += -I$(TEELIB)/libopenssl/openssl/crypto 29inc-flags += -I$(TEELIB)/libopenssl/openssl/include/openssl 30endif 31 32ifeq ($(CONFIG_CRYPTO_SUPPORT_SOFT_ECC),true) 33c-flags += -DCRYPTO_SUPPORT_SOFT_ECC 34endif 35 36libswcrypto_engine_c_files += $(wildcard src/*.c) 37libswcrypto_engine_c_files += $(wildcard src/stub/*.c) 38 39ifeq ($(CONFIG_CRYPTO_SUPPORT_X509),true) 40c-flags += -DCRYPTO_SSL_SUPPORT_X509 41libswcrypto_engine_c_files := $(filter-out src/stub/create_cert_wrapper_stub.c, $(libswcrypto_engine_c_files)) 42libswcrypto_engine_c_files := $(filter-out src/stub/tee_ext_cert_api_stub.c, $(libswcrypto_engine_c_files)) 43libswcrypto_engine_c_files := $(filter-out src/stub/x509_wrapper_stub.c, $(libswcrypto_engine_c_files)) 44else 45libswcrypto_engine_c_files := $(filter-out src/create_cert_wrapper.c, $(libswcrypto_engine_c_files)) 46libswcrypto_engine_c_files := $(filter-out src/tee_ext_cert_api.c, $(libswcrypto_engine_c_files)) 47libswcrypto_engine_c_files := $(filter-out src/x509_wrapper.c, $(libswcrypto_engine_c_files)) 48endif 49 50ifeq ($(CONFIG_CRYPTO_ECC_WRAPPER),true) 51libswcrypto_engine_c_files := $(filter-out src/stub/ec_wrapper_stub.c, $(libswcrypto_engine_c_files)) 52ifeq ($(CONFIG_CRYPTO_SUPPORT_X509),true) 53libswcrypto_engine_c_files := $(filter-out src/stub/ec_wrapper_x509_stub.c, $(libswcrypto_engine_c_files)) 54else 55libswcrypto_engine_c_files := $(filter-out src/ec_wrapper_x509.c, $(libswcrypto_engine_c_files)) 56endif 57else 58libswcrypto_engine_c_files := $(filter-out src/ec_wrapper.c, $(libswcrypto_engine_c_files)) 59libswcrypto_engine_c_files := $(filter-out src/ec_wrapper_x509.c, $(libswcrypto_engine_c_files)) 60endif 61 62ifeq ($(CONFIG_CRYPTO_AES_WRAPPER),true) 63libswcrypto_engine_c_files := $(filter-out src/stub/aes_wrapper_stub.c, $(libswcrypto_engine_c_files)) 64else 65libswcrypto_engine_c_files := $(filter-out src/aes_wrapper.c, $(libswcrypto_engine_c_files)) 66endif 67 68ifeq ($(CONFIG_CRYPTO_SOFT_ENGINE),openssl3) 69 c-flags += -DOPENSSL3_ENABLE 70else 71 c-flags += -DOPENSSL_ENABLE 72endif 73libswcrypto_engine_c_files := $(filter-out src/stub/rsa_wrapper_stub.c, $(libswcrypto_engine_c_files)) 74 75include $(BUILD_LIB)/lib-common.mk 76