aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamas Ban <tamas.ban@arm.com>2020-01-07 15:09:16 +0000
committerTamas Ban <tamas.ban@arm.com>2020-01-23 13:33:03 +0000
commitc2e0c18884fa3ce5334a6f1f5dba48b194573d4c (patch)
tree51f892a2a08ea60eb48e56db15b53e76ddf08e8d
parent608f039345c9795d974d17e30fcb3f0d53152a6a (diff)
downloadtrusted-firmware-m-c2e0c18884fa3ce5334a6f1f5dba48b194573d4c.tar.gz
Build: Add new version of COSE library to TF-M build
Updated version of t_cose library was upstreamed to lib/ext/t_cose folder. Add a CMakeList.txt to the folder to integrate it with TF-M build system. Change-Id: I67f3a94ab1f2075c12fd25b594a6b477f93ac89b Signed-off-by: Tamas Ban <tamas.ban@arm.com>
-rw-r--r--lib/ext/t_cose/CMakeLists.txt89
1 files changed, 89 insertions, 0 deletions
diff --git a/lib/ext/t_cose/CMakeLists.txt b/lib/ext/t_cose/CMakeLists.txt
new file mode 100644
index 000000000..7ff82e5e0
--- /dev/null
+++ b/lib/ext/t_cose/CMakeLists.txt
@@ -0,0 +1,89 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_minimum_required(VERSION 3.7)
+
+#Tell cmake where our modules can be found
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../cmake)
+
+#Some project global settings
+set(T_COSE_DIR "${CMAKE_CURRENT_LIST_DIR}")
+get_filename_component(TFM_ROOT_DIR "${T_COSE_DIR}/../../.." ABSOLUTE)
+
+#Include common stuff to control cmake.
+include("Common/BuildSys")
+
+#Start an embedded project.
+embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
+project(tfm_t_cose LANGUAGES C)
+embedded_project_fixup()
+
+if (NOT DEFINED ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID)
+ message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID is undefined. ")
+endif()
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C_SIGN
+ "${T_COSE_DIR}/src/t_cose_sign1_sign.c"
+ "${T_COSE_DIR}/src/t_cose_util.c"
+ "${T_COSE_DIR}/src/t_cose_parameters.c"
+ "${T_COSE_DIR}/crypto_adapters/t_cose_psa_crypto.c"
+ )
+
+list(APPEND ALL_SRC_C_VERIFY
+ "${T_COSE_DIR}/src/t_cose_sign1_verify.c"
+ "${T_COSE_DIR}/src/t_cose_util.c"
+ "${T_COSE_DIR}/src/t_cose_parameters.c"
+ "${T_COSE_DIR}/crypto_adapters/t_cose_psa_crypto.c"
+ )
+
+list(APPEND ALL_SRC_C_TEST
+ "${T_COSE_DIR}/test/run_tests.c"
+ "${T_COSE_DIR}/test/t_cose_make_psa_test_key.c"
+ "${T_COSE_DIR}/test/t_cose_make_test_messages.c"
+ "${T_COSE_DIR}/test/t_cose_sign_verify_test.c"
+ "${T_COSE_DIR}/test/t_cose_test.c"
+ )
+
+#Setting include directories
+embedded_include_directories(PATH ${T_COSE_DIR}/inc ABSOLUTE)
+embedded_include_directories(PATH ${T_COSE_DIR}/../qcbor/inc ABSOLUTE)
+embedded_target_include_directories(TARGET tfm_t_cose_sign PATH ${T_COSE_DIR}/src ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET tfm_t_cose_verify PATH ${T_COSE_DIR}/src ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET tfm_t_cose_test PATH ${T_COSE_DIR}/src ABSOLUTE APPEND)
+
+#Specify what we build (t_cose_sign and t_cose_verify build as an object library)
+add_library(tfm_t_cose_sign OBJECT ${ALL_SRC_C_SIGN})
+add_library(tfm_t_cose_verify OBJECT ${ALL_SRC_C_VERIFY})
+add_library(tfm_t_cose_test OBJECT ${ALL_SRC_C_TEST})
+
+#Setting target specific defines
+
+list(APPEND T_COSE_COMPILE_TIME_CONFIG
+ "T_COSE_USE_PSA_CRYPTO"
+ "T_COSE_DISABLE_ES384"
+ "T_COSE_DISABLE_ES512"
+ "T_COSE_DISABLE_CONTENT_TYPE"
+ "T_COSE_DISABLE_SIGN_VERIFY_TESTS"
+ )
+
+if (NOT ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID)
+ list(APPEND T_COSE_COMPILE_TIME_CONFIG "T_COSE_DISABLE_SHORT_CIRCUIT_SIGN")
+endif()
+
+embedded_set_target_compile_defines(TARGET tfm_t_cose_sign LANGUAGE C DEFINES ${T_COSE_COMPILE_TIME_CONFIG} APPEND)
+embedded_set_target_compile_defines(TARGET tfm_t_cose_verify LANGUAGE C DEFINES ${T_COSE_COMPILE_TIME_CONFIG} APPEND)
+embedded_set_target_compile_defines(TARGET tfm_t_cose_test LANGUAGE C DEFINES ${T_COSE_COMPILE_TIME_CONFIG} APPEND)
+
+#Set common compiler flags
+config_setting_shared_compiler_flags(tfm_t_cose_sign)
+config_setting_shared_compiler_flags(tfm_t_cose_verify)
+config_setting_shared_compiler_flags(tfm_t_cose_test)
+
+embedded_project_end(tfm_t_cose_sign)
+embedded_project_end(tfm_t_cose_verify)
+embedded_project_end(tfm_t_cose_test)