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