aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTamas Ban <tamas.ban@arm.com>2020-01-15 13:29:25 +0000
committerTamas Ban <tamas.ban@arm.com>2020-01-23 13:33:03 +0000
commitabea89dd47fcc8a964559628b80607f9fa44a97c (patch)
tree50c9d23f0f50e21b5558131d7d651621740e1812 /test
parente66b2316c9ae4eeed24943f4c050acb5d0a95a7f (diff)
downloadtrusted-firmware-m-abea89dd47fcc8a964559628b80607f9fa44a97c.tar.gz
Attest: Refine compile time build options
To have more granular config options for attestation separate the test code and COSE key-id inclusion to be dependent on different compile time options. Change-Id: I351ce445f7beacf3378bbec4f740923bcd352f90 Signed-off-by: Tamas Ban <tamas.ban@arm.com>
Diffstat (limited to 'test')
-rw-r--r--test/suites/attestation/CMakeLists.inc10
-rw-r--r--test/suites/attestation/attest_token_test.c5
-rw-r--r--test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c10
-rw-r--r--test/suites/attestation/secure/attestation_s_interface_testsuite.c10
4 files changed, 18 insertions, 17 deletions
diff --git a/test/suites/attestation/CMakeLists.inc b/test/suites/attestation/CMakeLists.inc
index 38c0eb1df0..2eb344f3a7 100644
--- a/test/suites/attestation/CMakeLists.inc
+++ b/test/suites/attestation/CMakeLists.inc
@@ -24,8 +24,8 @@ if(NOT DEFINED TFM_ROOT_DIR)
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
-if (NOT DEFINED ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID is undefined. ")
+if (NOT DEFINED ATTEST_INCLUDE_TEST_CODE)
+ message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_TEST_CODE is undefined. ")
endif()
if (NOT DEFINED ENABLE_ATTESTATION_SERVICE_TESTS)
@@ -47,9 +47,9 @@ elseif(ENABLE_ATTESTATION_SERVICE_TESTS)
"${TFM_ROOT_DIR}/lib/ext/qcbor/util/qcbor_util.c"
)
- if (ATTEST_INCLUDE_TEST_CODE_AND_KEY_ID)
- set_property(SOURCE ${ATTEST_TEST_SRC_S} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE_AND_KEY_ID)
- set_property(SOURCE ${ATTEST_TEST_SRC_NS} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE_AND_KEY_ID)
+ if (ATTEST_INCLUDE_TEST_CODE)
+ set_property(SOURCE ${ATTEST_TEST_SRC_S} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE)
+ set_property(SOURCE ${ATTEST_TEST_SRC_NS} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE)
endif()
#Setting include directories
diff --git a/test/suites/attestation/attest_token_test.c b/test/suites/attestation/attest_token_test.c
index dd0db4ba13..847f3e184c 100644
--- a/test/suites/attestation/attest_token_test.c
+++ b/test/suites/attestation/attest_token_test.c
@@ -2,6 +2,7 @@
* attest_token_test.c
*
* Copyright (c) 2018-2019, Laurence Lundblade.
+ * Copyright (c) 2020, Arm Limited.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -79,7 +80,7 @@ int token_main_alt(uint32_t option_flags,
return return_value;
}
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
/**
* This is the expected output for the minimal test. It is the result
* of creating a token with \ref TOKEN_OPT_SHORT_CIRCUIT_SIGN and \ref
@@ -230,7 +231,7 @@ int_fast16_t buffer_too_small_test()
return return_value;
}
-#endif /* INCLUDE_TEST_CODE_AND_KEY_ID */
+#endif /* INCLUDE_TEST_CODE */
/**
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 3d78532ccd..fae87ac374 100644
--- a/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c
+++ b/test/suites/attestation/non_secure/attestation_ns_interface_testsuite.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -18,7 +18,7 @@ static const uint8_t challenge_buffer[TEST_CHALLENGE_OBJ_SIZE] = {
/* Define test suite for attestation service tests */
/* List of tests */
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
static void tfm_attest_test_2001(struct test_result_t *ret);
static void tfm_attest_test_2002(struct test_result_t *ret);
static void tfm_attest_test_2003(struct test_result_t *ret);
@@ -27,7 +27,7 @@ static void tfm_attest_test_2004(struct test_result_t *ret);
static void tfm_attest_test_2005(struct test_result_t *ret);
static struct test_t attestation_interface_tests[] = {
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
{&tfm_attest_test_2001, "TFM_ATTEST_TEST_2001",
"Minimal token test of attest token", {0} },
{&tfm_attest_test_2002, "TFM_ATTEST_TEST_2002",
@@ -54,7 +54,7 @@ register_testsuite_ns_attestation_interface(struct test_suite_t *p_test_suite)
attestation_interface_tests, list_size, p_test_suite);
}
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
/*!
* \brief Get minimal token, only include a hard coded challenge, but omit the
* rest of the claims
@@ -115,7 +115,7 @@ static void tfm_attest_test_2003(struct test_result_t *ret)
ret->val = TEST_PASSED;
}
-#endif /* INCLUDE_TEST_CODE_AND_KEY_ID */
+#endif /* INCLUDE_TEST_CODE */
/*!
* \brief Get an IAT with proper ECDSA signature. Parse the token, validate
diff --git a/test/suites/attestation/secure/attestation_s_interface_testsuite.c b/test/suites/attestation/secure/attestation_s_interface_testsuite.c
index 2bd171cc27..9c911a3a68 100644
--- a/test/suites/attestation/secure/attestation_s_interface_testsuite.c
+++ b/test/suites/attestation/secure/attestation_s_interface_testsuite.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -18,7 +18,7 @@ static const uint8_t challenge_buffer[TEST_CHALLENGE_OBJ_SIZE] = {
/* Define test suite for attestation service tests */
/* List of tests */
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
static void tfm_attest_test_1001(struct test_result_t *ret);
static void tfm_attest_test_1002(struct test_result_t *ret);
static void tfm_attest_test_1003(struct test_result_t *ret);
@@ -27,7 +27,7 @@ static void tfm_attest_test_1004(struct test_result_t *ret);
static void tfm_attest_test_1005(struct test_result_t *ret);
static struct test_t attestation_interface_tests[] = {
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
{&tfm_attest_test_1001, "TFM_ATTEST_TEST_1001",
"Minimal token test of attest token", {0} },
{&tfm_attest_test_1002, "TFM_ATTEST_TEST_1002",
@@ -54,7 +54,7 @@ register_testsuite_s_attestation_interface(struct test_suite_t *p_test_suite)
attestation_interface_tests, list_size, p_test_suite);
}
-#ifdef INCLUDE_TEST_CODE_AND_KEY_ID /* Remove them from release build */
+#ifdef INCLUDE_TEST_CODE /* Remove them from release build */
/*!
* \brief Get minimal token, only include a hard coded challenge, but omit the
* rest of the claims
@@ -115,7 +115,7 @@ static void tfm_attest_test_1003(struct test_result_t *ret)
ret->val = TEST_PASSED;
}
-#endif /* INCLUDE_TEST_CODE_AND_KEY_ID */
+#endif /* INCLUDE_TEST_CODE */
/*!
* \brief Get an IAT with proper ECDSA signature. Parse the token, validate