Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: BSD-3-Clause |
| 3 | # SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | # |
| 5 | |
Mate Toth-Pal | 83a45bd | 2023-09-01 11:17:19 +0200 | [diff] [blame] | 6 | # The t_cose library is not included in the CBMC analysis |
| 7 | if(RMM_CBMC_STATIC_ANALYSIS) |
| 8 | add_library(t_cose INTERFACE) |
| 9 | return() |
| 10 | endif() |
| 11 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 12 | add_library(t_cose) |
| 13 | |
| 14 | set(T_COSE_SOURCE_DIR "${RMM_SOURCE_DIR}/ext/t_cose") |
| 15 | |
Tamas Ban | fac904c | 2024-09-11 16:02:30 +0200 | [diff] [blame] | 16 | # Patch t_cose |
| 17 | set(T_COSE_PATCH_DIR "${RMM_SOURCE_DIR}/configs/t_cose") |
| 18 | set(T_COSE_PATCH_FILES |
| 19 | "${T_COSE_PATCH_DIR}/0001-Add-t_cose_key_encode-API.patch") |
| 20 | |
| 21 | Git_Apply_Patches(${T_COSE_SOURCE_DIR} "${T_COSE_PATCH_FILES}") |
| 22 | |
Mate Toth-Pal | fda673a | 2023-06-13 12:25:43 +0200 | [diff] [blame] | 23 | #TODO: Eliminate warning suppression once the t_cose submodule is updated to |
| 24 | # a released version. |
| 25 | target_compile_options(t_cose |
| 26 | PRIVATE |
| 27 | "-Wno-maybe-uninitialized" |
| 28 | "-Wno-cpp" |
| 29 | "-Wno-unused-variable") |
| 30 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 31 | target_compile_definitions(t_cose |
Mate Toth-Pal | c69951d | 2023-03-17 17:30:50 +0100 | [diff] [blame] | 32 | PRIVATE |
| 33 | "T_COSE_USE_PSA_CRYPTO=1" |
| 34 | "T_COSE_DISABLE_HPKE=1" |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 35 | ) |
| 36 | |
| 37 | target_link_libraries(t_cose |
| 38 | PRIVATE |
| 39 | rmm-lib-common |
| 40 | rmm-lib-libc |
| 41 | ) |
| 42 | |
| 43 | target_link_libraries(t_cose |
| 44 | PUBLIC |
Soby Mathew | 73dad84 | 2022-12-16 12:51:01 +0000 | [diff] [blame] | 45 | rmm-mbedtls |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 46 | qcbor |
| 47 | ) |
| 48 | |
| 49 | target_include_directories(t_cose |
| 50 | PUBLIC |
| 51 | "${T_COSE_SOURCE_DIR}/inc" |
Mate Toth-Pal | c69951d | 2023-03-17 17:30:50 +0100 | [diff] [blame] | 52 | "${T_COSE_SOURCE_DIR}/crypto_adapters" |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 53 | PRIVATE |
| 54 | "${T_COSE_SOURCE_DIR}/src" |
| 55 | ) |
| 56 | |
| 57 | target_sources(t_cose |
| 58 | PRIVATE |
Soby Mathew | 4d4c21a | 2023-06-29 14:52:41 +0200 | [diff] [blame] | 59 | "${T_COSE_SOURCE_DIR}/crypto_adapters/t_cose_psa_crypto.c" |
Mate Toth-Pal | fda673a | 2023-06-13 12:25:43 +0200 | [diff] [blame] | 60 | "${T_COSE_SOURCE_DIR}/src/t_cose_parameters.c" |
| 61 | "${T_COSE_SOURCE_DIR}/src/t_cose_sign_sign.c" |
| 62 | "${T_COSE_SOURCE_DIR}/src/t_cose_signature_sign_restart.c" |
| 63 | "${T_COSE_SOURCE_DIR}/src/t_cose_util.c" |
Tamas Ban | fac904c | 2024-09-11 16:02:30 +0200 | [diff] [blame] | 64 | "${T_COSE_SOURCE_DIR}/src/t_cose_key.c" |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 65 | ) |