1
1
### Secure Boot
2
2
3
- Some boards supports the secure boot. Basically the compiled sketch can be signed and encrypted with a
4
- [ tool] ( ../platform-specification.md#tools ) before being flashed to the target board. The bootloader of the board is then
5
- responsible for starting the compiled sketch if the matching keys are used.
3
+ A "secure boot" capability may be offered by Arduino boards platforms.
4
+
5
+ The compiled sketch is signed and encrypted by a [ tool] ( ../platform-specification.md#tools ) before being flashed to the
6
+ target board. The bootloader of the board is then responsible for starting the compiled sketch only if the matching keys
7
+ are used.
6
8
7
9
To be able to correctly carry out all the operations at the end of the build we can leverage the
8
10
[ post build hooks] ( ../platform-specification.md#pre-and-post-build-hooks-since-arduino-ide-165 ) to sign and encrypt a
9
11
binary by using ` recipe.hooks.objcopy.postobjcopy.NUMBER.pattern ` key in
10
- [ ` platform.txt ` ] ( ../platform-specification.md#platformtxt ) . The security keys used are defined in the boards file, this
11
- way there could be different keys for different boards.
12
+ [ ` platform.txt ` ] ( ../platform-specification.md#platformtxt ) . The security keys used are defined in the
13
+ [ ` boards.txt ` ] ( ../platform-specification.md#boardstxt ) file, this way there could be different keys for different
14
+ boards.
12
15
13
16
```
14
17
[...]
15
- ## Create output secure image (bin file)
18
+ ## Create secure image (bin file)
16
19
recipe.hooks.objcopy.postobjcopy.1.pattern={build.postbuild.cmd}
20
+
17
21
#
18
22
# IMGTOOL
19
23
#
20
-
21
24
tools.imgtool.cmd=imgtool
22
25
tools.imgtool.build.pattern=sign --key "{build.keys.keychain}/{build.keys.sign_key}" --encrypt "{build.keys.keychain}/{build.keys.encrypt_key}" "{build.path}/{build.project_name}.bin" "{build.path}/{build.project_name}.bin" --align {build.alignment} --max-align {build.alignment} --version {build.version} --header-size {build.header_size} --pad-header --slot-size {build.slot_size}
23
26
[...]
@@ -38,17 +41,15 @@ envie_m7.menu.security.sien=Signature + Encryption
38
41
envie_m7.menu.security.sien.build.postbuild.cmd="{tools.imgtool.cmd}" {tools.imgtool.build.pattern}
39
42
envie_m7.menu.security.none.build.postbuild.cmd="{tools.imgtool.cmd}" exit
40
43
41
- envie_m7.menu.security.sien.build.keys.type=public_keys
42
44
envie_m7.menu.security.sien.build.keys.keychain={runtime.hardware.path}/Default_Keys
43
45
envie_m7.menu.security.sien.build.keys.sign_key=default-signing-key.pem
44
46
envie_m7.menu.security.sien.build.keys.encrypt_key=default-encrypt-key.pem
45
47
[...]
46
48
```
47
49
48
- Currently we support the secure boot only with ` build.keys.type=public_keys ` but in the future other ways can be added.
49
50
The security keys can be added with:
50
51
51
- - ` keys.keychain ` indicates the path of the dir where to search for the custom keys to sign and encrypt a binary.
52
- - ` keys.sign_key ` indicates the name of the custom signing key to use to sign a binary during the compile process.
53
- - ` keys.encrypt_key ` indicates the name of the custom encryption key to use to encrypt a binary during the compile
52
+ - ` build. keys.keychain` indicates the path of the dir where to search for the custom keys to sign and encrypt a binary.
53
+ - ` build. keys.sign_key` indicates the name of the custom signing key to use to sign a binary during the compile process.
54
+ - ` build. keys.encrypt_key` indicates the name of the custom encryption key to use to encrypt a binary during the compile
54
55
process.
0 commit comments