1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 /*
21 * Original code taken from mcuboot project at:
22 * https://github.com/mcu-tools/mcuboot
23 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
24 * Modifications are Copyright (c) 2019-2022 Arm Limited.
25 */
26
27 #include <stddef.h>
28 #include <bootutil/sign_key.h>
29 #include "mcuboot_config/mcuboot_config.h"
30 #include "tfm_plat_rotpk.h"
31
32 #ifdef MCUBOOT_ENC_IMAGES
33 unsigned char enc_priv_key[] = {
34 0x30, 0x82, 0x04, 0xa4, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01, 0x01, 0x00,
35 0xb4, 0x26, 0x14, 0x49, 0x3d, 0x16, 0x13, 0x3a, 0x6d, 0x9c, 0x84, 0xa9,
36 0x8b, 0x6a, 0x10, 0x20, 0x61, 0xef, 0x48, 0x04, 0xa4, 0x4b, 0x24, 0xf3,
37 0x00, 0x32, 0xac, 0x22, 0xe0, 0x30, 0x27, 0x70, 0x18, 0xe5, 0x55, 0xc8,
38 0xb8, 0x05, 0x34, 0x03, 0xb0, 0xf8, 0xa5, 0x96, 0xd2, 0x48, 0x58, 0xef,
39 0x70, 0xb0, 0x09, 0xdb, 0xe3, 0x58, 0x62, 0xef, 0x99, 0x63, 0x01, 0xb2,
40 0x89, 0xc4, 0xb3, 0xf6, 0x9e, 0x62, 0xbf, 0x4d, 0xc2, 0x8a, 0xd0, 0xc9,
41 0x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 0x49, 0x07, 0x7d, 0x78, 0xcb, 0xa7, 0xef, 0x92, 0x6d, 0x3b, 0x13, 0x95,
72 0x9b, 0xba, 0x83, 0xc6, 0xb3, 0x71, 0x25, 0x27, 0x07, 0x99, 0x54, 0x82,
73 0x3d, 0xec, 0xc5, 0xf8, 0xb4, 0xa0, 0x38, 0x7a, 0x59, 0x6a, 0x0b, 0xca,
74 0x69, 0x6c, 0x17, 0xa4, 0x18, 0xe0, 0xb4, 0xaa, 0x89, 0x99, 0x8f, 0xcb,
75 0x71, 0x34, 0x09, 0x1b, 0x6e, 0xe6, 0x87, 0x00, 0xb5, 0xba, 0x70, 0x8a,
76 0x29, 0x3d, 0x9a, 0x06, 0x18, 0x2d, 0x66, 0x5e, 0x61, 0x37, 0xeb, 0xdd,
77 0x5e, 0xc8, 0x28, 0x92, 0x05, 0x30, 0xfd, 0xb8, 0x65, 0xb1, 0x7f, 0xbf,
78 0x2d, 0x55, 0x12, 0x91, 0xc1, 0x02, 0x81, 0x81, 0x00, 0xda, 0x65, 0xda,
79 0x38, 0x7c, 0x18, 0xfb, 0x00, 0x11, 0x60, 0xeb, 0x37, 0x65, 0xb8, 0x83,
80 0x62, 0x88, 0xc4, 0x3a, 0x4e, 0x64, 0x6a, 0xf3, 0x3e, 0x4e, 0xc0, 0x34,
81 0x19, 0x8a, 0xcb, 0x4a, 0xca, 0x2f, 0x5d, 0x50, 0x7a, 0xac, 0xf7, 0x9e,
82 0x87, 0x5a, 0xfc, 0x4d, 0x49, 0xd7, 0xf9, 0x21, 0xf5, 0x0b, 0x6f, 0x57,
83 0x41, 0x3d, 0x8f, 0xb8, 0xec, 0x7f, 0xcc, 0x92, 0x09, 0xbe, 0xd3, 0xa4,
84 0xc3, 0x14, 0x85, 0x21, 0x5d, 0x05, 0xa3, 0xaa, 0x20, 0xf6, 0x62, 0x44,
85 0x50, 0x03, 0x5e, 0x53, 0x4a, 0xcd, 0x6a, 0xb6, 0x65, 0x8e, 0x4e, 0x4b,
86 0x3f, 0x25, 0xc6, 0x16, 0x31, 0xf5, 0x99, 0x13, 0x77, 0x42, 0xda, 0xdc,
87 0x70, 0x4d, 0x65, 0xb0, 0x99, 0x0f, 0xdf, 0x5a, 0xb1, 0x45, 0xf0, 0xb9,
88 0x8e, 0xa0, 0xae, 0x4f, 0x4d, 0x65, 0x09, 0x84, 0xb5, 0x38, 0x29, 0xbf,
89 0x69, 0xe0, 0x88, 0x1f, 0x27, 0x02, 0x81, 0x81, 0x00, 0xd3, 0x2a, 0x59,
90 0xec, 0x28, 0xc3, 0x0d, 0x4f, 0x92, 0x96, 0xca, 0x67, 0x94, 0xfc, 0x2e,
91 0xa6, 0x86, 0x68, 0x45, 0x53, 0x92, 0xcc, 0x86, 0x7f, 0x8a, 0xe1, 0x5d,
92 0xe8, 0x1d, 0x9e, 0xbb, 0x1e, 0x00, 0x26, 0x1d, 0x80, 0x12, 0xff, 0x9c,
93 0x11, 0x0a, 0xbd, 0xa6, 0xc3, 0x8d, 0x48, 0xda, 0xfc, 0x10, 0xf7, 0x7a,
94 0x16, 0x07, 0x15, 0xa0, 0x3a, 0xd3, 0x94, 0xfb, 0x52, 0x87, 0x39, 0xee,
95 0xe7, 0xc4, 0x26, 0x49, 0x16, 0xc6, 0xc0, 0x83, 0x25, 0xbf, 0x6a, 0x4e,
96 0x8c, 0x0b, 0x10, 0x85, 0x66, 0xab, 0x7e, 0xae, 0xac, 0x4c, 0x69, 0x3c,
97 0x44, 0xeb, 0xcd, 0xe9, 0xf6, 0x64, 0x8b, 0x4a, 0xd8, 0x6a, 0x4d, 0x6d,
98 0x47, 0xa9, 0xb8, 0x55, 0x72, 0xc1, 0xfd, 0xf4, 0x81, 0x4c, 0x66, 0xbe,
99 0x49, 0xf2, 0x75, 0x4f, 0x80, 0xf1, 0x20, 0x38, 0xb8, 0x6a, 0x1b, 0x75,
100 0x41, 0x30, 0x0f, 0x1b, 0x3f, 0x02, 0x81, 0x80, 0x09, 0x35, 0xfa, 0x7a,
101 0x1f, 0x61, 0xbe, 0x54, 0x46, 0x67, 0x5c, 0x04, 0x3e, 0x1a, 0x06, 0x10,
102 0x85, 0xcc, 0x20, 0xd9, 0x65, 0x8a, 0xcd, 0x2f, 0x77, 0x8a, 0xcb, 0xa7,
103 0xb8, 0x1e, 0xd2, 0xcc, 0xac, 0x2a, 0xb7, 0x56, 0x35, 0x2d, 0x4c, 0x56,
104 0x51, 0x14, 0x0a, 0xfe, 0x6e, 0x49, 0x67, 0x91, 0x3a, 0x26, 0x3b, 0xfb,
105 0xd8, 0x68, 0xd3, 0x57, 0xc6, 0x1c, 0x0e, 0x9c, 0xb2, 0x9b, 0xa2, 0x7b,
106 0x47, 0xc6, 0x45, 0x9d, 0xf2, 0xba, 0xf0, 0x55, 0xeb, 0x8e, 0x41, 0x6b,
107 0x4e, 0x79, 0x0f, 0xf2, 0x3b, 0xaf, 0xa0, 0x79, 0xb0, 0x02, 0xc5, 0x51,
108 0xa8, 0x7a, 0x2e, 0x3d, 0x75, 0x2a, 0x3b, 0x93, 0xf0, 0x11, 0xe2, 0xf2,
109 0x29, 0x91, 0x7c, 0x5d, 0x38, 0x3a, 0x27, 0x4d, 0x0a, 0xb2, 0x18, 0x61,
110 0x57, 0x8d, 0x82, 0x72, 0xb5, 0x2c, 0x2d, 0x98, 0xa7, 0x01, 0xbb, 0xbc,
111 0xef, 0x67, 0x4e, 0x49, 0x02, 0x81, 0x81, 0x00, 0xb2, 0x70, 0x53, 0x54,
112 0x70, 0x8d, 0x82, 0xad, 0xff, 0x1d, 0x55, 0x24, 0x7a, 0x8d, 0x2f, 0x8e,
113 0xa0, 0x7d, 0x74, 0x37, 0xcf, 0x10, 0xed, 0x86, 0xd1, 0x80, 0xe7, 0xad,
114 0xc1, 0x79, 0xe4, 0x7c, 0xd1, 0x7b, 0x63, 0xea, 0x5a, 0x23, 0x8d, 0x6a,
115 0x09, 0x3d, 0x81, 0xb2, 0x35, 0xad, 0x9e, 0xfe, 0xea, 0x07, 0x76, 0x2f,
116 0x2f, 0x05, 0x63, 0x44, 0xd2, 0x8e, 0x4e, 0x61, 0xca, 0xcb, 0x75, 0xca,
117 0x7b, 0xc2, 0x2e, 0x79, 0x04, 0xb2, 0xa1, 0x20, 0x40, 0xc4, 0x40, 0x63,
118 0xae, 0xe5, 0xe3, 0x14, 0x83, 0x4e, 0xa5, 0xa4, 0x0b, 0x5d, 0xd2, 0x04,
119 0x1b, 0x8f, 0x01, 0x69, 0xa8, 0x44, 0xdc, 0x96, 0x4c, 0x1d, 0xe9, 0x7e,
120 0x69, 0x38, 0xcf, 0x5c, 0x0d, 0xf9, 0xdf, 0xa7, 0x73, 0x3c, 0x4f, 0x08,
121 0x85, 0xce, 0x03, 0xc4, 0xdd, 0xfd, 0x70, 0x70, 0xc5, 0x99, 0x36, 0x58,
122 0x43, 0x98, 0x40, 0x59, 0x02, 0x81, 0x81, 0x00, 0xd5, 0xaa, 0xfb, 0xec,
123 0x8d, 0xc6, 0xdd, 0xfa, 0x2b, 0x5a, 0x24, 0xd0, 0xda, 0x58, 0xbd, 0x87,
124 0x92, 0x1a, 0x29, 0x62, 0x13, 0x1d, 0x4b, 0x79, 0x1b, 0xbe, 0x79, 0x7d,
125 0xad, 0x79, 0xca, 0x17, 0x75, 0xda, 0xe8, 0x32, 0xe8, 0xa0, 0x9e, 0xa8,
126 0x77, 0x53, 0xac, 0x38, 0xd6, 0xeb, 0xe6, 0x22, 0x65, 0xc4, 0xaa, 0x4c,
127 0xc8, 0xd0, 0x33, 0x1a, 0x1e, 0xbe, 0xbd, 0x73, 0x09, 0x4a, 0xfa, 0x85,
128 0x5c, 0xf3, 0x0c, 0x9c, 0x81, 0x56, 0x30, 0xa7, 0xf7, 0x9b, 0xf4, 0x92,
129 0x9c, 0x6b, 0x93, 0x6a, 0x00, 0x33, 0xdc, 0x2f, 0x54, 0x1e, 0x78, 0xd4,
130 0x97, 0xec, 0x24, 0xa2, 0xdb, 0x3d, 0x03, 0x33, 0x09, 0xb2, 0x2c, 0x03,
131 0x05, 0x40, 0xde, 0x52, 0xf2, 0x9b, 0xfa, 0x00, 0x8d, 0x4b, 0xfe, 0x5b,
132 0x9b, 0x9c, 0x73, 0xad, 0xfb, 0x7a, 0x00, 0x42, 0x62, 0x9e, 0xa0, 0x95,
133 0x55, 0x50, 0x32, 0x87
134 };
135 static unsigned int enc_priv_key_len = 1192;
136
137 const struct bootutil_key bootutil_enc_key = {
138 .key = enc_priv_key,
139 .len = &enc_priv_key_len,
140 };
141 #endif /* MCUBOOT_ENC_IMAGES */
142
143 #if !defined(MCUBOOT_HW_KEY)
144 #if defined(MCUBOOT_SIGN_RSA)
145 #if MCUBOOT_SIGN_RSA_LEN == 2048
146 #define HAVE_KEYS
147 const unsigned char rsa_pub_key[] = {
148 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
149 0x00, 0xd1, 0x06, 0x08, 0x1a, 0x18, 0x44, 0x2c,
150 0x18, 0xe8, 0xfb, 0xfd, 0xf7, 0x0d, 0xa3, 0x4f,
151 0x1f, 0xbb, 0xee, 0x5e, 0xf9, 0xaa, 0xd2, 0x4b,
152 0x18, 0xd3, 0x5a, 0xe9, 0x6d, 0x18, 0x80, 0x19,
153 0xf9, 0xf0, 0x9c, 0x34, 0x1b, 0xcb, 0xf3, 0xbc,
154 0x74, 0xdb, 0x42, 0xe7, 0x8c, 0x7f, 0x10, 0x53,
155 0x7e, 0x43, 0x5e, 0x0d, 0x57, 0x2c, 0x44, 0xd1,
156 0x67, 0x08, 0x0f, 0x0d, 0xbb, 0x5c, 0xee, 0xec,
157 0xb3, 0x99, 0xdf, 0xe0, 0x4d, 0x84, 0x0b, 0xaa,
158 0x77, 0x41, 0x60, 0xed, 0x15, 0x28, 0x49, 0xa7,
159 0x01, 0xb4, 0x3c, 0x10, 0xe6, 0x69, 0x8c, 0x2f,
160 0x5f, 0xac, 0x41, 0x4d, 0x9e, 0x5c, 0x14, 0xdf,
161 0xf2, 0xf8, 0xcf, 0x3d, 0x1e, 0x6f, 0xe7, 0x5b,
162 0xba, 0xb4, 0xa9, 0xc8, 0x88, 0x7e, 0x47, 0x3c,
163 0x94, 0xc3, 0x77, 0x67, 0x54, 0x4b, 0xaa, 0x8d,
164 0x38, 0x35, 0xca, 0x62, 0x61, 0x7e, 0xb7, 0xe1,
165 0x15, 0xdb, 0x77, 0x73, 0xd4, 0xbe, 0x7b, 0x72,
166 0x21, 0x89, 0x69, 0x24, 0xfb, 0xf8, 0x65, 0x6e,
167 0x64, 0x3e, 0xc8, 0x0e, 0xd7, 0x85, 0xd5, 0x5c,
168 0x4a, 0xe4, 0x53, 0x0d, 0x2f, 0xff, 0xb7, 0xfd,
169 0xf3, 0x13, 0x39, 0x83, 0x3f, 0xa3, 0xae, 0xd2,
170 0x0f, 0xa7, 0x6a, 0x9d, 0xf9, 0xfe, 0xb8, 0xce,
171 0xfa, 0x2a, 0xbe, 0xaf, 0xb8, 0xe0, 0xfa, 0x82,
172 0x37, 0x54, 0xf4, 0x3e, 0xe1, 0x2b, 0xd0, 0xd3,
173 0x08, 0x58, 0x18, 0xf6, 0x5e, 0x4c, 0xc8, 0x88,
174 0x81, 0x31, 0xad, 0x5f, 0xb0, 0x82, 0x17, 0xf2,
175 0x8a, 0x69, 0x27, 0x23, 0xf3, 0xab, 0x87, 0x3e,
176 0x93, 0x1a, 0x1d, 0xfe, 0xe8, 0xf8, 0x1a, 0x24,
177 0x66, 0x59, 0xf8, 0x1c, 0xab, 0xdc, 0xce, 0x68,
178 0x1b, 0x66, 0x64, 0x35, 0xec, 0xfa, 0x0d, 0x11,
179 0x9d, 0xaf, 0x5c, 0x3a, 0xa7, 0xd1, 0x67, 0xc6,
180 0x47, 0xef, 0xb1, 0x4b, 0x2c, 0x62, 0xe1, 0xd1,
181 0xc9, 0x02, 0x03, 0x01, 0x00, 0x01,
182 };
183 const unsigned int rsa_pub_key_len = 270;
184 #if (MCUBOOT_IMAGE_NUMBER > 1)
185 const unsigned char rsa_pub_key_1[] = {
186 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01,
187 0x00, 0xac, 0xd2, 0x74, 0x93, 0x3e, 0x5f, 0xe7,
188 0xaf, 0xf2, 0xc8, 0x6c, 0xe8, 0x58, 0x51, 0x63,
189 0x77, 0x0e, 0x52, 0xfe, 0x58, 0xd5, 0xbb, 0xa5,
190 0xe3, 0x9c, 0x8a, 0xcd, 0x14, 0x0a, 0x89, 0xc6,
191 0x15, 0xae, 0x49, 0x04, 0x9f, 0x5f, 0x3d, 0x2b,
192 0x89, 0x12, 0x1f, 0x3e, 0x7f, 0x05, 0xfc, 0x0b,
193 0x99, 0x26, 0x63, 0x5e, 0x96, 0xef, 0x33, 0xbc,
194 0x8c, 0x27, 0x68, 0x4d, 0x46, 0x8d, 0x66, 0x33,
195 0x99, 0x3b, 0x38, 0x11, 0x1b, 0xe3, 0xac, 0x18,
196 0x07, 0x95, 0x48, 0x87, 0xb2, 0xab, 0x4f, 0x2d,
197 0x0e, 0x12, 0x51, 0x1b, 0x7f, 0x33, 0xba, 0x78,
198 0xb1, 0xd5, 0xfa, 0x7f, 0xbf, 0x71, 0x4b, 0xe4,
199 0x5f, 0x67, 0x57, 0x67, 0xd5, 0xab, 0xbb, 0x64,
200 0x06, 0x17, 0x3d, 0x81, 0xeb, 0xd8, 0xc1, 0xf9,
201 0x7a, 0x57, 0xd3, 0x29, 0x5c, 0x10, 0xff, 0xa7,
202 0xd3, 0x3a, 0x58, 0x3f, 0x25, 0x8a, 0xc5, 0x84,
203 0x7b, 0x97, 0x27, 0xa5, 0xe4, 0x90, 0xe7, 0xdf,
204 0x1c, 0x33, 0xe6, 0x7c, 0xaf, 0x68, 0x77, 0x5e,
205 0x1f, 0x09, 0x6e, 0xdd, 0x92, 0x60, 0x4e, 0xac,
206 0x73, 0x84, 0xb0, 0xf7, 0xb6, 0x02, 0xc2, 0xce,
207 0x9f, 0xaf, 0xad, 0xb2, 0xb1, 0x57, 0xcc, 0xf9,
208 0x06, 0x1d, 0x6a, 0x25, 0x2f, 0x72, 0x2a, 0x7d,
209 0xfe, 0x0d, 0xed, 0xb8, 0xc2, 0x95, 0x88, 0x41,
210 0xf2, 0x45, 0xa8, 0x6e, 0x6a, 0x85, 0xee, 0xae,
211 0xfa, 0x8a, 0x79, 0xfa, 0xfe, 0x7e, 0x40, 0x49,
212 0x43, 0xec, 0x2c, 0x8e, 0x8e, 0x82, 0x7e, 0xe2,
213 0xf8, 0x0f, 0xf2, 0xe9, 0x7d, 0xa3, 0x7f, 0xac,
214 0x23, 0xbd, 0x0a, 0x42, 0xea, 0x18, 0xfb, 0x72,
215 0xa0, 0x9a, 0x24, 0x01, 0xc8, 0x27, 0x8c, 0x56,
216 0x24, 0x93, 0x82, 0xdf, 0x23, 0x19, 0x96, 0x73,
217 0xf2, 0x11, 0xc3, 0x05, 0xe6, 0xa5, 0xb8, 0x0b,
218 0xe0, 0x73, 0xce, 0x07, 0x9b, 0x57, 0xe6, 0x8e,
219 0xfb, 0x02, 0x03, 0x01, 0x00, 0x01,
220 };
221 const unsigned int rsa_pub_key_len_1 = 270;
222 #endif
223 #elif MCUBOOT_SIGN_RSA_LEN == 3072
224 #define HAVE_KEYS
225 const unsigned char rsa_pub_key[] = {
226 0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81,
227 0x00, 0x9c, 0xba, 0xc2, 0x5a, 0xbf, 0xcc, 0xc5,
228 0x4f, 0x20, 0x0c, 0x4f, 0x6f, 0x6c, 0x51, 0x4f,
229 0x5c, 0x0a, 0xab, 0x80, 0xb8, 0x6b, 0x10, 0xc4,
230 0x9b, 0x2b, 0xc4, 0x52, 0x32, 0x09, 0x4b, 0x3b,
231 0x27, 0x94, 0x6a, 0x1d, 0xd5, 0x4c, 0xa8, 0x5c,
232 0xa0, 0xc0, 0x76, 0x95, 0x7b, 0x26, 0x04, 0xb1,
233 0x13, 0x7e, 0x78, 0x27, 0xd6, 0x0c, 0xb4, 0xe8,
234 0xb0, 0x2d, 0x92, 0x52, 0x8a, 0xfb, 0x69, 0xff,
235 0x42, 0x10, 0xaa, 0x56, 0x0c, 0x83, 0xc8, 0x65,
236 0x6e, 0xba, 0x0d, 0x5f, 0x8e, 0xf7, 0x2b, 0x29,
237 0x92, 0xfc, 0x42, 0x2d, 0x2d, 0xf9, 0x80, 0xf5,
238 0x85, 0x21, 0x87, 0xea, 0xac, 0x40, 0xa8, 0xcb,
239 0xd0, 0xa8, 0x3b, 0xe2, 0xd2, 0xec, 0xf0, 0x14,
240 0x48, 0x0e, 0xcf, 0x2b, 0x8a, 0x4b, 0xa4, 0xcd,
241 0xa1, 0x05, 0x5b, 0x17, 0x66, 0x1d, 0xde, 0x6e,
242 0x44, 0xfe, 0x46, 0xa3, 0x0d, 0xd0, 0x69, 0xbf,
243 0x8c, 0xad, 0xa9, 0x16, 0x68, 0x51, 0xeb, 0x79,
244 0x91, 0x20, 0xe6, 0x81, 0x03, 0x07, 0x89, 0x40,
245 0x55, 0x4b, 0xeb, 0xcf, 0x67, 0xf8, 0x31, 0xc7,
246 0x1c, 0x54, 0x4e, 0x52, 0x0b, 0x60, 0xe8, 0xa2,
247 0x50, 0x07, 0xd1, 0xcf, 0xce, 0x12, 0x26, 0xcd,
248 0x8e, 0x82, 0x8d, 0x4e, 0x64, 0xa9, 0xf7, 0xc7,
249 0x21, 0x99, 0x25, 0x07, 0xdd, 0xc5, 0xd5, 0x5f,
250 0xf4, 0x63, 0xfa, 0xcc, 0x2b, 0xda, 0x06, 0x5c,
251 0x59, 0x67, 0xb0, 0x06, 0x35, 0xe9, 0xaa, 0x92,
252 0x45, 0x35, 0xe5, 0xa0, 0x03, 0xff, 0x1c, 0x02,
253 0xb5, 0xc7, 0x4e, 0x94, 0x4b, 0x6e, 0xad, 0x73,
254 0x9d, 0xce, 0x6f, 0x09, 0xb3, 0xb1, 0x8f, 0x60,
255 0x6c, 0xa2, 0xfa, 0xcd, 0x77, 0x0f, 0xcc, 0x27,
256 0xe6, 0x36, 0x58, 0xb3, 0x52, 0xf7, 0x8f, 0xbe,
257 0x49, 0x98, 0xb7, 0xe9, 0x60, 0xfd, 0x97, 0x57,
258 0xcd, 0xea, 0xd3, 0x0b, 0xdf, 0xa2, 0x42, 0xf7,
259 0x44, 0xd3, 0x87, 0xde, 0xe0, 0x10, 0x03, 0x94,
260 0xda, 0xfc, 0xbc, 0xdd, 0xbe, 0x93, 0xb3, 0x4a,
261 0x2b, 0x58, 0xdc, 0x96, 0x12, 0xf2, 0x6f, 0x23,
262 0xba, 0x3b, 0x37, 0xfe, 0xfc, 0x18, 0x1f, 0x75,
263 0x7d, 0x54, 0x01, 0x0e, 0xbe, 0x3d, 0x18, 0x13,
264 0xb3, 0x28, 0xb9, 0x34, 0x2c, 0xd5, 0xfb, 0xc5,
265 0x33, 0xbd, 0x87, 0xbd, 0x3b, 0xe4, 0x1d, 0xd7,
266 0x02, 0x3d, 0x1c, 0x72, 0x65, 0x72, 0x43, 0x43,
267 0x36, 0xa8, 0xfa, 0xe6, 0x73, 0x2d, 0xa4, 0x61,
268 0xe8, 0x02, 0x9c, 0x3a, 0x56, 0x4d, 0x1c, 0xd1,
269 0x76, 0x9c, 0x8c, 0xaa, 0x5f, 0x1b, 0xeb, 0x1c,
270 0x4a, 0xf5, 0xb9, 0xb8, 0x6f, 0x41, 0x4b, 0x27,
271 0x87, 0xde, 0xf6, 0x94, 0x1f, 0xdd, 0xe6, 0xf1,
272 0xa9, 0xc2, 0x02, 0xc2, 0x4f, 0xa3, 0xfc, 0xa4,
273 0x03, 0x5a, 0xd9, 0x6f, 0x78, 0xfd, 0x84, 0xf0,
274 0xe5, 0xfd, 0x3d, 0xa5, 0x4d, 0x1b, 0xad, 0x5b,
275 0x4b, 0x02, 0x03, 0x01, 0x00, 0x01,
276 };
277 const unsigned int rsa_pub_key_len = 398;
278 #if (MCUBOOT_IMAGE_NUMBER > 1)
279 const unsigned char rsa_pub_key_1[] = {
280 0x30, 0x82, 0x01, 0x8a, 0x02, 0x82, 0x01, 0x81,
281 0x00, 0xbf, 0xb7, 0xb0, 0x9f, 0xe8, 0xc8, 0xd1,
282 0xfe, 0x16, 0x1d, 0x53, 0x87, 0x97, 0x79, 0x1c,
283 0x15, 0xc7, 0x99, 0x16, 0x6c, 0xca, 0xb8, 0x2d,
284 0xca, 0xc2, 0x0d, 0x62, 0xf9, 0xeb, 0x8f, 0xe9,
285 0x3a, 0x18, 0x43, 0x47, 0xd7, 0xbb, 0xd5, 0x62,
286 0xbc, 0xe3, 0x33, 0x63, 0xa7, 0xa3, 0xa8, 0x5c,
287 0xf3, 0x23, 0x78, 0xfd, 0x2d, 0x07, 0x21, 0x1f,
288 0xb9, 0x54, 0x70, 0x28, 0xa9, 0x08, 0xda, 0x50,
289 0x7e, 0x9e, 0x8e, 0xcc, 0x68, 0x4e, 0x7f, 0x48,
290 0x0d, 0xea, 0x27, 0xe8, 0xc6, 0xef, 0xad, 0x5f,
291 0x9d, 0x46, 0x4a, 0xbc, 0x69, 0x9a, 0x30, 0x5f,
292 0x3b, 0xc1, 0x52, 0x92, 0xf8, 0xbc, 0x75, 0xd4,
293 0x3c, 0x27, 0x70, 0x40, 0x00, 0xa6, 0x2e, 0x28,
294 0x7f, 0x59, 0xe5, 0x60, 0x43, 0x11, 0xdc, 0x31,
295 0x09, 0x7d, 0xcf, 0x2f, 0x41, 0x3f, 0xb6, 0x52,
296 0x1a, 0xa3, 0x49, 0x16, 0xf2, 0xb5, 0xb3, 0x9c,
297 0x3c, 0xfb, 0x5e, 0x2c, 0x1f, 0x22, 0x86, 0xbd,
298 0xae, 0xbe, 0x36, 0x52, 0xbd, 0xc4, 0xf0, 0x58,
299 0x69, 0x36, 0xa7, 0x80, 0x3e, 0x81, 0xb3, 0x54,
300 0x98, 0xe4, 0x5d, 0x95, 0xed, 0x21, 0xf0, 0xba,
301 0xae, 0x21, 0xfb, 0xc4, 0x19, 0x87, 0x55, 0xd1,
302 0x2b, 0x4f, 0x00, 0xd8, 0x41, 0x58, 0xcb, 0xdb,
303 0xa9, 0x9a, 0x53, 0xe9, 0x6c, 0x67, 0xcb, 0x7c,
304 0x5d, 0xf6, 0x91, 0x06, 0x75, 0x52, 0xf2, 0xc0,
305 0x7e, 0xb1, 0x6b, 0x5d, 0x30, 0x40, 0x40, 0x2f,
306 0xd8, 0x1e, 0x95, 0x3c, 0x05, 0x97, 0x7f, 0xf0,
307 0x04, 0xf0, 0x4e, 0x2c, 0xd5, 0x39, 0x0e, 0x94,
308 0x3d, 0x7c, 0x03, 0x08, 0x1d, 0x09, 0x08, 0xf2,
309 0x8d, 0x44, 0x0d, 0xcf, 0xb3, 0x96, 0x3d, 0x5a,
310 0x76, 0xe8, 0xf6, 0xee, 0x93, 0x64, 0xe8, 0x57,
311 0xd1, 0xe2, 0xf5, 0x0b, 0x18, 0x69, 0x6f, 0xe9,
312 0xe1, 0x3d, 0xf8, 0x89, 0x49, 0x28, 0xe6, 0xaf,
313 0xb8, 0xa8, 0xc6, 0x42, 0x55, 0x2d, 0xc1, 0xdb,
314 0x8c, 0x5d, 0xb2, 0x6d, 0x7f, 0xfe, 0x26, 0xea,
315 0x75, 0xd9, 0xfd, 0x1f, 0xdc, 0x22, 0x3b, 0xa4,
316 0x1b, 0xa7, 0xad, 0xeb, 0x71, 0xdf, 0xbd, 0xb4,
317 0x37, 0xd1, 0xeb, 0xbe, 0x08, 0x10, 0x1c, 0x78,
318 0x84, 0x1c, 0x9a, 0x75, 0xc4, 0xad, 0xe5, 0xef,
319 0x73, 0x17, 0xac, 0x69, 0x78, 0xbc, 0xd6, 0x37,
320 0x8c, 0x0c, 0x14, 0x21, 0x06, 0x47, 0xbd, 0xf8,
321 0x0a, 0xac, 0x19, 0x09, 0x9d, 0x0d, 0x1d, 0x72,
322 0xe1, 0x3e, 0x1a, 0x74, 0xea, 0x86, 0xd9, 0x5c,
323 0x4a, 0xcd, 0xcc, 0xc6, 0x94, 0xa7, 0xfe, 0xda,
324 0x0b, 0x87, 0x11, 0xbb, 0x6b, 0xf0, 0x3a, 0xe3,
325 0x4f, 0x82, 0x4f, 0xb1, 0xe4, 0xa4, 0xcd, 0xbc,
326 0x70, 0x3c, 0x9d, 0x9c, 0x49, 0xf9, 0xcf, 0x28,
327 0x6d, 0xb8, 0xda, 0x6f, 0x7d, 0x38, 0x57, 0x55,
328 0x43, 0x2a, 0x73, 0x8d, 0xb6, 0x18, 0xfd, 0x70,
329 0xa7, 0x02, 0x03, 0x01, 0x00, 0x01,
330 };
331 const unsigned int rsa_pub_key_len_1 = 398;
332 #endif
333 #endif
334 #else
335 #error "No public key available for given signing algorithm."
336 #endif
337
338 #if defined(HAVE_KEYS)
339 const struct bootutil_key bootutil_keys[] = {
340 {
341 .key = rsa_pub_key,
342 .len = &rsa_pub_key_len,
343 },
344 #if (MCUBOOT_IMAGE_NUMBER > 1)
345 {
346 .key = rsa_pub_key_1,
347 .len = &rsa_pub_key_len_1,
348 },
349 #endif /* MCUBOOT_IMAGE_NUMBER > 1 */
350 #if (MCUBOOT_IMAGE_NUMBER > 2)
351 {
352 /* FIXME assuming the image 0 key is reused here */
353 .key = rsa_pub_key,
354 .len = &rsa_pub_key_len,
355 },
356 #endif /* MCUBOOT_IMAGE_NUMBER > 2 */
357 #if (MCUBOOT_IMAGE_NUMBER > 3)
358 {
359 /* FIXME assuming the image 0 key is reused here */
360 .key = rsa_pub_key,
361 .len = &rsa_pub_key_len,
362 },
363 #endif /* MCUBOOT_IMAGE_NUMBER > 3 */
364 };
365 const int bootutil_key_cnt = MCUBOOT_IMAGE_NUMBER;
366 #endif /* HAVE_KEYS */
367 #else /* MCUBOOT_HW_KEY */
368 unsigned int pub_key_len;
369 struct bootutil_key bootutil_keys[1] = {
370 {
371 .key = 0,
372 .len = &pub_key_len,
373 },
374 };
375 const int bootutil_key_cnt = 1;
376
boot_retrieve_public_key_hash(uint8_t image_index,uint8_t * public_key_hash,size_t * key_hash_size)377 int boot_retrieve_public_key_hash(uint8_t image_index,
378 uint8_t *public_key_hash,
379 size_t *key_hash_size)
380 {
381 return tfm_plat_get_rotpk_hash(image_index,
382 public_key_hash,
383 (uint32_t *)key_hash_size);
384 }
385 #endif /* !MCUBOOT_HW_KEY */
386