diff --git a/tee/libteec/Makefile b/tee/libteec/Makefile deleted file mode 100644 index df08a696c8e..00000000000 --- a/tee/libteec/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################ -# apps/tee/libteec/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (C) 2023 Xiaomi Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -############################################################################ - -include $(APPDIR)/Make.defs - -LIBTEEC_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBTEEC_VERSION))) -LIBTEEC_URL ?= "https://github.com/OP-TEE/optee_client/archive/refs/tags" -LIBTEEC_ZIP = $(LIBTEEC_VERSION).zip -LIBTEEC_UNPACKNAME = optee_client -UNPACK ?= unzip -q -o - -CSRCS += optee_client/libteec/src/tee_client_api.c -CSRCS += optee_client/libteec/src/teec_trace.c - -$(LIBTEEC_ZIP): - @echo "Downloading: $(LIBTEEC_URL)/$(LIBTEEC_ZIP)" - $(Q) $(call DOWNLOAD,$(LIBTEEC_URL),$(LIBTEEC_ZIP)) - -$(LIBTEEC_UNPACKNAME): $(LIBTEEC_ZIP) - @echo "Unpacking: $(LIBTEEC_ZIP) -> $(LIBTEEC_UNPACKNAME)" - $(Q) $(UNPACK) $(LIBTEEC_ZIP) - $(Q) mv $(LIBTEEC_UNPACKNAME)-$(LIBTEEC_VERSION) $(LIBTEEC_UNPACKNAME) - $(Q) echo "Patching $(LIBTEEC_UNPACKNAME)" - $(Q) patch -p1 -d $(LIBTEEC_UNPACKNAME) < 0001-libteec-NuttX.patch - $(Q) touch $(LIBTEEC_UNPACKNAME) - -ifeq ($(wildcard $(LIBTEEC_UNPACKNAME)/.git),) -context:: $(LIBTEEC_UNPACKNAME) - -distclean:: - $(call DELDIR, $(LIBTEEC_UNPACKNAME)) - $(call DELFILE, $(LIBTEEC_ZIP)) -endif - -include $(APPDIR)/Application.mk diff --git a/tee/libteec/.gitignore b/tee/optee_client/.gitignore similarity index 100% rename from tee/libteec/.gitignore rename to tee/optee_client/.gitignore diff --git a/tee/libteec/0001-libteec-NuttX.patch b/tee/optee_client/0001-libteec-NuttX.patch similarity index 100% rename from tee/libteec/0001-libteec-NuttX.patch rename to tee/optee_client/0001-libteec-NuttX.patch diff --git a/tee/optee_supplicant/0001-tee-supplicant-port-to-nuttx.patch b/tee/optee_client/0002-tee-supplicant-port-to-nuttx.patch similarity index 100% rename from tee/optee_supplicant/0001-tee-supplicant-port-to-nuttx.patch rename to tee/optee_client/0002-tee-supplicant-port-to-nuttx.patch diff --git a/tee/libteec/CMakeLists.txt b/tee/optee_client/CMakeLists.txt similarity index 54% rename from tee/libteec/CMakeLists.txt rename to tee/optee_client/CMakeLists.txt index 9fa59587b1d..c711dd8378d 100644 --- a/tee/libteec/CMakeLists.txt +++ b/tee/optee_client/CMakeLists.txt @@ -26,14 +26,17 @@ if(CONFIG_LIBTEEC) if(NOT EXISTS ${OPTEE_CLIENT_DIR}) set(OPTEE_CLIENT_URL https://github.com/OP-TEE/optee_client/archive/refs/tags) - set(OPTEE_CLIENT_VER ${CONFIG_LIBTEEC_VERSION}) + set(OPTEE_CLIENT_VER ${CONFIG_OPTEE_CLIENT_VERSION}) FetchContent_Declare( optee_client_fetch URL ${OPTEE_CLIENT_URL}/${OPTEE_CLIENT_VER}.zip SOURCE_DIR ${OPTEE_CLIENT_DIR} BINARY_DIR - ${CMAKE_BINARY_DIR}/tee/libteec/optee_client - PATCH_COMMAND patch -p1 -d ${OPTEE_CLIENT_DIR} < - ${CMAKE_CURRENT_LIST_DIR}/0001-libteec-NuttX.patch + ${CMAKE_BINARY_DIR}/tee/optee_client/optee_client + PATCH_COMMAND + patch -p1 -d ${OPTEE_CLIENT_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0001-libteec-NuttX.patch && patch -p1 -d + ${OPTEE_CLIENT_DIR} < + ${CMAKE_CURRENT_LIST_DIR}/0002-tee-supplicant-port-to-nuttx.patch DOWNLOAD_NO_PROGRESS true TIMEOUT 30) @@ -53,8 +56,7 @@ if(CONFIG_LIBTEEC) target_sources(libteec PRIVATE optee_client/libteec/src/tee_client_api.c optee_client/libteec/src/teec_trace.c) - target_include_directories(libteec - PRIVATE ${OPTEE_CLIENT_DIR}/libteec/include) + target_include_directories(libteec PUBLIC ${OPTEE_CLIENT_DIR}/libteec/include) target_compile_definitions(libteec PUBLIC BINARY_PREFIX=\"TEEC\") if(CONFIG_DEBUG_INFO) @@ -68,4 +70,46 @@ if(CONFIG_LIBTEEC) target_compile_definitions(libteec PUBLIC DEBUGLEVEL=1) endif() -endif() + if(CONFIG_OPTEE_SUPPLICANT) + + # Source files for supplicant + set(SUPPLICANT_SRCS + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/tee_supplicant.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/handle.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/hmac_sha2.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/sha2.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/sd_notify.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/teec_ta_load.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/tee_supp_fs.c + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/rpmb.c) + + set(SUPPLICANT_DEFS + TEEC_LOAD_PATH=\"/bin\" TEE_FS_PARENT_PATH=\"/data/tee\" + DEBUGLEVEL_${CONFIG_OPTEE_SUPPLICANT_LOG_LEVEL}) + + if(CONFIG_OPTEE_GP_SOCKETS) + list(APPEND SUPPLICANT_SRCS + ${OPTEE_CLIENT_DIR}/tee-supplicant/src/tee_socket.c) + list(APPEND SUPPLICANT_DEFS CFG_GP_SOCKETS=1) + endif() + + # Add the application + nuttx_add_application( + NAME + ${CONFIG_OPTEE_SUPPLICANT_PROGNAME} + SRCS + ${SUPPLICANT_SRCS} + INCLUDE_DIRECTORIES + ${OPTEE_CLIENT_DIR}/tee-supplicant/src + DEFINITIONS + ${SUPPLICANT_DEFS} + STACKSIZE + ${CONFIG_OPTEE_SUPPLICANT_STACKSIZE} + PRIORITY + ${CONFIG_OPTEE_SUPPLICANT_PRIORITY} + DEPENDS + libteec) + + endif() # CONFIG_OPTEE_SUPPLICANT + +endif() # CONFIG_LIBTEEC diff --git a/tee/libteec/Kconfig b/tee/optee_client/Kconfig similarity index 70% rename from tee/libteec/Kconfig rename to tee/optee_client/Kconfig index 2c5f4c0d647..7c6455e9a95 100644 --- a/tee/libteec/Kconfig +++ b/tee/optee_client/Kconfig @@ -1,5 +1,5 @@ ############################################################################ -# apps/tee/libteec/Kconfig +# apps/tee/optee_client/Kconfig # # SPDX-License-Identifier: Apache-2.0 # @@ -38,8 +38,39 @@ config LIBTEEC if LIBTEEC -config LIBTEEC_VERSION +config OPTEE_CLIENT_VERSION string "optee_client version (4.6.0)" default "4.6.0" endif # LIBTEEC + +config OPTEE_SUPPLICANT + bool "OP-TEE supplicant" + depends on LIBTEEC + default n + ---help--- + Enable OP-TEE supplicant from https://github.com/OP-TEE/optee_client. + +if OPTEE_SUPPLICANT + +config OPTEE_SUPPLICANT_PROGNAME + string "Program name" + default "optee_supplicant" + ---help--- + This is the name of the program that will be used when the NSH ELF + program is installed. + +config OPTEE_SUPPLICANT_PRIORITY + int "OP-TEE supplicant task priority" + default 100 + +config OPTEE_SUPPLICANT_STACKSIZE + int "OP-TEE supplicant stack size" + default DEFAULT_TASK_STACKSIZE + +config OPTEE_SUPPLICANT_LOG_LEVEL + int "Log level for the supplicant (0‑4)" + range 0 4 + default 0 + +endif # OPTEE_SUPPLICANT diff --git a/tee/libteec/Make.defs b/tee/optee_client/Make.defs similarity index 83% rename from tee/libteec/Make.defs rename to tee/optee_client/Make.defs index 2947d677bbf..ee31c9fb2ab 100644 --- a/tee/libteec/Make.defs +++ b/tee/optee_client/Make.defs @@ -1,10 +1,8 @@ ############################################################################ -# apps/tee/libteec/Make.defs +# apps/tee/optee_client/Make.defs # # SPDX-License-Identifier: Apache-2.0 # -# Copyright (C) 2023 Xiaomi Corporation -# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -20,9 +18,9 @@ ############################################################################ ifneq ($(CONFIG_LIBTEEC),) -CONFIGURED_APPS += $(APPDIR)/tee/libteec +CONFIGURED_APPS += $(APPDIR)/tee/optee_client -FLAGS += ${INCDIR_PREFIX}$(APPDIR)/tee/libteec/optee_client/libteec/include +FLAGS += ${INCDIR_PREFIX}$(APPDIR)/tee/optee_client/optee_client/libteec/include FLAGS += ${DEFINE_PREFIX}BINARY_PREFIX="\"TEEC\"" ifneq ($(CONFIG_DEBUG_INFO),) @@ -40,7 +38,4 @@ AFLAGS += $(FLAGS) CFLAGS += $(FLAGS) CXXFLAGS += $(FLAGS) -DEPPATH += --dep-path libteec -VPATH += :libteec - endif diff --git a/tee/optee_client/Makefile b/tee/optee_client/Makefile new file mode 100644 index 00000000000..069323dbc14 --- /dev/null +++ b/tee/optee_client/Makefile @@ -0,0 +1,88 @@ +############################################################################ +# apps/tee/optee_client/Makefile +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +############################################################################ + +include $(APPDIR)/Make.defs + +OPTEE_CLIENT_VERSION = $(patsubst "%",%,$(strip $(CONFIG_OPTEE_CLIENT_VERSION))) +OPTEE_CLIENT_URL ?= "https://github.com/OP-TEE/optee_client/archive/refs/tags" +OPTEE_CLIENT_ZIP = $(OPTEE_CLIENT_VERSION).zip +OPTEE_CLIENT_UNPACKNAME = optee_client +UNPACK ?= unzip -q -o + +DEPPATH += --dep-path $(OPTEE_CLIENT_UNPACKNAME)/libteec/src +VPATH += $(OPTEE_CLIENT_UNPACKNAME)/libteec/src + +CSRCS += tee_client_api.c +CSRCS += teec_trace.c + +ifneq ($(CONFIG_OPTEE_SUPPLICANT),) + DEPPATH += --dep-path $(OPTEE_CLIENT_UNPACKNAME)/tee-supplicant/src + VPATH += $(OPTEE_CLIENT_UNPACKNAME)/tee-supplicant/src + + PROGNAME += ${CONFIG_OPTEE_SUPPLICANT_PROGNAME} + PRIORITY += $(CONFIG_OPTEE_SUPPLICANT_PRIORITY) + STACKSIZE += $(CONFIG_OPTEE_SUPPLICANT_STACKSIZE) + MODULE += $(CONFIG_OPTEE_SUPPLICANT) + MAINSRC += tee_supplicant.c + + CSRCS += handle.c + CSRCS += hmac_sha2.c + CSRCS += sha2.c + CSRCS += sd_notify.c + CSRCS += teec_ta_load.c + CSRCS += tee_supp_fs.c + CSRCS += rpmb.c + + ifeq ($(CONFIG_GP_SOCKETS),1) + CSRCS += tee_socket.c + FLAGS += ${DEFINE_PREFIX}CFG_GP_SOCKETS=1 + endif + + FLAGS += ${INCDIR_PREFIX}optee_client/tee-supplicant/src + FLAGS += ${DEFINE_PREFIX}TEEC_LOAD_PATH=\"/bin\" + FLAGS += ${DEFINE_PREFIX}TEE_FS_PARENT_PATH=\"/data/tee\" + FLAGS += ${DEFINE_PREFIX}DEBUGLEVEL_$(CONFIG_OPTEE_SUPPLICANT_LOG_LEVEL) +endif + +AFLAGS += $(FLAGS) +CFLAGS += $(FLAGS) +CXXFLAGS += $(FLAGS) + +$(OPTEE_CLIENT_ZIP): + @echo "Downloading: $(OPTEE_CLIENT_URL)/$(OPTEE_CLIENT_ZIP)" + $(Q) $(call DOWNLOAD,$(OPTEE_CLIENT_URL),$(OPTEE_CLIENT_ZIP)) + +$(OPTEE_CLIENT_UNPACKNAME): $(OPTEE_CLIENT_ZIP) + @echo "Unpacking: $(OPTEE_CLIENT_ZIP) -> $(OPTEE_CLIENT_UNPACKNAME)" + $(Q) $(UNPACK) $(OPTEE_CLIENT_ZIP) + $(Q) mv $(OPTEE_CLIENT_UNPACKNAME)-$(OPTEE_CLIENT_VERSION) $(OPTEE_CLIENT_UNPACKNAME) + $(Q) echo "Patching $(OPTEE_CLIENT_UNPACKNAME)" + $(Q) patch -p1 -d $(OPTEE_CLIENT_UNPACKNAME) < 0001-libteec-NuttX.patch + $(Q) patch -p1 -d $(OPTEE_CLIENT_UNPACKNAME) < 0002-tee-supplicant-port-to-nuttx.patch + $(Q) touch $(OPTEE_CLIENT_UNPACKNAME) + +ifeq ($(wildcard $(OPTEE_CLIENT_UNPACKNAME)/.git),) +context:: $(OPTEE_CLIENT_UNPACKNAME) + +distclean:: + $(call DELDIR, $(OPTEE_CLIENT_UNPACKNAME)) + $(call DELFILE, $(OPTEE_CLIENT_ZIP)) +endif + +include $(APPDIR)/Application.mk diff --git a/tee/optee_supplicant/CMakeLists.txt b/tee/optee_supplicant/CMakeLists.txt deleted file mode 100644 index 388952de570..00000000000 --- a/tee/optee_supplicant/CMakeLists.txt +++ /dev/null @@ -1,117 +0,0 @@ -# ############################################################################## -# apps/tee/optee_supplicant/CMakeLists.txt -# -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (C) 2023 Xiaomi Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -# -# ############################################################################## - -if(CONFIG_OPTEE_SUPPLICANT) - - # Versions must match - set(LIBTEEC_VERSION ${CONFIG_LIBTEEC_VERSION}) - set(OPTEE_SUPPLICANT_VERSION ${CONFIG_OPTEE_SUPPLICANT_VERSION}) - if(NOT "${OPTEE_SUPPLICANT_VERSION}" STREQUAL "${LIBTEEC_VERSION}") - message( - FATAL_ERROR - "OPTEE supplicant version (${OPTEE_SUPPLICANT_VERSION}) does not match libteec version (${LIBTEEC_VERSION}).\n" - "Please set CONFIG_OPTEE_SUPPLICANT_VERSION to ${LIBTEEC_VERSION} in your config." - ) - endif() - - # Determine paths - set(OPTEE_CLIENT_DIR ${CMAKE_CURRENT_LIST_DIR}/optee_client) - set(OPTEE_CLIENT_ZIP - ${CMAKE_CURRENT_LIST_DIR}/../libteec/${LIBTEEC_VERSION}.zip) - set(PATCH_FILE - ${CMAKE_CURRENT_LIST_DIR}/0001-tee-supplicant-port-to-nuttx.patch) - - # Unpack only if not already present - if(NOT EXISTS "${OPTEE_CLIENT_DIR}") - message( - STATUS - "Unpacking OP-TEE client from ${OPTEE_CLIENT_ZIP} to ${OPTEE_CLIENT_DIR}" - ) - # Ensure output dir exists - file(MAKE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/_optee_unpack) - # Extract zip - file(ARCHIVE_EXTRACT INPUT ${OPTEE_CLIENT_ZIP} OUTPUT_DIR - ${CMAKE_CURRENT_LIST_DIR}/_optee_unpack) - # Rename unpacked folder to optee_client - file(RENAME - ${CMAKE_CURRENT_LIST_DIR}/_optee_unpack/optee_client-${LIBTEEC_VERSION} - ${OPTEE_CLIENT_DIR}) - file(REMOVE_RECURSE ${CMAKE_CURRENT_LIST_DIR}/_optee_unpack) - # Apply patch - execute_process( - COMMAND patch -p1 -d ${OPTEE_CLIENT_DIR} -i ${PATCH_FILE} - WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} - RESULT_VARIABLE patch_result) - if(NOT patch_result EQUAL 0) - message( - FATAL_ERROR - "Failed to apply patch ${PATCH_FILE} to optee_client sources.") - endif() - endif() - - # Source files for supplicant - set(SUPPLICANT_SRCS - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/tee_supplicant.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/handle.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/hmac_sha2.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/sha2.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/sd_notify.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/teec_ta_load.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/tee_supp_fs.c - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/rpmb.c) - - if(CONFIG_OPTEE_GP_SOCKETS) - list(APPEND SUPPLICANT_SRCS - ${OPTEE_CLIENT_DIR}/tee-supplicant/src/tee_socket.c) - add_compile_definitions(CFG_GP_SOCKETS=1) - endif() - - # Compiler flags - set(SUPPLICANT_CFLAGS - ${INCDIR_PREFIX}${OPTEE_CLIENT_DIR}/tee-supplicant/src - ${DEFINE_PREFIX}TEEC_LOAD_PATH=\"/bin\" - ${DEFINE_PREFIX}TEE_FS_PARENT_PATH=\"/data/tee\" - ${DEFINE_PREFIX}DEBUGLEVEL_${CONFIG_OPTEE_SUPPLICANT_LOG_LEVEL}) - add_compile_options($<$:${SUPPLICANT_CFLAGS}>) - - # Expose public headers for other apps - set_property( - TARGET nuttx - APPEND - PROPERTY NUTTX_INCLUDE_DIRECTORIES ${OPTEE_CLIENT_DIR}/libteec/include) - - # Add the application - nuttx_add_application( - NAME - ${CONFIG_OPTEE_SUPPLICANT_PROGNAME} - SRCS - ${SUPPLICANT_SRCS} - INCLUDES - ${OPTEE_CLIENT_DIR}/libteec/include - ${OPTEE_CLIENT_DIR}/tee-supplicant/src - STACKSIZE - ${CONFIG_OPTEE_SUPPLICANT_STACKSIZE} - PRIORITY - ${CONFIG_OPTEE_SUPPLICANT_PRIORITY} - REQUIRES - libteec) - -endif() diff --git a/tee/optee_supplicant/Kconfig b/tee/optee_supplicant/Kconfig deleted file mode 100644 index 662bf96a7d3..00000000000 --- a/tee/optee_supplicant/Kconfig +++ /dev/null @@ -1,54 +0,0 @@ -############################################################################ -# apps/tee/optee_supplicant/Kconfig -# -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (C) 2023 Xiaomi Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -############################################################################ - -config OPTEE_SUPPLICANT - bool "OP-TEE supplicant" - depends on LIBTEEC - default n - ---help--- - Enable OP-TEE supplicant from https://github.com/OP-TEE/optee_client. - -if OPTEE_SUPPLICANT - -config OPTEE_SUPPLICANT_PROGNAME - string "Program name" - default "optee_supplicant" - ---help--- - This is the name of the program that will be used when the NSH ELF - program is installed. - -config OPTEE_SUPPLICANT_PRIORITY - int "OP-TEE supplicant task priority" - default 100 - -config OPTEE_SUPPLICANT_STACKSIZE - int "OP-TEE supplicant stack size" - default DEFAULT_TASK_STACKSIZE - -config OPTEE_SUPPLICANT_VERSION - string "optee_client version (4.6.0)" - default "4.6.0" - -config OPTEE_SUPPLICANT_LOG_LEVEL - int "Log level for the supplicant (0‑4)" - range 0 4 - default 0 -endif # OPTEE_SUPPLICANT diff --git a/tee/optee_supplicant/Make.defs b/tee/optee_supplicant/Make.defs deleted file mode 100644 index bc07c1a67af..00000000000 --- a/tee/optee_supplicant/Make.defs +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################ -# apps/tee/optee_supplicant/Make.defs -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -############################################################################ - -ifneq ($(CONFIG_OPTEE_SUPPLICANT),) -CONFIGURED_APPS += $(APPDIR)/tee/optee_supplicant -endif diff --git a/tee/optee_supplicant/Makefile b/tee/optee_supplicant/Makefile deleted file mode 100644 index 4ecfe8a9264..00000000000 --- a/tee/optee_supplicant/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################ -# apps/tee/optee_supplicant/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (C) 2023 Xiaomi Corporation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -############################################################################ - -include $(APPDIR)/Make.defs - -PROGNAME = ${CONFIG_OPTEE_SUPPLICANT_PROGNAME} -PRIORITY = $(CONFIG_OPTEE_SUPPLICANT_PRIORITY) -STACKSIZE = $(CONFIG_OPTEE_SUPPLICANT_STACKSIZE) -MODULE = $(CONFIG_OPTEE_SUPPLICANT) -MAINSRC = optee_client/tee-supplicant/src/tee_supplicant.c - -LIBTEEC_VERSION = $(patsubst "%",%,$(strip $(CONFIG_LIBTEEC_VERSION))) -OPTEE_SUPPLICANT_VERSION = $(patsubst "%",%,$(strip $(CONFIG_OPTEE_SUPPLICANT_VERSION))) -PATCH_FILE = 0001-tee-supplicant-port-to-nuttx.patch -OPTEE_SUPPLICANT_ZIP = ../libteec/$(LIBTEEC_VERSION).zip -OPTEE_SUPPLICANT_UNPACKNAME = optee_client -UNPACK ?= unzip -q -o - -ifeq ($(strip $(OPTEE_SUPPLICANT_VERSION)),$(strip $(LIBTEEC_VERSION))) - # Versions match, continue. -else - $(error \ - The supplicant patch version ($(OPTEE_SUPPLICANT_VERSION)) does not match LIBTEEC_VERSION ($(LIBTEEC_VERSION)). \ - Build aborted. Change LIBTEEC_VERSION version to match OPTEE_SUPPLICANT_VERSION. \ - ) -endif - -CSRCS += optee_client/tee-supplicant/src/handle.c -CSRCS += optee_client/tee-supplicant/src/hmac_sha2.c -CSRCS += optee_client/tee-supplicant/src/sha2.c -CSRCS += optee_client/tee-supplicant/src/sd_notify.c -CSRCS += optee_client/tee-supplicant/src/teec_ta_load.c -CSRCS += optee_client/tee-supplicant/src/tee_supp_fs.c -CSRCS += optee_client/tee-supplicant/src/rpmb.c - -ifeq ($(CONFIG_GP_SOCKETS),1) -CSRCS += optee_client/tee-supplicant/src/tee_socket.c -CFLAGS += ${DEFINE_PREFIX}CFG_GP_SOCKETS=1 -endif - -CFLAGS += ${INCDIR_PREFIX}optee_client/tee-supplicant/src -CFLAGS += ${DEFINE_PREFIX}TEEC_LOAD_PATH=\"/bin\" -CFLAGS += ${DEFINE_PREFIX}TEE_FS_PARENT_PATH=\"/data/tee\" -CFLAGS += ${DEFINE_PREFIX}DEBUGLEVEL_$(CONFIG_OPTEE_SUPPLICANT_LOG_LEVEL) - -$(OPTEE_SUPPLICANT_UNPACKNAME): $(OPTEE_SUPPLICANT_ZIP) - @echo "Unpacking: $(OPTEE_SUPPLICANT_ZIP) -> $(OPTEE_SUPPLICANT_UNPACKNAME)" - $(Q) $(UNPACK) $(OPTEE_SUPPLICANT_ZIP) - $(Q) mv $(OPTEE_SUPPLICANT_UNPACKNAME)-$(OPTEE_SUPPLICANT_VERSION) $(OPTEE_SUPPLICANT_UNPACKNAME) - $(Q) echo "Patching $(OPTEE_SUPPLICANT_UNPACKNAME)" - $(Q) patch -p1 -d $(OPTEE_SUPPLICANT_UNPACKNAME) < $(PATCH_FILE) - $(Q) touch $(OPTEE_SUPPLICANT_UNPACKNAME) - -ifeq ($(wildcard $(OPTEE_SUPPLICANT_UNPACKNAME)/.git),) -context:: $(OPTEE_SUPPLICANT_UNPACKNAME) - -distclean:: - $(Q) rm -rf $(OPTEE_SUPPLICANT_UNPACKNAME) -endif - -include $(APPDIR)/Application.mk