1 /*
2  * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef __TFM_ATTEST_IAT_DEFS_H__
9 #define __TFM_ATTEST_IAT_DEFS_H__
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 #include "config_tfm.h"
16 
17 #if ATTEST_TOKEN_PROFILE_PSA_IOT_1
18 
19 /* In case of the original PSA_IOT_PROFILE_1 */
20 #define IAT_ARM_RANGE_BASE                 (-75000)
21 #define IAT_PROFILE_DEFINITION             (IAT_ARM_RANGE_BASE - 0)
22 #define IAT_CLIENT_ID                      (IAT_ARM_RANGE_BASE - 1)
23 #define IAT_SECURITY_LIFECYCLE             (IAT_ARM_RANGE_BASE - 2)
24 #define IAT_IMPLEMENTATION_ID              (IAT_ARM_RANGE_BASE - 3)
25 #define IAT_BOOT_SEED                      (IAT_ARM_RANGE_BASE - 4)
26 #define IAT_CERTIFICATION_REFERENCE        (IAT_ARM_RANGE_BASE - 5)
27 #define IAT_SW_COMPONENTS                  (IAT_ARM_RANGE_BASE - 6)
28 #define IAT_NO_SW_COMPONENTS               (IAT_ARM_RANGE_BASE - 7)
29 #define IAT_NONCE                          (IAT_ARM_RANGE_BASE - 8)
30 #define IAT_INSTANCE_ID                    (IAT_ARM_RANGE_BASE - 9)
31 #define IAT_VERIFICATION_SERVICE           (IAT_ARM_RANGE_BASE - 10)
32 
33 /* Indicates that the boot status intentionally (i.e. the bootloader is not
34  * capable of producing it) does not contain any SW components' measurement.
35  * Required integer value for claim labeled IAT_NO_SW_COMPONENTS.
36  */
37 #define NO_SW_COMPONENT_FIXED_VALUE 1
38 
39 #elif ATTEST_TOKEN_PROFILE_PSA_2_0_0
40 
41 /* In case of PSA_2_0_0 (updated PSA profile ) */
42 #define IAT_NONCE                          10  /* EAT nonce */
43 #define IAT_INSTANCE_ID                    256 /* EAT ueid */
44 #define IAT_PROFILE_DEFINITION             265 /* EAT eat_profile */
45 #define IAT_ARM_RANGE_BASE                 (2393)
46 #define IAT_CLIENT_ID                      (IAT_ARM_RANGE_BASE + 1)
47 #define IAT_SECURITY_LIFECYCLE             (IAT_ARM_RANGE_BASE + 2)
48 #define IAT_IMPLEMENTATION_ID              (IAT_ARM_RANGE_BASE + 3)
49 #define IAT_BOOT_SEED                      (IAT_ARM_RANGE_BASE + 4)
50 #define IAT_CERTIFICATION_REFERENCE        (IAT_ARM_RANGE_BASE + 5)
51 #define IAT_SW_COMPONENTS                  (IAT_ARM_RANGE_BASE + 6)
52 #define IAT_VERIFICATION_SERVICE           (IAT_ARM_RANGE_BASE + 7)
53 
54 #elif ATTEST_TOKEN_PROFILE_ARM_CCA
55 
56 /* In case of  ARM_CCA profile */
57 #define IAT_NONCE                          10  /* EAT nonce*/
58 #define IAT_INSTANCE_ID                    256 /* EAT ueid */
59 #define IAT_PROFILE_DEFINITION             265 /* EAT eat_profile */
60 #define IAT_ARM_RANGE_BASE                 (2393)
61 #define IAT_CLIENT_ID                      (IAT_ARM_RANGE_BASE + 1)
62 #define IAT_SECURITY_LIFECYCLE             (IAT_ARM_RANGE_BASE + 2)
63 #define IAT_IMPLEMENTATION_ID              (IAT_ARM_RANGE_BASE + 3)
64 #define IAT_BOOT_SEED                      (IAT_ARM_RANGE_BASE + 4)
65 #define IAT_CERTIFICATION_REFERENCE        (IAT_ARM_RANGE_BASE + 5)
66 #define IAT_SW_COMPONENTS                  (IAT_ARM_RANGE_BASE + 6)
67 #define IAT_VERIFICATION_SERVICE           (IAT_ARM_RANGE_BASE + 7)
68 #define IAT_PLATFORM_CONFIG                (IAT_ARM_RANGE_BASE + 8)
69 #define IAT_PLATFORM_HASH_ALGO_ID          (IAT_ARM_RANGE_BASE + 9)
70 
71 #else
72 #error "Attestation token profile is incorrect"
73 #endif
74 
75 #define IAT_SW_COMPONENT_MEASUREMENT_TYPE  (1)
76 #define IAT_SW_COMPONENT_MEASUREMENT_VALUE (2)
77 /* Reserved                                (3) */
78 #define IAT_SW_COMPONENT_VERSION           (4)
79 #define IAT_SW_COMPONENT_SIGNER_ID         (5)
80 #define IAT_SW_COMPONENT_MEASUREMENT_DESC  (6)
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* __TFM_ATTEST_IAT_DEFS_H__ */
87