aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRaef Coles <raef.coles@arm.com>2019-10-09 10:59:42 +0100
committerTamas Ban <tamas.ban@arm.com>2020-02-19 09:17:40 +0000
commit793574c4f6bf42cbaad8b86a4122ab8e0f9d1714 (patch)
tree66d24bc360b5a21509d2389e95bcb4ab94ab9172 /test
parentd9d1920e492938157add208c696638db95479883 (diff)
downloadtrusted-firmware-m-793574c4f6bf42cbaad8b86a4122ab8e0f9d1714.tar.gz
Attest: Introduce PSA error codes
This change addresses the compliance with PSA initial attestation API 1.0.0 version. It replaces the existing psa_attest_err_t enum values with the error codes that are detailed in the interface/include/psa/error.h file. Change-Id: I1795331e7081589371c82f0e56655db6a543edd3 Signed-off-by: Sverteczky, Marcell <marcell.sverteczky@arm.com> Signed-off-by: Raef Coles <raef.coles@arm.com>
Diffstat (limited to 'test')
-rw-r--r--test/suites/attestation/attest_public_key.c5
-rw-r--r--test/suites/attestation/attest_token_decode.c2
-rw-r--r--test/suites/attestation/attest_token_test.c11
-rw-r--r--test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c6
-rw-r--r--test/suites/attestation/secure/attestation_s_interface_testsuite.c6
5 files changed, 17 insertions, 13 deletions
diff --git a/test/suites/attestation/attest_public_key.c b/test/suites/attestation/attest_public_key.c
index 5cb645f115..f2ecc7e8d6 100644
--- a/test/suites/attestation/attest_public_key.c
+++ b/test/suites/attestation/attest_public_key.c
@@ -1,15 +1,14 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include "attest_public_key.h"
-#include "psa/initial_attestation.h"
#include "psa/crypto.h"
-#include "psa/crypto_types.h"
#include <stdint.h>
+#include "attestation.h"
/*!
* \def ECC_CURVE_SECP256R1_PULBIC_KEY_LENGTH
diff --git a/test/suites/attestation/attest_token_decode.c b/test/suites/attestation/attest_token_decode.c
index ccd21dcd72..9bcf053c1c 100644
--- a/test/suites/attestation/attest_token_decode.c
+++ b/test/suites/attestation/attest_token_decode.c
@@ -15,7 +15,7 @@
#include "qcbor_util.h"
#include "psa/crypto.h"
#include "attest_public_key.h"
-
+#include "attestation.h"
/**
* \file attest_token_decode.c
diff --git a/test/suites/attestation/attest_token_test.c b/test/suites/attestation/attest_token_test.c
index a8caf9f990..6b0efd58af 100644
--- a/test/suites/attestation/attest_token_test.c
+++ b/test/suites/attestation/attest_token_test.c
@@ -14,6 +14,7 @@
#include "psa/initial_attestation.h"
#include "attest_token_decode.h"
#include "attest_token_test_values.h"
+#include "psa/crypto.h"
/**
@@ -45,7 +46,7 @@
* \param[out] completed_token Place to put pointer and length
* of completed token.
*
- * \return various errors. See \ref attest_token_err_t.
+ * \return various errors. See \ref psa_status_t.
*
*/
int token_main_alt(uint32_t option_flags,
@@ -53,7 +54,7 @@ int token_main_alt(uint32_t option_flags,
struct q_useful_buf buffer,
struct q_useful_buf_c *completed_token)
{
- int return_value;
+ psa_status_t return_value;
uint32_t completed_token_len;
struct q_useful_buf_c actual_nonce;
Q_USEFUL_BUF_MAKE_STACK_UB( actual_nonce_storage, 64);
@@ -77,7 +78,11 @@ int token_main_alt(uint32_t option_flags,
*completed_token = (struct q_useful_buf_c){buffer.ptr, completed_token_len};
- return return_value;
+ if (return_value != PSA_SUCCESS) {
+ return (int)return_value;
+ }
+
+ return 0;
}
#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
diff --git a/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c b/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c
index fae87ac374..cf3b28bfe6 100644
--- a/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c
+++ b/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c
@@ -150,7 +150,7 @@ static void tfm_attest_test_2004(struct test_result_t *ret)
*/
static void tfm_attest_test_2005(struct test_result_t *ret)
{
- enum psa_attest_err_t err;
+ psa_status_t err;
uint32_t token_size = TEST_TOKEN_SIZE;
/* Call with with bigger challenge object than allowed */
@@ -159,7 +159,7 @@ static void tfm_attest_test_2005(struct test_result_t *ret)
token_buffer,
&token_size);
- if (err != PSA_ATTEST_ERR_INVALID_INPUT) {
+ if (err != PSA_ERROR_INVALID_ARGUMENT) {
TEST_FAIL("Attestation should fail with too big challenge object");
return;
}
@@ -171,7 +171,7 @@ static void tfm_attest_test_2005(struct test_result_t *ret)
token_buffer,
&token_size);
- if (err != PSA_ATTEST_ERR_TOKEN_BUFFER_OVERFLOW) {
+ if (err != PSA_ERROR_BUFFER_TOO_SMALL) {
TEST_FAIL("Attestation should fail with too small token buffer");
return;
}
diff --git a/test/suites/attestation/secure/attestation_s_interface_testsuite.c b/test/suites/attestation/secure/attestation_s_interface_testsuite.c
index 9c911a3a68..7dec677a44 100644
--- a/test/suites/attestation/secure/attestation_s_interface_testsuite.c
+++ b/test/suites/attestation/secure/attestation_s_interface_testsuite.c
@@ -150,7 +150,7 @@ static void tfm_attest_test_1004(struct test_result_t *ret)
*/
static void tfm_attest_test_1005(struct test_result_t *ret)
{
- enum psa_attest_err_t err;
+ psa_status_t err;
uint32_t token_size = TEST_TOKEN_SIZE;
/* Call with with bigger challenge object than allowed */
@@ -159,7 +159,7 @@ static void tfm_attest_test_1005(struct test_result_t *ret)
token_buffer,
&token_size);
- if (err != PSA_ATTEST_ERR_INVALID_INPUT) {
+ if (err != PSA_ERROR_INVALID_ARGUMENT) {
TEST_FAIL("Attestation should fail with too big challenge object");
return;
}
@@ -171,7 +171,7 @@ static void tfm_attest_test_1005(struct test_result_t *ret)
token_buffer,
&token_size);
- if (err != PSA_ATTEST_ERR_TOKEN_BUFFER_OVERFLOW) {
+ if (err != PSA_ERROR_BUFFER_TOO_SMALL) {
TEST_FAIL("Attestation should fail with too small token buffer");
return;
}