Skip to content

Commit 0d2485e

Browse files
committed
Initial switch to ecsda
1 parent 4ae1350 commit 0d2485e

11 files changed

+137
-458
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ Using JFlash or JFlashLite is possible to upload the MCUBoot bootloader binary t
1515
### Arduino Sketch
1616
Running this [sketch](https://github.com/bcmi-labs/mcuboot-portenta-boot/blob/boot_sketch/tools/PortentaMCUBootQSPIFormat.ino) will upload the last released MCUBoot bootloader to the board.
1717

18+
## Keys customization
19+
The bootloder comes with a preloaded set of default keys for signing and encryption. !!!WARNING!!! The default keyset is public therefore is not safe to use them for production, they are included only for evaluation purpose. Keys can be manually regenerated and included in the build flow to provide a real security layer to custom projects.
20+
21+
```
22+
imgtool keygen -k ecsdsa-p256-signing-key.pem -t ecdsa-p256
23+
imgtool keygen -k ecsdsa-p256-encrypt-key.pem -t ecdsa-p256
24+
imgtool getpub -k ecsdsa-p256-signing-key.pem > ecsdsa-p256-signing-key.c
25+
imgtool getpriv -k ecsdsa-p256-encrypt-key.pem > ecsda-p256-encrypt-key.c
26+
```
1827

1928
## Build from source
2029

ecsda-p256-encrypt-key.c

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/* Autogenerated by imgtool.py, do not edit. */
2+
#if MCUBOOT_INCLUDE_KEYS
3+
const unsigned char enc_priv_key[256] __attribute__ ((section (".encrypt_key"), used)) = {
4+
0x30, 0x81, 0x87, 0x02, 0x01, 0x00, 0x30, 0x13,
5+
0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
6+
0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d,
7+
0x03, 0x01, 0x07, 0x04, 0x6d, 0x30, 0x6b, 0x02,
8+
0x01, 0x01, 0x04, 0x20, 0x79, 0x72, 0xb6, 0xf3,
9+
0x62, 0x91, 0x09, 0xbb, 0x35, 0x22, 0xb8, 0x54,
10+
0x32, 0x3b, 0xfe, 0x1c, 0x9f, 0xa7, 0x10, 0x6f,
11+
0xba, 0xaf, 0x73, 0x64, 0xd3, 0xf5, 0x31, 0xbc,
12+
0x28, 0xe7, 0xc9, 0x72, 0xa1, 0x44, 0x03, 0x42,
13+
0x00, 0x04, 0x6a, 0xc9, 0x20, 0x4c, 0x96, 0xd6,
14+
0x89, 0xe8, 0xd1, 0x6e, 0x51, 0x04, 0x02, 0x86,
15+
0xe8, 0x95, 0x0b, 0x22, 0xc4, 0xc9, 0x95, 0x06,
16+
0x4f, 0xf5, 0x1b, 0xf6, 0xd0, 0xe3, 0x83, 0xd9,
17+
0xd1, 0x81, 0x66, 0x6e, 0xf2, 0x07, 0x3b, 0x03,
18+
0xdb, 0xe4, 0xd1, 0xde, 0x7c, 0x43, 0x70, 0x8d,
19+
0xa2, 0x89, 0xeb, 0x1b, 0xfa, 0xbe, 0x02, 0x5e,
20+
0x5c, 0xa0, 0x12, 0xdc, 0x23, 0x31, 0xc1, 0xe0,
21+
0x37, 0xb0,
22+
};
23+
#else
24+
const unsigned char enc_priv_key[256] __attribute__ ((section (".encrypt_key"), used)) = {
25+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
26+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
27+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
28+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
29+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
30+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
31+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
32+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
33+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
34+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
35+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
36+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
38+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
39+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
40+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
41+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
42+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
43+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
44+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
45+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
46+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
47+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
48+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
49+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
50+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
51+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
52+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
53+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
54+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
55+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
56+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
57+
};
58+
#endif
59+
const unsigned int enc_priv_key_len = 138;

ecsdsa-p256-encrypt-key.pem

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgeXK282KRCbs1IrhU
3+
Mjv+HJ+nEG+6r3Nk0/UxvCjnyXKhRANCAARqySBMltaJ6NFuUQQChuiVCyLEyZUG
4+
T/Ub9tDjg9nRgWZu8gc7A9vk0d58Q3CNoonrG/q+Al5coBLcIzHB4Dew
5+
-----END PRIVATE KEY-----

ecsdsa-p256-signing-key.c

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* Autogenerated by imgtool.py, do not edit. */
2+
#if MCUBOOT_INCLUDE_KEYS
3+
const unsigned char ecdsa_pub_key[256] __attribute__ ((section (".signing_key"), used)) = {
4+
0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86,
5+
0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a,
6+
0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
7+
0x42, 0x00, 0x04, 0xd5, 0x16, 0x35, 0x26, 0xc3,
8+
0x3b, 0xad, 0x4d, 0x67, 0x8e, 0x43, 0x24, 0xc4,
9+
0x98, 0xe9, 0x6b, 0x2e, 0xbe, 0x0d, 0xa3, 0xf1,
10+
0xf4, 0x97, 0x80, 0x7b, 0x31, 0x32, 0x07, 0xd9,
11+
0x95, 0xa7, 0x17, 0x57, 0x69, 0x43, 0x7b, 0xe9,
12+
0xc8, 0xaa, 0xd0, 0x0a, 0x0c, 0x86, 0x0b, 0xe3,
13+
0x7f, 0x99, 0x88, 0x51, 0xc4, 0xf9, 0x22, 0x98,
14+
0xbe, 0x5e, 0xaa, 0xfd, 0x90, 0x3c, 0xa2, 0x74,
15+
0x18, 0x49, 0x05,
16+
};
17+
#else
18+
const unsigned char ecdsa_pub_key[256] __attribute__ ((section (".signing_key"), used)) = {
19+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
20+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
21+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
22+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
23+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
24+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
25+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
26+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
27+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
28+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
29+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
30+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
31+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
32+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
33+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
34+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
35+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
36+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
37+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
38+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
39+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
40+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
41+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
42+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
43+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
44+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
45+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
46+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
47+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
48+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
49+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
50+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
51+
};
52+
#endif
53+
const unsigned int ecdsa_pub_key_len = 91;

ecsdsa-p256-signing-key.pem

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgx7NPA8ciVn4ZF6tp
3+
wW8dRJpfN3098/hTLmP1uVEEMr+hRANCAATVFjUmwzutTWeOQyTEmOlrLr4No/H0
4+
l4B7MTIH2ZWnF1dpQ3vpyKrQCgyGC+N/mYhRxPkimL5eqv2QPKJ0GEkF
5+
-----END PRIVATE KEY-----

0 commit comments

Comments
 (0)