![]() |
TF-M Reference Manual
1.2.0
TrustedFirmware-M
|
Expected values for test suite. More...
Go to the source code of this file.
Expected values for test suite.
This is a bunch of made up values for hard-coded test cases for attestation tokens.
There are four possible test configurations for testing each claim:
TOKEN_TEST_REQUIRE_XXX
is false and TOKEN_TEST_VALUE_XXX is not given.TOKEN_TEST_REQUIRE_XXX
is true and TOKEN_TEST_VALUE_XXX is not given.TOKEN_TEST_REQUIRE_XXX
is false and TOKEN_TEST_VALUE_XXX
is given.TOKEN_TEST_REQUIRE_XXX
is true and TOKEN_TEST_VALUE_XXX
is given.TOKEN_TEST_VALUE_XXX is not given as follows:
NULL
NULL_Q_USEFUL_BUF_C
INT32_MAX
It is assumed that the expected value for any test will never be any of these.
Individual test can also be made to return values that are not fixed at compile time by defining them to be a function and implementing the funciton. Here are examples for the three types:
struct q_useful_buf_c get_expected_nonce(void); #define TOKEN_TEST_VALUE_NONCE get_expected_nonce() const char *get_expected_hw_version(void); #define TOKEN_TEST_VALUE_HW_VERSION get_expected_hw_version() uint32_t get_expected_client_id(void); #define TOKEN_TEST_VALUE_CLIENT_ID get_expected_client_id()
The initialization value for byte strings uses a compound literal to create the ptr
and len
for a struct
q_useful_buf_c
. They are a bit ugly, but they work and setting up this way allows the literal value to be replaced by a function call for dynamic expected values.
The first part of the compound literal is the value of the bytes. The second is an integer that is the length, the number of bytes. They length must be the number of bytes in the first.
Definition in file attest_token_test_values.h.
#define ATTEST_TOKEN_MAX_SIZE 0x250 |
Definition at line 315 of file attest_token_test_values.h.
#define TOKEN_TEST_NONCE_BYTES |
Definition at line 73 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_BOOT_SEED true /* Mandatory claim */ |
Definition at line 176 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_CLIENT_ID true /* Mandatory claim */ |
Definition at line 185 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_HW_VERSION false /* Optional claim */ |
Definition at line 177 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_IMPLEMENTATION_ID true /* Mandatory claim */ |
Definition at line 178 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_NONCE true /* Mandatory claim */ |
Definition at line 87 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_ORIGINATION false /* Optional field */ |
Definition at line 180 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_PROFILE_DEFINITION false /* Optional field */ |
Definition at line 179 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SECURITY_LIFECYCLE true /* Mandatory claim */ |
Definition at line 181 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC1_MEASUREMENT_DESC false /* Optional field */ |
Definition at line 260 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC1_MEASUREMENT_TYPE false /* Optional field */ |
Definition at line 213 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC1_MEASUREMENT_VAL true /* Mandatory field */ |
Definition at line 229 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC1_SIGNER_ID true /* Mandatory field */ |
Definition at line 256 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC1_VERSION true /* Mandatory field */ |
Definition at line 237 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC2_MEASUREMENT_DESC false /* Optional field */ |
Definition at line 310 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC2_MEASUREMENT_TYPE false /* Optional field */ |
Definition at line 264 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC2_MEASUREMENT_VAL true /* Mandatory field */ |
Definition at line 280 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC2_SIGNER_ID true /* Mandatory field */ |
Definition at line 306 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_SWC2_VERSION true /* Mandatory field */ |
Definition at line 287 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRE_UEID true /* Mandatory claim */ |
Definition at line 108 of file attest_token_test_values.h.
#define TOKEN_TEST_REQUIRED_NUM_SWC 0 |
TOKEN_TEST_REQUIRED_NUM_SWC
can be either 0, 1, 2 or INT32_MAX
0 – No SW components are required, but if there is 1, its values must compare to SWC1 correctly and if there are 2, the first must compare to SWC1 and the second to SWC2.
1 – At least one SW component is required and it must compare correctly to SWC1. If a second one is present its values will also be checked.
2 – Two SW components are required and their values must compare correctly.
INT32_MAX – No checking of the SW components of any sort is performed.
Note that attest_token_decode() checks for the presence of the the EAT_CBOR_ARM_LABEL_NO_SW_COMPONENTS CBOR data item for the case of no SW components and gives an error if it is absent.
Definition at line 209 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_BOOT_SEED NULL_Q_USEFUL_BUF_C |
Definition at line 167 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_CLIENT_ID 0 /* Invalid value to trigger check */ |
Definition at line 184 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_HW_VERSION NULL |
Definition at line 168 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_IMPLEMENTATION_ID NULL_Q_USEFUL_BUF_C |
Definition at line 169 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_NONCE |
Definition at line 82 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_ORIGINATION NULL |
Definition at line 171 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_PROFILE_DEFINITION NULL |
Definition at line 170 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SECURITY_LIFECYCLE INT32_MAX |
Definition at line 172 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC1_MEASUREMENT_DESC "SHA256" /* Hard-coded value */ |
Definition at line 259 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC1_MEASUREMENT_TYPE NULL /* Value not checked */ |
Definition at line 212 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC1_MEASUREMENT_VAL NULL_Q_USEFUL_BUF_C |
Definition at line 216 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC1_SIGNER_ID NULL_Q_USEFUL_BUF_C |
Definition at line 240 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC1_VERSION NULL /* Value not checked */ |
Definition at line 233 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC2_MEASUREMENT_DESC "SHA256" /* Hard-coded value */ |
Definition at line 309 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC2_MEASUREMENT_TYPE NULL /* Value not checked */ |
Definition at line 263 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC2_MEASUREMENT_VAL NULL_Q_USEFUL_BUF_C |
Definition at line 267 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC2_SIGNER_ID NULL_Q_USEFUL_BUF_C |
Definition at line 290 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_SWC2_VERSION NULL /* Value not checked */ |
Definition at line 283 of file attest_token_test_values.h.
#define TOKEN_TEST_VALUE_UEID NULL_Q_USEFUL_BUF_C |
Definition at line 90 of file attest_token_test_values.h.