aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBalint Matyi <Balint.Matyi@arm.com>2020-04-16 15:02:28 +0100
committerTamas Ban <tamas.ban@arm.com>2020-05-08 12:59:40 +0000
commitb3b01cca3572ceaeeb5c7c3d9b4889c83e7e1dd7 (patch)
treec3eeae00c09801188aead92c8e0db4053aa02627 /test
parent8d1f10735fee0d82cd9502c35eb599800d520e86 (diff)
downloadtrusted-firmware-m-b3b01cca3572ceaeeb5c7c3d9b4889c83e7e1dd7.tar.gz
Test: Verify Client-ID range in attest token
Test if the client is S or NS by the ARM_FEATURE_CMSE macro and based on this, verify the Client-ID range. Change-Id: I32baaf1cdc7927f47d423ada4dc3ea77d670057e Signed-off-by: Balint Matyi <Balint.Matyi@arm.com>
Diffstat (limited to 'test')
-rw-r--r--test/suites/attestation/attest_token_test.c12
-rw-r--r--test/suites/attestation/attest_token_test_values.h4
2 files changed, 10 insertions, 6 deletions
diff --git a/test/suites/attestation/attest_token_test.c b/test/suites/attestation/attest_token_test.c
index c6495e05f9..b6736c528b 100644
--- a/test/suites/attestation/attest_token_test.c
+++ b/test/suites/attestation/attest_token_test.c
@@ -271,7 +271,6 @@ static int_fast16_t check_simple_claims(
return_value = 0;
-
/* -- check value of the nonce claim -- */
if(!IS_ITEM_FLAG_SET(NONCE_FLAG, simple_claims->item_flags)) {
/* Claim is not present in token */
@@ -425,9 +424,14 @@ static int_fast16_t check_simple_claims(
/* Don't have to check if its presence is required */
if(TOKEN_TEST_VALUE_CLIENT_ID != INT32_MAX &&
simple_claims->client_id != TOKEN_TEST_VALUE_CLIENT_ID) {
- /* Check of its value was requested and failed */
- return_value = -63;
- goto Done;
+ /* Check the value range */
+ if(((__ARM_FEATURE_CMSE == 3U) &&
+ (simple_claims->client_id < 1)) ||
+ ((__ARM_FEATURE_CMSE != 3U) &&
+ (simple_claims->client_id > -1))) {
+ return_value = -63;
+ goto Done;
+ }
}
}
diff --git a/test/suites/attestation/attest_token_test_values.h b/test/suites/attestation/attest_token_test_values.h
index 122855a72f..b3ad0d9b15 100644
--- a/test/suites/attestation/attest_token_test_values.h
+++ b/test/suites/attestation/attest_token_test_values.h
@@ -2,7 +2,7 @@
* attest_token_test_values.h
*
* Copyright (c) 2019, Laurence Lundblade.
- * Copyright (c) 2019, Arm Limited.
+ * Copyright (c) 2019-2020, Arm Limited.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -150,7 +150,7 @@
#define TOKEN_TEST_REQUIRE_SECURITY_LIFECYCLE true /* Mandatory claim */
/* An integer (can be positive or negative */
-#define TOKEN_TEST_VALUE_CLIENT_ID INT32_MAX /* Value not checked */
+#define TOKEN_TEST_VALUE_CLIENT_ID 0 /* invalid value to trigger check */
#define TOKEN_TEST_REQUIRE_CLIENT_ID true /* Mandatory claim */
/* Text string naming the profile definition: