COSE: Switch over to upstream t_cose

Switch from TF-M's t_cose library fork to the upstream repo
being downloaded from https://github.com/laurencelundblade/t_cose.

Change-Id: I5e0f1cc6ef5b75decc9d1c9009142e87701703e2
Signed-off-by: David Vincze <david.vincze@arm.com>
diff --git a/partitions/delegated_attestation/delegated_attest.c b/partitions/delegated_attestation/delegated_attest.c
index 0021f58..4e13134 100644
--- a/partitions/delegated_attestation/delegated_attest.c
+++ b/partitions/delegated_attestation/delegated_attest.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022-2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2022-2025, Arm Limited. All rights reserved.
  * Copyright (c) 2018-2023, Laurence Lundblade.
  *
  * SPDX-License-Identifier: BSD-3-Clause
@@ -14,10 +14,10 @@
 #include "psa/crypto.h"
 #include "psa/initial_attestation.h"
 #include "qcbor/qcbor.h"
-#include "q_useful_buf.h"
 #include "region_defs.h"
-#include "t_cose_key.h"
-#include "t_cose_standard_constants.h"
+#include "t_cose/q_useful_buf.h"
+#include "t_cose/t_cose_key.h"
+#include "t_cose/t_cose_standard_constants.h"
 #include "tfm_attest_iat_defs.h"
 #include "tfm_crypto_defs.h"
 
@@ -76,8 +76,7 @@
     }
 
     /* Turns SEC1 encoding to a CBOR serialized COSE_Key object */
-    dak_key.crypto_lib = T_COSE_CRYPTO_LIB_PSA;
-    dak_key.k.key_handle = dak_key_id;
+    dak_key.key.handle = dak_key_id;
     cose_res = t_cose_key_encode(dak_key,
                                  cose_key_buf,
                                  &cose_key);
diff --git a/partitions/dice_protection_environment/dpe_certificate.c b/partitions/dice_protection_environment/dpe_certificate.c
index 94ca197..dcaf68e 100644
--- a/partitions/dice_protection_environment/dpe_certificate.c
+++ b/partitions/dice_protection_environment/dpe_certificate.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023-2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2023-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -12,9 +12,9 @@
 #include "dpe_crypto_interface.h"
 #include "dpe_plat.h"
 #include "qcbor/qcbor_encode.h"
-#include "t_cose_common.h"
-#include "t_cose_key.h"
-#include "t_cose_sign1_sign.h"
+#include "t_cose/t_cose_common.h"
+#include "t_cose/t_cose_key.h"
+#include "t_cose/t_cose_sign1_sign.h"
 
 #define ID_HEX_SIZE (2 * DICE_ID_SIZE)      /* Size of CDI encoded to ascii hex */
 #define LABEL_HEX_SIZE (2 * DPE_EXTERNAL_LABEL_MAX_SIZE)
@@ -64,8 +64,7 @@
     /* DPE Certificate is untagged COSE_Sign1 message */
     t_cose_sign1_sign_init(signer_ctx, T_COSE_OPT_OMIT_CBOR_TAG, DPE_T_COSE_ALG);
 
-    attest_key.crypto_lib = T_COSE_CRYPTO_LIB_PSA;
-    attest_key.k.key_handle = private_key;
+    attest_key.key.handle = private_key;
 
     t_cose_sign1_set_signing_key(signer_ctx, attest_key, attest_key_id);
 
@@ -166,8 +165,7 @@
     enum t_cose_err_t cose_res;
 
     /* Export the public key and encodes it to be a COSE_Key object */
-    attest_key.crypto_lib = T_COSE_CRYPTO_LIB_PSA;
-    attest_key.k.key_handle = attest_key_id;
+    attest_key.key.handle = attest_key_id;
     cose_res = t_cose_key_encode(attest_key,
                                  cose_key_buf,
                                  &cose_key);
diff --git a/partitions/dice_protection_environment/dpe_crypto_config.h b/partitions/dice_protection_environment/dpe_crypto_config.h
index 86ab93f..c038e6e 100644
--- a/partitions/dice_protection_environment/dpe_crypto_config.h
+++ b/partitions/dice_protection_environment/dpe_crypto_config.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023, Arm Limited. All rights reserved.
+ * Copyright (c) 2023-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -9,7 +9,7 @@
 #define __DPE_CRYPTO_CONFIG_H__
 
 #include "psa/crypto.h"
-#include "t_cose_common.h"
+#include "t_cose/t_cose_common.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/partitions/dice_protection_environment/test/dpe_certificate_decode.c b/partitions/dice_protection_environment/test/dpe_certificate_decode.c
index e13be37..0be2378 100644
--- a/partitions/dice_protection_environment/test/dpe_certificate_decode.c
+++ b/partitions/dice_protection_environment/test/dpe_certificate_decode.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -14,9 +14,9 @@
 #include "psa/error.h"
 #include "qcbor/qcbor_decode.h"
 #include "qcbor/qcbor_spiffy_decode.h"
-#include "t_cose_common.h"
-#include "t_cose_key.h"
-#include "t_cose_sign1_verify.h"
+#include "t_cose/t_cose_common.h"
+#include "t_cose/t_cose_key.h"
+#include "t_cose/t_cose_sign1_verify.h"
 #include "test_log.h"
 
 /* Uncomment this define to print the certificate chain */
@@ -278,7 +278,7 @@
     /* If the corresponding public key is not known then only verify the
      * certificate's structure.
      */
-    if (pub_key_id.k.key_handle != PSA_KEY_ID_NULL ) {
+    if (pub_key_id.key.handle != PSA_KEY_ID_NULL ) {
         cose_err = verify_signature(cert_buf, pub_key_id);
         if (cose_err != T_COSE_SUCCESS) {
             return -2;
@@ -293,7 +293,7 @@
 {
     psa_status_t psa_err;
 
-    psa_err = psa_destroy_key(pub_key_id.k.key_handle);
+    psa_err = psa_destroy_key(pub_key_id.key.handle);
     if (psa_err != PSA_SUCCESS) {
         return -3;
     }
@@ -345,8 +345,7 @@
     cert_chain->cert_cnt--;
 
     /* Decode the COSE_Key and register the public key to the crypto backend */
-    pub_key_id.crypto_lib = T_COSE_CRYPTO_LIB_PSA;
-    pub_key_id.k.key_handle = PSA_KEY_ID_NULL;
+    pub_key_id.key.handle = PSA_KEY_ID_NULL;
     cose_err = t_cose_key_decode(cert_chain->root_pub_key, &pub_key_id);
     if (cose_err != T_COSE_SUCCESS) {
         return -2;
diff --git a/partitions/dice_protection_environment/test/dpe_certificate_decode.h b/partitions/dice_protection_environment/test/dpe_certificate_decode.h
index e7bdbe5..eb740dc 100644
--- a/partitions/dice_protection_environment/test/dpe_certificate_decode.h
+++ b/partitions/dice_protection_environment/test/dpe_certificate_decode.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -11,7 +11,7 @@
 #include <stdbool.h>
 
 #include "qcbor/UsefulBuf.h"
-#include "t_cose_key.h"
+#include "t_cose/t_cose_key.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/partitions/dice_protection_environment/test/dpe_certify_key_test.c b/partitions/dice_protection_environment/test/dpe_certify_key_test.c
index 71cf648..5322d2b 100644
--- a/partitions/dice_protection_environment/test/dpe_certify_key_test.c
+++ b/partitions/dice_protection_environment/test/dpe_certify_key_test.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023-2024, Arm Limited. All rights reserved.
+ * Copyright (c) 2023-2025, Arm Limited. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  *
@@ -12,7 +12,7 @@
 #include "dpe_test_common.h"
 #include "dpe_test_data.h"
 #include "dpe_test_private.h"
-#include "t_cose_key.h"
+#include "t_cose/t_cose_key.h"
 
 extern const struct dpe_test_data_t test_data[];
 extern int retained_rot_ctx_handle;