Test: Remove initial attestation get public key API function
Remove the get public key interface to align with the change in TF-M.
Signed-off-by: David Hu <david.hu@arm.com>
Change-Id: I7534afb8f306c817a41cf8a34d86ebbfa9145d7c
diff --git a/test/suites/attestation/attest_public_key.c b/test/suites/attestation/attest_public_key.c
index c7dd3d5..f942308 100644
--- a/test/suites/attestation/attest_public_key.c
+++ b/test/suites/attestation/attest_public_key.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -18,14 +18,9 @@
*/
#define ECC_CURVE_SECP256R1_PUBLIC_KEY_LENGTH (1 + 2 * PSA_BITS_TO_BYTES(256))
-/*!
- * Byte string representation of ECC public key according to
- * psa_export_public_key() in interface/include/psa/crypto.h
- */
-struct ecc_public_key_t {
- const uint8_t a;
- uint8_t public_key[]; /* X-coordinate || Y-coordinate */
-};
+extern const psa_ecc_family_t initial_attest_curve_type;
+extern const uint8_t initial_attest_pub_key[];
+extern const uint32_t initial_attest_pub_key_size;
/*!
* \var public_key_registered
@@ -40,32 +35,30 @@
{
psa_status_t res;
psa_key_attributes_t key_attributes = psa_key_attributes_init();
- uint8_t public_key_buff[ECC_CURVE_SECP256R1_PUBLIC_KEY_LENGTH] = {0};
- size_t public_key_len;
- psa_ecc_family_t ecc_curve;
/* Public key should be unregistered at this point */
if (public_key_registered != 0) {
return PSA_ATTEST_ERR_GENERAL;
}
- res = tfm_initial_attest_get_public_key(public_key_buff,
- sizeof(public_key_buff),
- &public_key_len,
- &ecc_curve);
- if (res != PSA_SUCCESS) {
+ if (initial_attest_curve_type != PSA_ECC_CURVE_SECP256R1) {
+ return PSA_ATTEST_ERR_GENERAL;
+ }
+
+ if (initial_attest_pub_key_size != ECC_CURVE_SECP256R1_PUBLIC_KEY_LENGTH) {
return PSA_ATTEST_ERR_GENERAL;
}
/* Setup the key usage flags, algorithm and key type for public key */
psa_set_key_usage_flags(&key_attributes, PSA_KEY_USAGE_VERIFY);
psa_set_key_algorithm(&key_attributes, PSA_ALG_ECDSA(PSA_ALG_SHA_256));
- psa_set_key_type(&key_attributes, PSA_KEY_TYPE_ECC_PUBLIC_KEY(ecc_curve));
+ psa_set_key_type(&key_attributes,
+ PSA_KEY_TYPE_ECC_PUBLIC_KEY(initial_attest_curve_type));
/* Register public key to Crypto service */
res = psa_import_key(&key_attributes,
- (const uint8_t *)&public_key_buff,
- public_key_len,
+ (const uint8_t *)initial_attest_pub_key,
+ initial_attest_pub_key_size,
public_key);
if (res != PSA_SUCCESS) {
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.yaml b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.yaml
index c5e549f..3749ff4 100644
--- a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.yaml
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.yaml
@@ -50,7 +50,6 @@
"TFM_ITS_REMOVE",
"TFM_ATTEST_GET_TOKEN",
"TFM_ATTEST_GET_TOKEN_SIZE",
- "TFM_ATTEST_GET_PUBLIC_KEY",
"TFM_PS_TEST_PREPARE",
"TFM_SP_PLATFORM_SYSTEM_RESET",
"TFM_SP_PLATFORM_IOCTL",