Initial commit
Initial commit.
This commit is contained in:
56
bootloader/mcuboot/boot/espressif/keys.c
Normal file
56
bootloader/mcuboot/boot/espressif/keys.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright (c) 2021 Espressif Systems (Shanghai) Co., Ltd.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <bootutil/sign_key.h>
|
||||
#include <mcuboot_config/mcuboot_config.h>
|
||||
|
||||
#if !defined(MCUBOOT_HW_KEY)
|
||||
#if defined(MCUBOOT_SIGN_RSA)
|
||||
#define HAVE_KEYS
|
||||
extern const unsigned char rsa_pub_key[];
|
||||
extern const unsigned int rsa_pub_key_len;
|
||||
#elif defined(MCUBOOT_SIGN_EC256)
|
||||
#define HAVE_KEYS
|
||||
extern const unsigned char ecdsa_pub_key[];
|
||||
extern const unsigned int ecdsa_pub_key_len;
|
||||
#elif defined(MCUBOOT_SIGN_ED25519)
|
||||
#define HAVE_KEYS
|
||||
extern const unsigned char ed25519_pub_key[];
|
||||
extern const unsigned int ed25519_pub_key_len;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NOTE: *_pub_key and *_pub_key_len are autogenerated based on the provided
|
||||
* key file. If no key file was configured, the array and length must be
|
||||
* provided and added to the build manually.
|
||||
*/
|
||||
#if defined(HAVE_KEYS)
|
||||
const struct bootutil_key bootutil_keys[] = {
|
||||
{
|
||||
#if defined(MCUBOOT_SIGN_RSA)
|
||||
.key = rsa_pub_key,
|
||||
.len = &rsa_pub_key_len,
|
||||
#elif defined(MCUBOOT_SIGN_EC256)
|
||||
.key = ecdsa_pub_key,
|
||||
.len = &ecdsa_pub_key_len,
|
||||
#elif defined(MCUBOOT_SIGN_ED25519)
|
||||
.key = ed25519_pub_key,
|
||||
.len = &ed25519_pub_key_len,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
const int bootutil_key_cnt = 1;
|
||||
#endif /* HAVE_KEYS */
|
||||
#else
|
||||
unsigned int pub_key_len;
|
||||
struct bootutil_key bootutil_keys[1] = {
|
||||
{
|
||||
.key = 0,
|
||||
.len = &pub_key_len,
|
||||
}
|
||||
};
|
||||
const int bootutil_key_cnt = 1;
|
||||
#endif /* !MCUBOOT_HW_KEY */
|
||||
Reference in New Issue
Block a user