1 /* 2 * Copyright (c) 2023, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __PROVISIONING_BUNDLE_H__ 9 #define __PROVISIONING_BUNDLE_H__ 10 11 #include "stdint.h" 12 #include "region_defs.h" 13 #include "cmsis_compiler.h" 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 #define BUNDLE_MAGIC 0xC0DEFEED 20 21 __PACKED_STRUCT tfm_assembly_and_test_provisioning_data_t { 22 uint8_t huk[32]; 23 }; 24 25 __PACKED_STRUCT tfm_psa_rot_provisioning_data_t { 26 uint8_t iak[32]; 27 uint32_t iak_len; 28 uint32_t iak_type; 29 #if ATTEST_INCLUDE_COSE_KEY_ID 30 uint8_t iak_id[32]; 31 #endif /* ATTEST_INCLUDE_COSE_KEY_ID */ 32 33 uint8_t boot_seed[32]; 34 uint8_t implementation_id[32]; 35 uint8_t cert_ref[32]; 36 uint8_t verification_service_url[32]; 37 uint8_t profile_definition[32]; 38 39 uint8_t entropy_seed[64]; 40 }; 41 42 __PACKED_STRUCT bl2_assembly_and_test_provisioning_data_t { 43 uint8_t bl2_rotpk_0[32]; 44 uint8_t bl2_rotpk_1[32]; 45 #if (MCUBOOT_IMAGE_NUMBER > 2) 46 uint8_t bl2_rotpk_2[32]; 47 #endif 48 #if (MCUBOOT_IMAGE_NUMBER > 3) 49 uint8_t bl2_rotpk_3[32]; 50 #endif 51 52 #ifdef PLATFORM_PSA_ADAC_SECURE_DEBUG 53 uint8_t secure_debug_pk[32]; 54 #endif /* PLATFORM_PSA_ADAC_SECURE_DEBUG */ 55 }; 56 57 __PACKED_STRUCT provisioning_data_t { 58 const struct bl2_assembly_and_test_provisioning_data_t bl2_assembly_and_test_prov_data; 59 const struct tfm_assembly_and_test_provisioning_data_t assembly_and_test_prov_data; 60 const struct tfm_psa_rot_provisioning_data_t psa_rot_prov_data; 61 }; 62 63 struct __attribute__((__packed__)) provisioning_bundle { 64 /* This section is authenticated */ 65 uint32_t magic; 66 /* This section is encrypted */ 67 uint8_t code[PROVISIONING_BUNDLE_CODE_SIZE]; 68 union __attribute__((__packed__)) { 69 const struct provisioning_data_t values; 70 const uint8_t _pad[PROVISIONING_BUNDLE_VALUES_SIZE]; 71 }; 72 uint8_t data[PROVISIONING_BUNDLE_DATA_SIZE]; 73 /* This section is metadata */ 74 uint8_t tag[16]; 75 uint32_t magic2; 76 }; 77 78 #ifdef __cplusplus 79 } 80 #endif 81 82 #endif /* __PROVISIONING_BUNDLE_H__ */ 83