Brad Bishop | bec4ebc | 2022-08-03 09:55:16 -0400 | [diff] [blame] | 1 | From 75c0689513e7da7fb26bf23c1da4e1aa49783d46 Mon Sep 17 00:00:00 2001 |
| 2 | From: Julian Hall <julian.hall@arm.com> |
| 3 | Date: Tue, 11 Jan 2022 09:43:52 +0000 |
| 4 | Subject: [PATCH] Peg to updated t_cose version fc3a4b2c |
| 5 | |
| 6 | The current version of TS fails to build due to a regression introduced |
| 7 | by a new t_cose version in the upstream project. |
| 8 | The issue is caused by the t_cose external component incorrectly using |
| 9 | tip of master as the upstream version id, which makes strict dependency |
| 10 | control impossible. Change the upstream version id to an SHA, to enable |
| 11 | controlling compatibility issues introduced by future upstream updates. |
| 12 | |
| 13 | At the same time update the dependency to the current latest version. |
| 14 | The upstream project is now compatile with mbedtls 3.0.0 API changes |
| 15 | so the previously required compatibility patch has been removed. |
| 16 | |
| 17 | Signed-off-by: Julian Hall <julian.hall@arm.com> |
| 18 | Change-Id: I9491a5210904cc369846da2af45b0f7e5913bed8 |
| 19 | |
| 20 | Upstream-Status: Pending [Not submitted to upstream yet] |
| 21 | Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com> |
| 22 | |
| 23 | |
| 24 | --- |
| 25 | .../0002-add-tls3_0_0-compatibility.patch | 31 ------------------- |
| 26 | external/t_cose/t_cose.cmake | 5 ++- |
| 27 | 2 files changed, 2 insertions(+), 34 deletions(-) |
| 28 | delete mode 100644 external/t_cose/0002-add-tls3_0_0-compatibility.patch |
| 29 | |
| 30 | diff --git a/external/t_cose/0002-add-tls3_0_0-compatibility.patch b/external/t_cose/0002-add-tls3_0_0-compatibility.patch |
| 31 | deleted file mode 100644 |
| 32 | index 20a7d131..00000000 |
| 33 | --- a/external/t_cose/0002-add-tls3_0_0-compatibility.patch |
| 34 | +++ /dev/null |
| 35 | @@ -1,31 +0,0 @@ |
| 36 | -diff --git a/crypto_adapters/t_cose_psa_crypto.c b/crypto_adapters/t_cose_psa_crypto.c |
| 37 | -index 49c5b60..3aa7b58 100644 |
| 38 | ---- a/crypto_adapters/t_cose_psa_crypto.c |
| 39 | -+++ b/crypto_adapters/t_cose_psa_crypto.c |
| 40 | -@@ -99,7 +99,7 @@ static enum t_cose_err_t psa_status_to_t_cose_error_signing(psa_status_t err) |
| 41 | - err == PSA_ERROR_INVALID_SIGNATURE ? T_COSE_ERR_SIG_VERIFY : |
| 42 | - err == PSA_ERROR_NOT_SUPPORTED ? T_COSE_ERR_UNSUPPORTED_SIGNING_ALG: |
| 43 | - err == PSA_ERROR_INSUFFICIENT_MEMORY ? T_COSE_ERR_INSUFFICIENT_MEMORY : |
| 44 | -- err == PSA_ERROR_TAMPERING_DETECTED ? T_COSE_ERR_TAMPERING_DETECTED : |
| 45 | -+ err == PSA_ERROR_CORRUPTION_DETECTED ? T_COSE_ERR_TAMPERING_DETECTED : |
| 46 | - T_COSE_ERR_SIG_FAIL; |
| 47 | - } |
| 48 | - |
| 49 | -@@ -152,7 +152,7 @@ t_cose_crypto_pub_key_verify(int32_t cose_algorithm_id, |
| 50 | - * Crypto ceases providing backwards compatibility then this code |
| 51 | - * has to be changed to use psa_verify_hash(). |
| 52 | - */ |
| 53 | -- psa_result = psa_asymmetric_verify(verification_key_psa, |
| 54 | -+ psa_result = psa_verify_hash(verification_key_psa, |
| 55 | - psa_alg_id, |
| 56 | - hash_to_verify.ptr, |
| 57 | - hash_to_verify.len, |
| 58 | -@@ -212,7 +212,7 @@ t_cose_crypto_pub_key_sign(int32_t cose_algorithm_id, |
| 59 | - * providing backwards compatibility then this code has to be |
| 60 | - * changed to use psa_sign_hash(). |
| 61 | - */ |
| 62 | -- psa_result = psa_asymmetric_sign(signing_key_psa, |
| 63 | -+ psa_result = psa_sign_hash(signing_key_psa, |
| 64 | - psa_alg_id, |
| 65 | - hash_to_sign.ptr, |
| 66 | - hash_to_sign.len, |
| 67 | diff --git a/external/t_cose/t_cose.cmake b/external/t_cose/t_cose.cmake |
| 68 | index 660824bd..9321466f 100644 |
| 69 | --- a/external/t_cose/t_cose.cmake |
| 70 | +++ b/external/t_cose/t_cose.cmake |
| 71 | @@ -1,5 +1,5 @@ |
| 72 | #------------------------------------------------------------------------------- |
| 73 | -# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. |
| 74 | +# Copyright (c) 2021-2022, Arm Limited and Contributors. All rights reserved. |
| 75 | # |
| 76 | # SPDX-License-Identifier: BSD-3-Clause |
| 77 | # |
| 78 | @@ -16,7 +16,7 @@ endif() |
| 79 | |
| 80 | # External component details |
| 81 | set(T_COSE_URL "https://github.com/laurencelundblade/t_cose.git" CACHE STRING "t_cose repository URL") |
| 82 | -set(T_COSE_REFSPEC "master" CACHE STRING "t_cose git refspec") |
| 83 | +set(T_COSE_REFSPEC "fc3a4b2c7196ff582e8242de8bd4a1bc4eec577f" CACHE STRING "t_cose git refspec") |
| 84 | set(T_COSE_INSTALL_PATH "${CMAKE_CURRENT_BINARY_DIR}/t_cose_install" CACHE PATH "t_cose installation directory") |
| 85 | set(T_COSE_PACKAGE_PATH "${T_COSE_INSTALL_PATH}/libt_cose/cmake" CACHE PATH "t_cose CMake package directory") |
| 86 | |
| 87 | @@ -37,7 +37,6 @@ FetchContent_Declare( |
| 88 | |
| 89 | PATCH_COMMAND git stash |
| 90 | COMMAND git am ${CMAKE_CURRENT_LIST_DIR}/0001-add-install-definition.patch |
| 91 | - COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0002-add-tls3_0_0-compatibility.patch |
| 92 | COMMAND git reset HEAD~1 |
| 93 | |
| 94 | ) |