Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 1 | /* |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 2 | * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved. |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Isla Mitchell | 9930501 | 2017-07-11 14:54:08 +0100 | [diff] [blame] | 7 | #include <stddef.h> |
| 8 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 9 | #include <platform_def.h> |
Justin Chadwell | f9b32c1 | 2019-07-29 17:13:10 +0100 | [diff] [blame] | 10 | #include <drivers/auth/mbedtls/mbedtls_config.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 11 | |
| 12 | #include <drivers/auth/auth_mod.h> |
Masahiro Yamada | a27c166 | 2017-05-22 12:11:24 +0900 | [diff] [blame] | 13 | #if USE_TBBR_DEFS |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 14 | #include <tools_share/tbbr_oid.h> |
Masahiro Yamada | a27c166 | 2017-05-22 12:11:24 +0900 | [diff] [blame] | 15 | #else |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 16 | #include <platform_oid.h> |
Masahiro Yamada | a27c166 | 2017-05-22 12:11:24 +0900 | [diff] [blame] | 17 | #endif |
Isla Mitchell | 9930501 | 2017-07-11 14:54:08 +0100 | [diff] [blame] | 18 | |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 19 | |
| 20 | /* |
| 21 | * Maximum key and hash sizes (in DER format) |
| 22 | */ |
Justin Chadwell | f9b32c1 | 2019-07-29 17:13:10 +0100 | [diff] [blame] | 23 | #if TF_MBEDTLS_USE_RSA |
| 24 | #if TF_MBEDTLS_KEY_SIZE == 1024 |
| 25 | #define PK_DER_LEN 162 |
| 26 | #elif TF_MBEDTLS_KEY_SIZE == 2048 |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 27 | #define PK_DER_LEN 294 |
Justin Chadwell | f9b32c1 | 2019-07-29 17:13:10 +0100 | [diff] [blame] | 28 | #elif TF_MBEDTLS_KEY_SIZE == 3072 |
| 29 | #define PK_DER_LEN 422 |
| 30 | #elif TF_MBEDTLS_KEY_SIZE == 4096 |
| 31 | #define PK_DER_LEN 550 |
| 32 | #else |
| 33 | #error "Invalid value for TF_MBEDTLS_KEY_SIZE" |
| 34 | #endif |
| 35 | #else |
| 36 | #define PK_DER_LEN 294 |
| 37 | #endif |
| 38 | |
Qixiang Xu | 1a1f291 | 2017-11-09 13:56:29 +0800 | [diff] [blame] | 39 | #define HASH_DER_LEN 83 |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 40 | |
| 41 | /* |
| 42 | * The platform must allocate buffers to store the authentication parameters |
| 43 | * extracted from the certificates. In this case, because of the way the CoT is |
| 44 | * established, we can reuse some of the buffers on different stages |
| 45 | */ |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 46 | |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 47 | static unsigned char tb_fw_hash_buf[HASH_DER_LEN]; |
Soby Mathew | 0bdfef0 | 2017-11-07 17:03:57 +0000 | [diff] [blame] | 48 | static unsigned char tb_fw_config_hash_buf[HASH_DER_LEN]; |
| 49 | static unsigned char hw_config_hash_buf[HASH_DER_LEN]; |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 50 | static unsigned char scp_fw_hash_buf[HASH_DER_LEN]; |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 51 | static unsigned char nt_world_bl_hash_buf[HASH_DER_LEN]; |
| 52 | |
| 53 | #ifdef IMAGE_BL2 |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 54 | static unsigned char soc_fw_hash_buf[HASH_DER_LEN]; |
| 55 | static unsigned char tos_fw_hash_buf[HASH_DER_LEN]; |
Summer Qin | 8072678 | 2017-04-20 16:28:39 +0100 | [diff] [blame] | 56 | static unsigned char tos_fw_extra1_hash_buf[HASH_DER_LEN]; |
| 57 | static unsigned char tos_fw_extra2_hash_buf[HASH_DER_LEN]; |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 58 | static unsigned char trusted_world_pk_buf[PK_DER_LEN]; |
| 59 | static unsigned char non_trusted_world_pk_buf[PK_DER_LEN]; |
| 60 | static unsigned char content_pk_buf[PK_DER_LEN]; |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 61 | static unsigned char soc_fw_config_hash_buf[HASH_DER_LEN]; |
| 62 | static unsigned char tos_fw_config_hash_buf[HASH_DER_LEN]; |
| 63 | static unsigned char nt_fw_config_hash_buf[HASH_DER_LEN]; |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 64 | #endif |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 65 | |
| 66 | /* |
| 67 | * Parameter type descriptors |
| 68 | */ |
Juan Castillo | bfb7fa6 | 2016-01-22 11:05:57 +0000 | [diff] [blame] | 69 | static auth_param_type_desc_t trusted_nv_ctr = AUTH_PARAM_TYPE_DESC( |
| 70 | AUTH_PARAM_NV_CTR, TRUSTED_FW_NVCOUNTER_OID); |
Juan Castillo | bfb7fa6 | 2016-01-22 11:05:57 +0000 | [diff] [blame] | 71 | |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 72 | static auth_param_type_desc_t subject_pk = AUTH_PARAM_TYPE_DESC( |
| 73 | AUTH_PARAM_PUB_KEY, 0); |
| 74 | static auth_param_type_desc_t sig = AUTH_PARAM_TYPE_DESC( |
| 75 | AUTH_PARAM_SIG, 0); |
| 76 | static auth_param_type_desc_t sig_alg = AUTH_PARAM_TYPE_DESC( |
| 77 | AUTH_PARAM_SIG_ALG, 0); |
| 78 | static auth_param_type_desc_t raw_data = AUTH_PARAM_TYPE_DESC( |
| 79 | AUTH_PARAM_RAW_DATA, 0); |
| 80 | |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 81 | |
| 82 | static auth_param_type_desc_t tb_fw_hash = AUTH_PARAM_TYPE_DESC( |
| 83 | AUTH_PARAM_HASH, TRUSTED_BOOT_FW_HASH_OID); |
| 84 | static auth_param_type_desc_t tb_fw_config_hash = AUTH_PARAM_TYPE_DESC( |
| 85 | AUTH_PARAM_HASH, TRUSTED_BOOT_FW_CONFIG_HASH_OID); |
| 86 | static auth_param_type_desc_t hw_config_hash = AUTH_PARAM_TYPE_DESC( |
| 87 | AUTH_PARAM_HASH, HW_CONFIG_HASH_OID); |
| 88 | #ifdef IMAGE_BL1 |
| 89 | static auth_param_type_desc_t scp_bl2u_hash = AUTH_PARAM_TYPE_DESC( |
| 90 | AUTH_PARAM_HASH, SCP_FWU_CFG_HASH_OID); |
| 91 | static auth_param_type_desc_t bl2u_hash = AUTH_PARAM_TYPE_DESC( |
| 92 | AUTH_PARAM_HASH, AP_FWU_CFG_HASH_OID); |
| 93 | static auth_param_type_desc_t ns_bl2u_hash = AUTH_PARAM_TYPE_DESC( |
| 94 | AUTH_PARAM_HASH, FWU_HASH_OID); |
| 95 | #endif /* IMAGE_BL1 */ |
| 96 | |
| 97 | #ifdef IMAGE_BL2 |
| 98 | static auth_param_type_desc_t non_trusted_nv_ctr = AUTH_PARAM_TYPE_DESC( |
| 99 | AUTH_PARAM_NV_CTR, NON_TRUSTED_FW_NVCOUNTER_OID); |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 100 | static auth_param_type_desc_t trusted_world_pk = AUTH_PARAM_TYPE_DESC( |
| 101 | AUTH_PARAM_PUB_KEY, TRUSTED_WORLD_PK_OID); |
| 102 | static auth_param_type_desc_t non_trusted_world_pk = AUTH_PARAM_TYPE_DESC( |
| 103 | AUTH_PARAM_PUB_KEY, NON_TRUSTED_WORLD_PK_OID); |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 104 | static auth_param_type_desc_t scp_fw_content_pk = AUTH_PARAM_TYPE_DESC( |
| 105 | AUTH_PARAM_PUB_KEY, SCP_FW_CONTENT_CERT_PK_OID); |
| 106 | static auth_param_type_desc_t soc_fw_content_pk = AUTH_PARAM_TYPE_DESC( |
| 107 | AUTH_PARAM_PUB_KEY, SOC_FW_CONTENT_CERT_PK_OID); |
| 108 | static auth_param_type_desc_t tos_fw_content_pk = AUTH_PARAM_TYPE_DESC( |
| 109 | AUTH_PARAM_PUB_KEY, TRUSTED_OS_FW_CONTENT_CERT_PK_OID); |
| 110 | static auth_param_type_desc_t nt_fw_content_pk = AUTH_PARAM_TYPE_DESC( |
| 111 | AUTH_PARAM_PUB_KEY, NON_TRUSTED_FW_CONTENT_CERT_PK_OID); |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 112 | static auth_param_type_desc_t scp_fw_hash = AUTH_PARAM_TYPE_DESC( |
| 113 | AUTH_PARAM_HASH, SCP_FW_HASH_OID); |
| 114 | static auth_param_type_desc_t soc_fw_hash = AUTH_PARAM_TYPE_DESC( |
| 115 | AUTH_PARAM_HASH, SOC_AP_FW_HASH_OID); |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 116 | static auth_param_type_desc_t soc_fw_config_hash = AUTH_PARAM_TYPE_DESC( |
| 117 | AUTH_PARAM_HASH, SOC_FW_CONFIG_HASH_OID); |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 118 | static auth_param_type_desc_t tos_fw_hash = AUTH_PARAM_TYPE_DESC( |
| 119 | AUTH_PARAM_HASH, TRUSTED_OS_FW_HASH_OID); |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 120 | static auth_param_type_desc_t tos_fw_config_hash = AUTH_PARAM_TYPE_DESC( |
| 121 | AUTH_PARAM_HASH, TRUSTED_OS_FW_CONFIG_HASH_OID); |
Summer Qin | 8072678 | 2017-04-20 16:28:39 +0100 | [diff] [blame] | 122 | static auth_param_type_desc_t tos_fw_extra1_hash = AUTH_PARAM_TYPE_DESC( |
| 123 | AUTH_PARAM_HASH, TRUSTED_OS_FW_EXTRA1_HASH_OID); |
| 124 | static auth_param_type_desc_t tos_fw_extra2_hash = AUTH_PARAM_TYPE_DESC( |
| 125 | AUTH_PARAM_HASH, TRUSTED_OS_FW_EXTRA2_HASH_OID); |
Juan Castillo | be80120 | 2015-12-03 10:19:21 +0000 | [diff] [blame] | 126 | static auth_param_type_desc_t nt_world_bl_hash = AUTH_PARAM_TYPE_DESC( |
| 127 | AUTH_PARAM_HASH, NON_TRUSTED_WORLD_BOOTLOADER_HASH_OID); |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 128 | static auth_param_type_desc_t nt_fw_config_hash = AUTH_PARAM_TYPE_DESC( |
| 129 | AUTH_PARAM_HASH, NON_TRUSTED_FW_CONFIG_HASH_OID); |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 130 | |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 131 | #endif /* IMAGE_BL2 */ |
| 132 | |
| 133 | |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 134 | /* |
| 135 | * BL2 |
| 136 | */ |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 137 | static const auth_img_desc_t trusted_boot_fw_cert = { |
| 138 | .img_id = TRUSTED_BOOT_FW_CERT_ID, |
| 139 | .img_type = IMG_CERT, |
| 140 | .parent = NULL, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 141 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 142 | [0] = { |
| 143 | .type = AUTH_METHOD_SIG, |
| 144 | .param.sig = { |
| 145 | .pk = &subject_pk, |
| 146 | .sig = &sig, |
| 147 | .alg = &sig_alg, |
| 148 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 149 | } |
| 150 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 151 | [1] = { |
| 152 | .type = AUTH_METHOD_NV_CTR, |
| 153 | .param.nv_ctr = { |
| 154 | .cert_nv_ctr = &trusted_nv_ctr, |
| 155 | .plat_nv_ctr = &trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 156 | } |
| 157 | } |
| 158 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 159 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 160 | [0] = { |
| 161 | .type_desc = &tb_fw_hash, |
| 162 | .data = { |
| 163 | .ptr = (void *)tb_fw_hash_buf, |
| 164 | .len = (unsigned int)HASH_DER_LEN |
| 165 | } |
| 166 | }, |
| 167 | [1] = { |
| 168 | .type_desc = &tb_fw_config_hash, |
| 169 | .data = { |
| 170 | .ptr = (void *)tb_fw_config_hash_buf, |
| 171 | .len = (unsigned int)HASH_DER_LEN |
| 172 | } |
| 173 | }, |
| 174 | [2] = { |
| 175 | .type_desc = &hw_config_hash, |
| 176 | .data = { |
| 177 | .ptr = (void *)hw_config_hash_buf, |
| 178 | .len = (unsigned int)HASH_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 179 | } |
| 180 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 181 | } |
| 182 | }; |
| 183 | #ifdef IMAGE_BL1 |
| 184 | static const auth_img_desc_t bl2_image = { |
| 185 | .img_id = BL2_IMAGE_ID, |
| 186 | .img_type = IMG_RAW, |
| 187 | .parent = &trusted_boot_fw_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 188 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 189 | [0] = { |
| 190 | .type = AUTH_METHOD_HASH, |
| 191 | .param.hash = { |
| 192 | .data = &raw_data, |
| 193 | .hash = &tb_fw_hash |
Soby Mathew | 0bdfef0 | 2017-11-07 17:03:57 +0000 | [diff] [blame] | 194 | } |
| 195 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 196 | } |
| 197 | }; |
| 198 | #endif /* IMAGE_BL1 */ |
| 199 | /* HW Config */ |
| 200 | static const auth_img_desc_t hw_config = { |
| 201 | .img_id = HW_CONFIG_ID, |
| 202 | .img_type = IMG_RAW, |
| 203 | .parent = &trusted_boot_fw_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 204 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 205 | [0] = { |
| 206 | .type = AUTH_METHOD_HASH, |
| 207 | .param.hash = { |
| 208 | .data = &raw_data, |
| 209 | .hash = &hw_config_hash |
Soby Mathew | 0bdfef0 | 2017-11-07 17:03:57 +0000 | [diff] [blame] | 210 | } |
| 211 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 212 | } |
| 213 | }; |
| 214 | /* TB FW Config */ |
| 215 | #ifdef IMAGE_BL1 |
| 216 | static const auth_img_desc_t tb_fw_config = { |
| 217 | .img_id = TB_FW_CONFIG_ID, |
| 218 | .img_type = IMG_RAW, |
| 219 | .parent = &trusted_boot_fw_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 220 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 221 | [0] = { |
| 222 | .type = AUTH_METHOD_HASH, |
| 223 | .param.hash = { |
| 224 | .data = &raw_data, |
| 225 | .hash = &tb_fw_config_hash |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | }; |
| 230 | #endif /* IMAGE_BL1 */ |
| 231 | #ifdef IMAGE_BL2 |
| 232 | /* |
| 233 | * Trusted key certificate |
| 234 | */ |
| 235 | static const auth_img_desc_t trusted_key_cert = { |
| 236 | .img_id = TRUSTED_KEY_CERT_ID, |
| 237 | .img_type = IMG_CERT, |
| 238 | .parent = NULL, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 239 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 240 | [0] = { |
| 241 | .type = AUTH_METHOD_SIG, |
| 242 | .param.sig = { |
| 243 | .pk = &subject_pk, |
| 244 | .sig = &sig, |
| 245 | .alg = &sig_alg, |
| 246 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 247 | } |
| 248 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 249 | [1] = { |
| 250 | .type = AUTH_METHOD_NV_CTR, |
| 251 | .param.nv_ctr = { |
| 252 | .cert_nv_ctr = &trusted_nv_ctr, |
| 253 | .plat_nv_ctr = &trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 254 | } |
| 255 | } |
| 256 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 257 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 258 | [0] = { |
| 259 | .type_desc = &trusted_world_pk, |
| 260 | .data = { |
| 261 | .ptr = (void *)trusted_world_pk_buf, |
| 262 | .len = (unsigned int)PK_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 263 | } |
| 264 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 265 | [1] = { |
| 266 | .type_desc = &non_trusted_world_pk, |
| 267 | .data = { |
| 268 | .ptr = (void *)non_trusted_world_pk_buf, |
| 269 | .len = (unsigned int)PK_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 270 | } |
| 271 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 272 | } |
| 273 | }; |
| 274 | /* |
| 275 | * SCP Firmware |
| 276 | */ |
| 277 | static const auth_img_desc_t scp_fw_key_cert = { |
| 278 | .img_id = SCP_FW_KEY_CERT_ID, |
| 279 | .img_type = IMG_CERT, |
| 280 | .parent = &trusted_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 281 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 282 | [0] = { |
| 283 | .type = AUTH_METHOD_SIG, |
| 284 | .param.sig = { |
| 285 | .pk = &trusted_world_pk, |
| 286 | .sig = &sig, |
| 287 | .alg = &sig_alg, |
| 288 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 289 | } |
| 290 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 291 | [1] = { |
| 292 | .type = AUTH_METHOD_NV_CTR, |
| 293 | .param.nv_ctr = { |
| 294 | .cert_nv_ctr = &trusted_nv_ctr, |
| 295 | .plat_nv_ctr = &trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 296 | } |
| 297 | } |
| 298 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 299 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 300 | [0] = { |
| 301 | .type_desc = &scp_fw_content_pk, |
| 302 | .data = { |
| 303 | .ptr = (void *)content_pk_buf, |
| 304 | .len = (unsigned int)PK_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 305 | } |
| 306 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 307 | } |
| 308 | }; |
| 309 | static const auth_img_desc_t scp_fw_content_cert = { |
| 310 | .img_id = SCP_FW_CONTENT_CERT_ID, |
| 311 | .img_type = IMG_CERT, |
| 312 | .parent = &scp_fw_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 313 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 314 | [0] = { |
| 315 | .type = AUTH_METHOD_SIG, |
| 316 | .param.sig = { |
| 317 | .pk = &scp_fw_content_pk, |
| 318 | .sig = &sig, |
| 319 | .alg = &sig_alg, |
| 320 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 321 | } |
| 322 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 323 | [1] = { |
| 324 | .type = AUTH_METHOD_NV_CTR, |
| 325 | .param.nv_ctr = { |
| 326 | .cert_nv_ctr = &trusted_nv_ctr, |
| 327 | .plat_nv_ctr = &trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 328 | } |
| 329 | } |
| 330 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 331 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 332 | [0] = { |
| 333 | .type_desc = &scp_fw_hash, |
| 334 | .data = { |
| 335 | .ptr = (void *)scp_fw_hash_buf, |
| 336 | .len = (unsigned int)HASH_DER_LEN |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | }; |
| 341 | static const auth_img_desc_t scp_bl2_image = { |
| 342 | .img_id = SCP_BL2_IMAGE_ID, |
| 343 | .img_type = IMG_RAW, |
| 344 | .parent = &scp_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 345 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 346 | [0] = { |
| 347 | .type = AUTH_METHOD_HASH, |
| 348 | .param.hash = { |
| 349 | .data = &raw_data, |
| 350 | .hash = &scp_fw_hash |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | }; |
| 355 | /* |
| 356 | * SoC Firmware |
| 357 | */ |
| 358 | static const auth_img_desc_t soc_fw_key_cert = { |
| 359 | .img_id = SOC_FW_KEY_CERT_ID, |
| 360 | .img_type = IMG_CERT, |
| 361 | .parent = &trusted_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 362 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 363 | [0] = { |
| 364 | .type = AUTH_METHOD_SIG, |
| 365 | .param.sig = { |
| 366 | .pk = &trusted_world_pk, |
| 367 | .sig = &sig, |
| 368 | .alg = &sig_alg, |
| 369 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 370 | } |
| 371 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 372 | [1] = { |
| 373 | .type = AUTH_METHOD_NV_CTR, |
| 374 | .param.nv_ctr = { |
| 375 | .cert_nv_ctr = &trusted_nv_ctr, |
| 376 | .plat_nv_ctr = &trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 377 | } |
| 378 | } |
| 379 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 380 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 381 | [0] = { |
| 382 | .type_desc = &soc_fw_content_pk, |
| 383 | .data = { |
| 384 | .ptr = (void *)content_pk_buf, |
| 385 | .len = (unsigned int)PK_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 386 | } |
| 387 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 388 | } |
| 389 | }; |
| 390 | static const auth_img_desc_t soc_fw_content_cert = { |
| 391 | .img_id = SOC_FW_CONTENT_CERT_ID, |
| 392 | .img_type = IMG_CERT, |
| 393 | .parent = &soc_fw_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 394 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 395 | [0] = { |
| 396 | .type = AUTH_METHOD_SIG, |
| 397 | .param.sig = { |
| 398 | .pk = &soc_fw_content_pk, |
| 399 | .sig = &sig, |
| 400 | .alg = &sig_alg, |
| 401 | .data = &raw_data |
| 402 | } |
| 403 | }, |
| 404 | [1] = { |
| 405 | .type = AUTH_METHOD_NV_CTR, |
| 406 | .param.nv_ctr = { |
| 407 | .cert_nv_ctr = &trusted_nv_ctr, |
| 408 | .plat_nv_ctr = &trusted_nv_ctr |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 409 | } |
| 410 | } |
| 411 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 412 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 413 | [0] = { |
| 414 | .type_desc = &soc_fw_hash, |
| 415 | .data = { |
| 416 | .ptr = (void *)soc_fw_hash_buf, |
| 417 | .len = (unsigned int)HASH_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 418 | } |
| 419 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 420 | [1] = { |
| 421 | .type_desc = &soc_fw_config_hash, |
| 422 | .data = { |
| 423 | .ptr = (void *)soc_fw_config_hash_buf, |
| 424 | .len = (unsigned int)HASH_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 425 | } |
| 426 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 427 | } |
| 428 | }; |
| 429 | static const auth_img_desc_t bl31_image = { |
| 430 | .img_id = BL31_IMAGE_ID, |
| 431 | .img_type = IMG_RAW, |
| 432 | .parent = &soc_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 433 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 434 | [0] = { |
| 435 | .type = AUTH_METHOD_HASH, |
| 436 | .param.hash = { |
| 437 | .data = &raw_data, |
| 438 | .hash = &soc_fw_hash |
| 439 | } |
| 440 | } |
| 441 | } |
| 442 | }; |
| 443 | /* SOC FW Config */ |
| 444 | static const auth_img_desc_t soc_fw_config = { |
| 445 | .img_id = SOC_FW_CONFIG_ID, |
| 446 | .img_type = IMG_RAW, |
| 447 | .parent = &soc_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 448 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 449 | [0] = { |
| 450 | .type = AUTH_METHOD_HASH, |
| 451 | .param.hash = { |
| 452 | .data = &raw_data, |
| 453 | .hash = &soc_fw_config_hash |
| 454 | } |
| 455 | } |
| 456 | } |
| 457 | }; |
| 458 | /* |
| 459 | * Trusted OS Firmware |
| 460 | */ |
| 461 | static const auth_img_desc_t trusted_os_fw_key_cert = { |
| 462 | .img_id = TRUSTED_OS_FW_KEY_CERT_ID, |
| 463 | .img_type = IMG_CERT, |
| 464 | .parent = &trusted_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 465 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 466 | [0] = { |
| 467 | .type = AUTH_METHOD_SIG, |
| 468 | .param.sig = { |
| 469 | .pk = &trusted_world_pk, |
| 470 | .sig = &sig, |
| 471 | .alg = &sig_alg, |
| 472 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 473 | } |
| 474 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 475 | [1] = { |
| 476 | .type = AUTH_METHOD_NV_CTR, |
| 477 | .param.nv_ctr = { |
| 478 | .cert_nv_ctr = &trusted_nv_ctr, |
| 479 | .plat_nv_ctr = &trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 480 | } |
| 481 | } |
| 482 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 483 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 484 | [0] = { |
| 485 | .type_desc = &tos_fw_content_pk, |
| 486 | .data = { |
| 487 | .ptr = (void *)content_pk_buf, |
| 488 | .len = (unsigned int)PK_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 489 | } |
| 490 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 491 | } |
| 492 | }; |
| 493 | static const auth_img_desc_t trusted_os_fw_content_cert = { |
| 494 | .img_id = TRUSTED_OS_FW_CONTENT_CERT_ID, |
| 495 | .img_type = IMG_CERT, |
| 496 | .parent = &trusted_os_fw_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 497 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 498 | [0] = { |
| 499 | .type = AUTH_METHOD_SIG, |
| 500 | .param.sig = { |
| 501 | .pk = &tos_fw_content_pk, |
| 502 | .sig = &sig, |
| 503 | .alg = &sig_alg, |
| 504 | .data = &raw_data |
| 505 | } |
| 506 | }, |
| 507 | [1] = { |
| 508 | .type = AUTH_METHOD_NV_CTR, |
| 509 | .param.nv_ctr = { |
| 510 | .cert_nv_ctr = &trusted_nv_ctr, |
| 511 | .plat_nv_ctr = &trusted_nv_ctr |
Summer Qin | 8072678 | 2017-04-20 16:28:39 +0100 | [diff] [blame] | 512 | } |
| 513 | } |
| 514 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 515 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 516 | [0] = { |
| 517 | .type_desc = &tos_fw_hash, |
| 518 | .data = { |
| 519 | .ptr = (void *)tos_fw_hash_buf, |
| 520 | .len = (unsigned int)HASH_DER_LEN |
| 521 | } |
| 522 | }, |
| 523 | [1] = { |
| 524 | .type_desc = &tos_fw_extra1_hash, |
| 525 | .data = { |
| 526 | .ptr = (void *)tos_fw_extra1_hash_buf, |
| 527 | .len = (unsigned int)HASH_DER_LEN |
| 528 | } |
| 529 | }, |
| 530 | [2] = { |
| 531 | .type_desc = &tos_fw_extra2_hash, |
| 532 | .data = { |
| 533 | .ptr = (void *)tos_fw_extra2_hash_buf, |
| 534 | .len = (unsigned int)HASH_DER_LEN |
| 535 | } |
| 536 | }, |
| 537 | [3] = { |
| 538 | .type_desc = &tos_fw_config_hash, |
| 539 | .data = { |
| 540 | .ptr = (void *)tos_fw_config_hash_buf, |
| 541 | .len = (unsigned int)HASH_DER_LEN |
Summer Qin | 8072678 | 2017-04-20 16:28:39 +0100 | [diff] [blame] | 542 | } |
| 543 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 544 | } |
| 545 | }; |
| 546 | static const auth_img_desc_t bl32_image = { |
| 547 | .img_id = BL32_IMAGE_ID, |
| 548 | .img_type = IMG_RAW, |
| 549 | .parent = &trusted_os_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 550 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 551 | [0] = { |
| 552 | .type = AUTH_METHOD_HASH, |
| 553 | .param.hash = { |
| 554 | .data = &raw_data, |
| 555 | .hash = &tos_fw_hash |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 556 | } |
| 557 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 558 | } |
| 559 | }; |
| 560 | static const auth_img_desc_t bl32_extra1_image = { |
| 561 | .img_id = BL32_EXTRA1_IMAGE_ID, |
| 562 | .img_type = IMG_RAW, |
| 563 | .parent = &trusted_os_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 564 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 565 | [0] = { |
| 566 | .type = AUTH_METHOD_HASH, |
| 567 | .param.hash = { |
| 568 | .data = &raw_data, |
| 569 | .hash = &tos_fw_extra1_hash |
| 570 | } |
| 571 | } |
| 572 | } |
| 573 | }; |
| 574 | static const auth_img_desc_t bl32_extra2_image = { |
| 575 | .img_id = BL32_EXTRA2_IMAGE_ID, |
| 576 | .img_type = IMG_RAW, |
| 577 | .parent = &trusted_os_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 578 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 579 | [0] = { |
| 580 | .type = AUTH_METHOD_HASH, |
| 581 | .param.hash = { |
| 582 | .data = &raw_data, |
| 583 | .hash = &tos_fw_extra2_hash |
| 584 | } |
| 585 | } |
| 586 | } |
| 587 | }; |
| 588 | /* TOS FW Config */ |
| 589 | static const auth_img_desc_t tos_fw_config = { |
| 590 | .img_id = TOS_FW_CONFIG_ID, |
| 591 | .img_type = IMG_RAW, |
| 592 | .parent = &trusted_os_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 593 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 594 | [0] = { |
| 595 | .type = AUTH_METHOD_HASH, |
| 596 | .param.hash = { |
| 597 | .data = &raw_data, |
| 598 | .hash = &tos_fw_config_hash |
| 599 | } |
| 600 | } |
| 601 | } |
| 602 | }; |
| 603 | /* |
| 604 | * Non-Trusted Firmware |
| 605 | */ |
| 606 | static const auth_img_desc_t non_trusted_fw_key_cert = { |
| 607 | .img_id = NON_TRUSTED_FW_KEY_CERT_ID, |
| 608 | .img_type = IMG_CERT, |
| 609 | .parent = &trusted_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 610 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 611 | [0] = { |
| 612 | .type = AUTH_METHOD_SIG, |
| 613 | .param.sig = { |
| 614 | .pk = &non_trusted_world_pk, |
| 615 | .sig = &sig, |
| 616 | .alg = &sig_alg, |
| 617 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 618 | } |
| 619 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 620 | [1] = { |
| 621 | .type = AUTH_METHOD_NV_CTR, |
| 622 | .param.nv_ctr = { |
| 623 | .cert_nv_ctr = &non_trusted_nv_ctr, |
| 624 | .plat_nv_ctr = &non_trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 625 | } |
| 626 | } |
| 627 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 628 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 629 | [0] = { |
| 630 | .type_desc = &nt_fw_content_pk, |
| 631 | .data = { |
| 632 | .ptr = (void *)content_pk_buf, |
| 633 | .len = (unsigned int)PK_DER_LEN |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | }; |
| 638 | static const auth_img_desc_t non_trusted_fw_content_cert = { |
| 639 | .img_id = NON_TRUSTED_FW_CONTENT_CERT_ID, |
| 640 | .img_type = IMG_CERT, |
| 641 | .parent = &non_trusted_fw_key_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 642 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 643 | [0] = { |
| 644 | .type = AUTH_METHOD_SIG, |
| 645 | .param.sig = { |
| 646 | .pk = &nt_fw_content_pk, |
| 647 | .sig = &sig, |
| 648 | .alg = &sig_alg, |
| 649 | .data = &raw_data |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 650 | } |
| 651 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 652 | [1] = { |
| 653 | .type = AUTH_METHOD_NV_CTR, |
| 654 | .param.nv_ctr = { |
| 655 | .cert_nv_ctr = &non_trusted_nv_ctr, |
| 656 | .plat_nv_ctr = &non_trusted_nv_ctr |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 657 | } |
| 658 | } |
| 659 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 660 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 661 | [0] = { |
| 662 | .type_desc = &nt_world_bl_hash, |
| 663 | .data = { |
| 664 | .ptr = (void *)nt_world_bl_hash_buf, |
| 665 | .len = (unsigned int)HASH_DER_LEN |
| 666 | } |
| 667 | }, |
| 668 | [1] = { |
| 669 | .type_desc = &nt_fw_config_hash, |
| 670 | .data = { |
| 671 | .ptr = (void *)nt_fw_config_hash_buf, |
| 672 | .len = (unsigned int)HASH_DER_LEN |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 673 | } |
| 674 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 675 | } |
| 676 | }; |
| 677 | static const auth_img_desc_t bl33_image = { |
| 678 | .img_id = BL33_IMAGE_ID, |
| 679 | .img_type = IMG_RAW, |
| 680 | .parent = &non_trusted_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 681 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 682 | [0] = { |
| 683 | .type = AUTH_METHOD_HASH, |
| 684 | .param.hash = { |
| 685 | .data = &raw_data, |
| 686 | .hash = &nt_world_bl_hash |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 687 | } |
| 688 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 689 | } |
| 690 | }; |
| 691 | /* NT FW Config */ |
| 692 | static const auth_img_desc_t nt_fw_config = { |
| 693 | .img_id = NT_FW_CONFIG_ID, |
| 694 | .img_type = IMG_RAW, |
| 695 | .parent = &non_trusted_fw_content_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 696 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 697 | [0] = { |
| 698 | .type = AUTH_METHOD_HASH, |
| 699 | .param.hash = { |
| 700 | .data = &raw_data, |
| 701 | .hash = &nt_fw_config_hash |
| 702 | } |
| 703 | } |
| 704 | } |
| 705 | }; |
| 706 | #else /* IMAGE_BL2 */ |
| 707 | /* |
| 708 | * FWU auth descriptor. |
| 709 | */ |
| 710 | static const auth_img_desc_t fwu_cert = { |
| 711 | .img_id = FWU_CERT_ID, |
| 712 | .img_type = IMG_CERT, |
| 713 | .parent = NULL, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 714 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 715 | [0] = { |
| 716 | .type = AUTH_METHOD_SIG, |
| 717 | .param.sig = { |
| 718 | .pk = &subject_pk, |
| 719 | .sig = &sig, |
| 720 | .alg = &sig_alg, |
| 721 | .data = &raw_data |
| 722 | } |
| 723 | } |
Soby Mathew | 2bb78d3 | 2018-03-29 14:29:55 +0100 | [diff] [blame] | 724 | }, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 725 | .authenticated_data = (const auth_param_desc_t[COT_MAX_VERIFIED_PARAMS]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 726 | [0] = { |
| 727 | .type_desc = &scp_bl2u_hash, |
| 728 | .data = { |
| 729 | .ptr = (void *)scp_fw_hash_buf, |
| 730 | .len = (unsigned int)HASH_DER_LEN |
Yatharth Kochar | 71c9a5e | 2015-10-10 19:06:53 +0100 | [diff] [blame] | 731 | } |
| 732 | }, |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 733 | [1] = { |
| 734 | .type_desc = &bl2u_hash, |
| 735 | .data = { |
| 736 | .ptr = (void *)tb_fw_hash_buf, |
| 737 | .len = (unsigned int)HASH_DER_LEN |
| 738 | } |
| 739 | }, |
| 740 | [2] = { |
| 741 | .type_desc = &ns_bl2u_hash, |
| 742 | .data = { |
| 743 | .ptr = (void *)nt_world_bl_hash_buf, |
| 744 | .len = (unsigned int)HASH_DER_LEN |
Yatharth Kochar | 71c9a5e | 2015-10-10 19:06:53 +0100 | [diff] [blame] | 745 | } |
| 746 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 747 | } |
| 748 | }; |
| 749 | /* |
| 750 | * SCP_BL2U |
| 751 | */ |
| 752 | static const auth_img_desc_t scp_bl2u_image = { |
| 753 | .img_id = SCP_BL2U_IMAGE_ID, |
| 754 | .img_type = IMG_RAW, |
| 755 | .parent = &fwu_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 756 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 757 | [0] = { |
| 758 | .type = AUTH_METHOD_HASH, |
| 759 | .param.hash = { |
| 760 | .data = &raw_data, |
| 761 | .hash = &scp_bl2u_hash |
Yatharth Kochar | 71c9a5e | 2015-10-10 19:06:53 +0100 | [diff] [blame] | 762 | } |
| 763 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 764 | } |
| 765 | }; |
| 766 | /* |
| 767 | * BL2U |
| 768 | */ |
| 769 | static const auth_img_desc_t bl2u_image = { |
| 770 | .img_id = BL2U_IMAGE_ID, |
| 771 | .img_type = IMG_RAW, |
| 772 | .parent = &fwu_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 773 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 774 | [0] = { |
| 775 | .type = AUTH_METHOD_HASH, |
| 776 | .param.hash = { |
| 777 | .data = &raw_data, |
| 778 | .hash = &bl2u_hash |
Yatharth Kochar | 71c9a5e | 2015-10-10 19:06:53 +0100 | [diff] [blame] | 779 | } |
| 780 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 781 | } |
| 782 | }; |
| 783 | /* |
| 784 | * NS_BL2U |
| 785 | */ |
| 786 | static const auth_img_desc_t ns_bl2u_image = { |
| 787 | .img_id = NS_BL2U_IMAGE_ID, |
| 788 | .img_type = IMG_RAW, |
| 789 | .parent = &fwu_cert, |
Joel Hutton | 69931af | 2019-03-11 11:37:38 +0000 | [diff] [blame] | 790 | .img_auth_methods = (const auth_method_desc_t[AUTH_METHOD_NUM]) { |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 791 | [0] = { |
| 792 | .type = AUTH_METHOD_HASH, |
| 793 | .param.hash = { |
| 794 | .data = &raw_data, |
| 795 | .hash = &ns_bl2u_hash |
Yatharth Kochar | 71c9a5e | 2015-10-10 19:06:53 +0100 | [diff] [blame] | 796 | } |
| 797 | } |
| 798 | } |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 799 | }; |
| 800 | #endif /* IMAGE_BL2 */ |
| 801 | /* |
| 802 | * TBBR Chain of trust definition |
| 803 | */ |
| 804 | |
| 805 | #ifdef IMAGE_BL1 |
| 806 | static const auth_img_desc_t * const cot_desc[] = { |
| 807 | [TRUSTED_BOOT_FW_CERT_ID] = &trusted_boot_fw_cert, |
| 808 | [BL2_IMAGE_ID] = &bl2_image, |
| 809 | [HW_CONFIG_ID] = &hw_config, |
| 810 | [TB_FW_CONFIG_ID] = &tb_fw_config, |
| 811 | [FWU_CERT_ID] = &fwu_cert, |
| 812 | [SCP_BL2U_IMAGE_ID] = &scp_bl2u_image, |
| 813 | [BL2U_IMAGE_ID] = &bl2u_image, |
| 814 | [NS_BL2U_IMAGE_ID] = &ns_bl2u_image |
| 815 | }; |
| 816 | #else /* IMAGE_BL2 */ |
| 817 | static const auth_img_desc_t * const cot_desc[] = { |
| 818 | [TRUSTED_BOOT_FW_CERT_ID] = &trusted_boot_fw_cert, |
| 819 | [HW_CONFIG_ID] = &hw_config, |
| 820 | [TRUSTED_KEY_CERT_ID] = &trusted_key_cert, |
| 821 | [SCP_FW_KEY_CERT_ID] = &scp_fw_key_cert, |
| 822 | [SCP_FW_CONTENT_CERT_ID] = &scp_fw_content_cert, |
| 823 | [SCP_BL2_IMAGE_ID] = &scp_bl2_image, |
| 824 | [SOC_FW_KEY_CERT_ID] = &soc_fw_key_cert, |
| 825 | [SOC_FW_CONTENT_CERT_ID] = &soc_fw_content_cert, |
| 826 | [BL31_IMAGE_ID] = &bl31_image, |
| 827 | [SOC_FW_CONFIG_ID] = &soc_fw_config, |
| 828 | [TRUSTED_OS_FW_KEY_CERT_ID] = &trusted_os_fw_key_cert, |
| 829 | [TRUSTED_OS_FW_CONTENT_CERT_ID] = &trusted_os_fw_content_cert, |
| 830 | [BL32_IMAGE_ID] = &bl32_image, |
| 831 | [BL32_EXTRA1_IMAGE_ID] = &bl32_extra1_image, |
| 832 | [BL32_EXTRA2_IMAGE_ID] = &bl32_extra2_image, |
| 833 | [TOS_FW_CONFIG_ID] = &tos_fw_config, |
| 834 | [NON_TRUSTED_FW_KEY_CERT_ID] = &non_trusted_fw_key_cert, |
| 835 | [NON_TRUSTED_FW_CONTENT_CERT_ID] = &non_trusted_fw_content_cert, |
| 836 | [BL33_IMAGE_ID] = &bl33_image, |
| 837 | [NT_FW_CONFIG_ID] = &nt_fw_config, |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 838 | }; |
Joel Hutton | e9919bb | 2019-02-20 11:56:46 +0000 | [diff] [blame] | 839 | #endif |
Juan Castillo | 9b265a8 | 2015-05-07 14:52:44 +0100 | [diff] [blame] | 840 | |
| 841 | /* Register the CoT in the authentication module */ |
| 842 | REGISTER_COT(cot_desc); |