blob: 8f7feb51cde8a7112ab16e3622ae80a3fdc31ad4 [file] [log] [blame]
Juan Castillo11abdcd2014-10-21 11:30:42 +01001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * Neither the name of ARM nor the names of its contributors may be used
15 * to endorse or promote products derived from this software without specific
16 * prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
29 */
30
Juan Castilloe6d30e92015-06-12 11:27:59 +010031#include "tbbr/tbb_cert.h"
32#include "tbbr/tbb_ext.h"
33#include "tbbr/tbb_key.h"
Juan Castillo11abdcd2014-10-21 11:30:42 +010034
35/*
36 * Certificates used in the chain of trust
37 *
38 * The order of the certificates must follow the enumeration specified in
Juan Castilloe6d30e92015-06-12 11:27:59 +010039 * tbb_cert.h. All certificates are self-signed, so the issuer certificate
40 * field points to itself.
Juan Castillo11abdcd2014-10-21 11:30:42 +010041 */
Juan Castilloe6d30e92015-06-12 11:27:59 +010042static cert_t tbb_certs[] = {
Juan Castillobe801202015-12-03 10:19:21 +000043 [TRUSTED_BOOT_FW_CERT] = {
44 .id = TRUSTED_BOOT_FW_CERT,
45 .opt = "tb-fw-cert",
Juan Castillo212f7382015-12-15 16:37:57 +000046 .help_msg = "Trusted Boot FW Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +010047 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +000048 .cn = "Trusted Boot FW Certificate",
Juan Castilloe6d30e92015-06-12 11:27:59 +010049 .key = ROT_KEY,
Juan Castillobe801202015-12-03 10:19:21 +000050 .issuer = TRUSTED_BOOT_FW_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +010051 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +000052 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +000053 TRUSTED_BOOT_FW_HASH_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +010054 },
Juan Castillo43529982016-01-22 11:05:24 +000055 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +010056 },
Juan Castilloe6d30e92015-06-12 11:27:59 +010057 [TRUSTED_KEY_CERT] = {
Juan Castillo11abdcd2014-10-21 11:30:42 +010058 .id = TRUSTED_KEY_CERT,
Juan Castillo1218dd52015-07-03 16:23:16 +010059 .opt = "trusted-key-cert",
Juan Castillo212f7382015-12-15 16:37:57 +000060 .help_msg = "Trusted Key Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +010061 .fn = NULL,
62 .cn = "Trusted Key Certificate",
Juan Castilloe6d30e92015-06-12 11:27:59 +010063 .key = ROT_KEY,
64 .issuer = TRUSTED_KEY_CERT,
65 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +000066 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +000067 TRUSTED_WORLD_PK_EXT,
68 NON_TRUSTED_WORLD_PK_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +010069 },
Juan Castillo43529982016-01-22 11:05:24 +000070 .num_ext = 3
Juan Castillo11abdcd2014-10-21 11:30:42 +010071 },
Juan Castillobe801202015-12-03 10:19:21 +000072 [SCP_FW_KEY_CERT] = {
73 .id = SCP_FW_KEY_CERT,
74 .opt = "scp-fw-key-cert",
Juan Castillo212f7382015-12-15 16:37:57 +000075 .help_msg = "SCP Firmware Key Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +010076 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +000077 .cn = "SCP Firmware Key Certificate",
Juan Castilloe6d30e92015-06-12 11:27:59 +010078 .key = TRUSTED_WORLD_KEY,
Juan Castillobe801202015-12-03 10:19:21 +000079 .issuer = SCP_FW_KEY_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +010080 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +000081 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +000082 SCP_FW_CONTENT_CERT_PK_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +010083 },
Juan Castillo43529982016-01-22 11:05:24 +000084 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +010085 },
Juan Castillobe801202015-12-03 10:19:21 +000086 [SCP_FW_CONTENT_CERT] = {
87 .id = SCP_FW_CONTENT_CERT,
88 .opt = "scp-fw-cert",
Juan Castillo212f7382015-12-15 16:37:57 +000089 .help_msg = "SCP Firmware Content Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +010090 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +000091 .cn = "SCP Firmware Content Certificate",
92 .key = SCP_FW_CONTENT_CERT_KEY,
93 .issuer = SCP_FW_CONTENT_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +010094 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +000095 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +000096 SCP_FW_HASH_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +010097 },
Juan Castillo43529982016-01-22 11:05:24 +000098 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +010099 },
Juan Castillobe801202015-12-03 10:19:21 +0000100 [SOC_FW_KEY_CERT] = {
101 .id = SOC_FW_KEY_CERT,
102 .opt = "soc-fw-key-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000103 .help_msg = "SoC Firmware Key Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +0100104 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +0000105 .cn = "SoC Firmware Key Certificate",
Juan Castilloe6d30e92015-06-12 11:27:59 +0100106 .key = TRUSTED_WORLD_KEY,
Juan Castillobe801202015-12-03 10:19:21 +0000107 .issuer = SOC_FW_KEY_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +0100108 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +0000109 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +0000110 SOC_FW_CONTENT_CERT_PK_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +0100111 },
Juan Castillo43529982016-01-22 11:05:24 +0000112 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +0100113 },
Juan Castillobe801202015-12-03 10:19:21 +0000114 [SOC_FW_CONTENT_CERT] = {
115 .id = SOC_FW_CONTENT_CERT,
116 .opt = "soc-fw-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000117 .help_msg = "SoC Firmware Content Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +0100118 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +0000119 .cn = "SoC Firmware Content Certificate",
120 .key = SOC_FW_CONTENT_CERT_KEY,
121 .issuer = SOC_FW_CONTENT_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +0100122 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +0000123 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +0000124 SOC_AP_FW_HASH_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +0100125 },
Juan Castillo43529982016-01-22 11:05:24 +0000126 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +0100127 },
Juan Castillobe801202015-12-03 10:19:21 +0000128 [TRUSTED_OS_FW_KEY_CERT] = {
129 .id = TRUSTED_OS_FW_KEY_CERT,
130 .opt = "tos-fw-key-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000131 .help_msg = "Trusted OS Firmware Key Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +0100132 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +0000133 .cn = "Trusted OS Firmware Key Certificate",
Juan Castilloe6d30e92015-06-12 11:27:59 +0100134 .key = TRUSTED_WORLD_KEY,
Juan Castillobe801202015-12-03 10:19:21 +0000135 .issuer = TRUSTED_OS_FW_KEY_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +0100136 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +0000137 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +0000138 TRUSTED_OS_FW_CONTENT_CERT_PK_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +0100139 },
Juan Castillo43529982016-01-22 11:05:24 +0000140 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +0100141 },
Juan Castillobe801202015-12-03 10:19:21 +0000142 [TRUSTED_OS_FW_CONTENT_CERT] = {
143 .id = TRUSTED_OS_FW_CONTENT_CERT,
144 .opt = "tos-fw-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000145 .help_msg = "Trusted OS Firmware Content Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +0100146 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +0000147 .cn = "Trusted OS Firmware Content Certificate",
148 .key = TRUSTED_OS_FW_CONTENT_CERT_KEY,
149 .issuer = TRUSTED_OS_FW_CONTENT_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +0100150 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +0000151 TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +0000152 TRUSTED_OS_FW_HASH_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +0100153 },
Juan Castillo43529982016-01-22 11:05:24 +0000154 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +0100155 },
Juan Castillobe801202015-12-03 10:19:21 +0000156 [NON_TRUSTED_FW_KEY_CERT] = {
157 .id = NON_TRUSTED_FW_KEY_CERT,
158 .opt = "nt-fw-key-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000159 .help_msg = "Non-Trusted Firmware Key Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +0100160 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +0000161 .cn = "Non-Trusted Firmware Key Certificate",
Juan Castilloe6d30e92015-06-12 11:27:59 +0100162 .key = NON_TRUSTED_WORLD_KEY,
Juan Castillobe801202015-12-03 10:19:21 +0000163 .issuer = NON_TRUSTED_FW_KEY_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +0100164 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +0000165 NON_TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +0000166 NON_TRUSTED_FW_CONTENT_CERT_PK_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +0100167 },
Juan Castillo43529982016-01-22 11:05:24 +0000168 .num_ext = 2
Juan Castillo11abdcd2014-10-21 11:30:42 +0100169 },
Juan Castillobe801202015-12-03 10:19:21 +0000170 [NON_TRUSTED_FW_CONTENT_CERT] = {
171 .id = NON_TRUSTED_FW_CONTENT_CERT,
172 .opt = "nt-fw-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000173 .help_msg = "Non-Trusted Firmware Content Certificate (output file)",
Juan Castillo11abdcd2014-10-21 11:30:42 +0100174 .fn = NULL,
Juan Castillobe801202015-12-03 10:19:21 +0000175 .cn = "Non-Trusted Firmware Content Certificate",
176 .key = NON_TRUSTED_FW_CONTENT_CERT_KEY,
177 .issuer = NON_TRUSTED_FW_CONTENT_CERT,
Juan Castilloe6d30e92015-06-12 11:27:59 +0100178 .ext = {
Juan Castillo43529982016-01-22 11:05:24 +0000179 NON_TRUSTED_FW_NVCOUNTER_EXT,
Juan Castillobe801202015-12-03 10:19:21 +0000180 NON_TRUSTED_WORLD_BOOTLOADER_HASH_EXT
Juan Castilloe6d30e92015-06-12 11:27:59 +0100181 },
Juan Castillo43529982016-01-22 11:05:24 +0000182 .num_ext = 2
Yatharth Kochar5752b592015-08-21 15:30:55 +0100183 },
184 [FWU_CERT] = {
185 .id = FWU_CERT,
186 .opt = "fwu-cert",
Juan Castillo212f7382015-12-15 16:37:57 +0000187 .help_msg = "Firmware Update Certificate (output file)",
Yatharth Kochar5752b592015-08-21 15:30:55 +0100188 .fn = NULL,
Juan Castillo212f7382015-12-15 16:37:57 +0000189 .cn = "Firmware Update Certificate",
Yatharth Kochar5752b592015-08-21 15:30:55 +0100190 .key = ROT_KEY,
191 .issuer = FWU_CERT,
192 .ext = {
Juan Castillobe801202015-12-03 10:19:21 +0000193 SCP_FWU_CFG_HASH_EXT,
194 AP_FWU_CFG_HASH_EXT,
195 FWU_HASH_EXT
Yatharth Kochar5752b592015-08-21 15:30:55 +0100196 },
197 .num_ext = 3
Juan Castillo11abdcd2014-10-21 11:30:42 +0100198 }
199};
Juan Castilloe6d30e92015-06-12 11:27:59 +0100200
201REGISTER_COT(tbb_certs);