11### Secure Boot
22
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.
68
79To be able to correctly carry out all the operations at the end of the build we can leverage the
810[ post build hooks] ( ../platform-specification.md#pre-and-post-build-hooks-since-arduino-ide-165 ) to sign and encrypt a
911binary 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.
1215
1316```
1417[...]
15- ## Create output secure image (bin file)
18+ ## Create secure image (bin file)
1619recipe.hooks.objcopy.postobjcopy.1.pattern={build.postbuild.cmd}
20+
1721#
1822# IMGTOOL
1923#
20-
2124tools.imgtool.cmd=imgtool
2225tools.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}
2326[...]
@@ -38,17 +41,15 @@ envie_m7.menu.security.sien=Signature + Encryption
3841envie_m7.menu.security.sien.build.postbuild.cmd="{tools.imgtool.cmd}" {tools.imgtool.build.pattern}
3942envie_m7.menu.security.none.build.postbuild.cmd="{tools.imgtool.cmd}" exit
4043
41- envie_m7.menu.security.sien.build.keys.type=public_keys
4244envie_m7.menu.security.sien.build.keys.keychain={runtime.hardware.path}/Default_Keys
4345envie_m7.menu.security.sien.build.keys.sign_key=default-signing-key.pem
4446envie_m7.menu.security.sien.build.keys.encrypt_key=default-encrypt-key.pem
4547[...]
4648```
4749
48- Currently we support the secure boot only with ` build.keys.type=public_keys ` but in the future other ways can be added.
4950The security keys can be added with:
5051
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
5455 process.
0 commit comments