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