COSE: Split t_cose to two part: sign and verify

Increase granularity to link only those files to secure
code which are used for signing the attestation token.
Other files are linked to non-secure code which are used
during attestation test suite for signature verification.

Change-Id: I6dc030563f56b047253c7a1f3494f59a12fe61c7
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/lib/t_cose/CMakeLists.txt b/lib/t_cose/CMakeLists.txt
index e1f1985..065271b 100644
--- a/lib/t_cose/CMakeLists.txt
+++ b/lib/t_cose/CMakeLists.txt
@@ -15,26 +15,39 @@
 
 #Start an embedded project.
 embedded_project_start(CONFIG "${CMAKE_CURRENT_LIST_DIR}/../../ConfigDefault.cmake")
-project(tfm_t_cose LANGUAGES C)
+project(tfm_t_cose_sign   LANGUAGES C)
+project(tfm_t_cose_verify LANGUAGES C)
 embedded_project_fixup()
 
 #Some project global settings
 set(T_COSE_DIR "${CMAKE_CURRENT_LIST_DIR}")
 
 #Append all our source files to global lists.
-list(APPEND ALL_SRC_C
+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_psa_crypto.c"
+	"${T_COSE_DIR}/src/t_cose_psa_crypto_hash.c"
+	"${T_COSE_DIR}/src/t_cose_psa_crypto_sign.c"
+	)
+
+list(APPEND ALL_SRC_C_VERIFY
+	"${T_COSE_DIR}/src/t_cose_util.c"
+	"${T_COSE_DIR}/src/t_cose_psa_crypto_hash.c"
+	"${T_COSE_DIR}/src/t_cose_psa_crypto_verify.c"
 	)
 
 #Setting include directories
 embedded_include_directories(PATH ${T_COSE_DIR}/inc ABSOLUTE)
+embedded_target_include_directories(TARGET tfm_t_cose_verify PATH ${TFM_ROOT_DIR}/lib/ext/qcbor/util ABSOLUTE APPEND)
+embedded_target_include_directories(TARGET tfm_t_cose_sign   PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE APPEND)
 
-#Specify what we build (for the t_cose, build as an object library)
-add_library(${PROJECT_NAME} OBJECT ${ALL_SRC_C})
+#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})
 
 #Set common compiler flags
-config_setting_shared_compiler_flags(${PROJECT_NAME})
+config_setting_shared_compiler_flags(tfm_t_cose_sign)
+config_setting_shared_compiler_flags(tfm_t_cose_verify)
 
-embedded_project_end(${PROJECT_NAME})
+embedded_project_end(tfm_t_cose_sign)
+embedded_project_end(tfm_t_cose_verify)