blob: db2bf072454750fb5e3cf0e0deebed1e26664039 [file] [log] [blame]
Roman Okhrimenko89ecdac2020-02-28 17:05:55 +02001/*
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* This software is a port of the open source MCUBoot project.
22*
23* This file was modified to fit PSoC6-based MCUBoot applications.
24*
25* Portions of this software, including source code, documentation and related
26* materials ("Software"), are owned by Cypress Semiconductor
27* Corporation or one of its subsidiaries ("Cypress") and is protected by
28* and subject to worldwide patent protection (United States and foreign),
29* United States copyright laws and international treaty provisions.
30* Therefore, you may use this Software only as provided in the license
31* agreement accompanying the software package from which you
32* obtained this Software ("EULA").
33*
34* If no EULA applies, Cypress hereby grants you a personal, non-
35* exclusive, non-transferable license to copy, modify, and compile the
36* Software source code solely for use in connection with Cypress's
37* integrated circuit products. Any reproduction, modification, translation,
38* compilation, or representation of this Software except as specified
39* above is prohibited without the express written permission of Cypress.
40*
41* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO
42* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING,
43* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED
44* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
45* PARTICULAR PURPOSE. Cypress reserves the right to make
46* changes to the Software without notice. Cypress does not assume any
47* liability arising out of the application or use of the Software or any
48* product or circuit described in the Software. Cypress does not
49* authorize its products for use in any products where a malfunction or
50* failure of the Cypress product may reasonably be expected to result in
51* significant property damage, injury or death ("High Risk Product"). By
52* including Cypress's product in a High Risk Product, the manufacturer
53* of such system or application assumes all risk of such use and in doing
54* so agrees to indemnify Cypress against all liability.
55*
56********************************************************************************/
57#include <bootutil/sign_key.h>
58#include <mcuboot_config/mcuboot_config.h>
59
60#if defined(MCUBOOT_SIGN_RSA)
61const unsigned char rsa_pub_key[] = {
62 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xd1, 0x06, 0x08,
63 0x1a, 0x18, 0x44, 0x2c, 0x18, 0xe8, 0xfb, 0xfd, 0xf7, 0x0d, 0xa3, 0x4f,
64 0x1f, 0xbb, 0xee, 0x5e, 0xf9, 0xaa, 0xd2, 0x4b, 0x18, 0xd3, 0x5a, 0xe9,
65 0x6d, 0x18, 0x80, 0x19, 0xf9, 0xf0, 0x9c, 0x34, 0x1b, 0xcb, 0xf3, 0xbc,
66 0x74, 0xdb, 0x42, 0xe7, 0x8c, 0x7f, 0x10, 0x53, 0x7e, 0x43, 0x5e, 0x0d,
67 0x57, 0x2c, 0x44, 0xd1, 0x67, 0x08, 0x0f, 0x0d, 0xbb, 0x5c, 0xee, 0xec,
68 0xb3, 0x99, 0xdf, 0xe0, 0x4d, 0x84, 0x0b, 0xaa, 0x77, 0x41, 0x60, 0xed,
69 0x15, 0x28, 0x49, 0xa7, 0x01, 0xb4, 0x3c, 0x10, 0xe6, 0x69, 0x8c, 0x2f,
70 0x5f, 0xac, 0x41, 0x4d, 0x9e, 0x5c, 0x14, 0xdf, 0xf2, 0xf8, 0xcf, 0x3d,
71 0x1e, 0x6f, 0xe7, 0x5b, 0xba, 0xb4, 0xa9, 0xc8, 0x88, 0x7e, 0x47, 0x3c,
72 0x94, 0xc3, 0x77, 0x67, 0x54, 0x4b, 0xaa, 0x8d, 0x38, 0x35, 0xca, 0x62,
73 0x61, 0x7e, 0xb7, 0xe1, 0x15, 0xdb, 0x77, 0x73, 0xd4, 0xbe, 0x7b, 0x72,
74 0x21, 0x89, 0x69, 0x24, 0xfb, 0xf8, 0x65, 0x6e, 0x64, 0x3e, 0xc8, 0x0e,
75 0xd7, 0x85, 0xd5, 0x5c, 0x4a, 0xe4, 0x53, 0x0d, 0x2f, 0xff, 0xb7, 0xfd,
76 0xf3, 0x13, 0x39, 0x83, 0x3f, 0xa3, 0xae, 0xd2, 0x0f, 0xa7, 0x6a, 0x9d,
77 0xf9, 0xfe, 0xb8, 0xce, 0xfa, 0x2a, 0xbe, 0xaf, 0xb8, 0xe0, 0xfa, 0x82,
78 0x37, 0x54, 0xf4, 0x3e, 0xe1, 0x2b, 0xd0, 0xd3, 0x08, 0x58, 0x18, 0xf6,
79 0x5e, 0x4c, 0xc8, 0x88, 0x81, 0x31, 0xad, 0x5f, 0xb0, 0x82, 0x17, 0xf2,
80 0x8a, 0x69, 0x27, 0x23, 0xf3, 0xab, 0x87, 0x3e, 0x93, 0x1a, 0x1d, 0xfe,
81 0xe8, 0xf8, 0x1a, 0x24, 0x66, 0x59, 0xf8, 0x1c, 0xab, 0xdc, 0xce, 0x68,
82 0x1b, 0x66, 0x64, 0x35, 0xec, 0xfa, 0x0d, 0x11, 0x9d, 0xaf, 0x5c, 0x3a,
83 0xa7, 0xd1, 0x67, 0xc6, 0x47, 0xef, 0xb1, 0x4b, 0x2c, 0x62, 0xe1, 0xd1,
84 0xc9, 0x02, 0x03, 0x01, 0x00, 0x01
85};
86const unsigned int rsa_pub_key_len = 270;
87#elif defined(MCUBOOT_SIGN_EC)
88/* Format of PEM :
89 * -----BEGIN PUBLIC KEY-----
90 * base64encode(DER)
91 * -----END PUBLIC KEY----- */
92#if defined(ECC224_KEY_FILE)
93#include ECC224_KEY_FILE
94#else
95#warning "Used default ECC224 ecdsa_pub_key"
96/* It is OEM_PUB_KEY at this moment for debug purposes */
97/* Autogenerated by imgtool.py, do not edit. */
98const unsigned char ecdsa_pub_key[] = {
99 0x30, 0x4e, 0x30, 0x10, 0x06, 0x07, 0x2a, 0x86,
100 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x05, 0x2b,
101 0x81, 0x04, 0x00, 0x21, 0x03, 0x3a, 0x00, 0x04,
102 0xa5, 0x8b, 0x18, 0xa4, 0x60, 0x37, 0xf7, 0x0d,
103 0x2b, 0x06, 0xba, 0x4b, 0x4c, 0xd7, 0x8d, 0xec,
104 0x2a, 0x32, 0x5a, 0x0e, 0x52, 0xf4, 0x1b, 0x7c,
105 0x99, 0xec, 0x68, 0x5d, 0x05, 0xc3, 0x6b, 0x7b,
106 0x40, 0x9c, 0xaa, 0xac, 0x90, 0xf4, 0xfc, 0xbe,
107 0x98, 0xe5, 0x3e, 0x86, 0x3d, 0x37, 0xbf, 0x45,
108 0x78, 0x92, 0x27, 0xca, 0x69, 0xe6, 0xf2, 0xc5,
109};
110const unsigned int ecdsa_pub_key_len = 80;
111#endif
112#elif defined(MCUBOOT_SIGN_EC256)
113/* Format of PEM :
114 * -----BEGIN PUBLIC KEY-----
115 * base64encode(DER)
116 * -----END PUBLIC KEY----- */
117#if defined(ECC256_KEY_FILE)
118#include ECC256_KEY_FILE
119#else
120#warning "Used default ECC256 ecdsa_pub_key"
121/* It is OEM_PUB_KEY at this moment for debug purposes */
122const unsigned char ecdsa_pub_key[] = {
123 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
124 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a,
125 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
126 0x42, 0x00, 0x04, 0xbd, 0x59, 0x9d, 0x15, 0xe0,
127 0xff, 0x66, 0x12, 0x37, 0x28, 0xdf, 0x50, 0x38,
128 0xb1, 0x9a, 0x73, 0x9b, 0xbd, 0xd1, 0xb3, 0x8a,
129 0x6f, 0xd2, 0x70, 0xed, 0x7f, 0xdb, 0x57, 0x53,
130 0xde, 0x9e, 0x77, 0x0f, 0x9c, 0x17, 0x22, 0x69,
131 0xa6, 0x75, 0x48, 0x1f, 0xa4, 0xbc, 0x49, 0xe2,
132 0x01, 0xe0, 0x5e, 0x3d, 0xec, 0xa8, 0xc1, 0xca,
133 0xc5, 0x5c, 0xa2, 0xc6, 0xfd, 0xb0, 0x24, 0xb1,
134 0x0a, 0x46, 0xf5,
135};
136const unsigned int ecdsa_pub_key_len = 91;
137#endif
138#else
139#warning "No public key available for given signing algorithm."
140#endif
141
142#if defined(MCUBOOT_SIGN_RSA) || \
143 defined(MCUBOOT_SIGN_EC) || \
144 defined(MCUBOOT_SIGN_EC256)
145const struct bootutil_key bootutil_keys[] = {
146#if defined(MCUBOOT_SIGN_RSA)
147 {
148 .key = rsa_pub_key,
149 .len = &rsa_pub_key_len,
150 },
151#elif defined(MCUBOOT_SIGN_EC) || \
152 defined(MCUBOOT_SIGN_EC256)
153 {
154 .key = ecdsa_pub_key,
155 .len = &ecdsa_pub_key_len,
156 },
157#else
158 {
159 .key = NULL,
160 .len = 0x00,
161 },
162#endif
163};
164const int bootutil_key_cnt = 1;
165#endif