Add support for creating self-decrypting binaries, and use 4-way AES key shares instead of just the AES key#207
Conversation
8ad52d7 to
28c0335
Compare
|
|
|
A few other random thoughts
|
|
I wonder if we should explicitly zero unused RAM in the LOAD_MAP of the self-encrypting binary (probably) |
These only cause issues when encrypting, as the old block needs to be included in the new load_map When signing, the old load_map can be used again without issue
Prints XXs for any rows with permissions failures Also, add `--pages` option to index by page & row (eg 63:56) rather than hex (eg 0ff8)
Modify aes.S init_key_4way to skip the 64 byte gap in the middle of the otp key share Uses 5 words of space
f0226e9 to
6743582
Compare
|
See the encrypted-shares-ci branch for passing CI, which now requires different SDK and examples branches due to the examples build test |
Perhaps the original comment in this PR ought to be updated to say which other pico-sdk and pico-examples PRs ought to be merged before (or in parallel with?) this PR. |
Add more notes to AES readme, fix error message, and remove commented CMake line
More details will be in the C SDK book
| picotool encrypt [--quiet] [--verbose] [--embed] [--fast-rosc] [--use-mbedtls] [--otp-key-page <page>] [--hash] [--sign] <infile> [-t | ||
| <type>] [-o <offset>] <outfile> [-t <type>] <aes_key> <iv_salt> <signing_key> <otp> |
There was a problem hiding this comment.
How hard would it be to modify the line-wrapping to prevent a line-break getting inserted in the middle of e.g. [-t <type>] ?
There was a problem hiding this comment.
I think that's handled by the CLIPP library, so probably a question for @kilograham whether we want to change that code?
Lines 317 to 363 in c56c005
There was a problem hiding this comment.
Okay, sounds like There Be Dragons 🐉
kilograham
left a comment
There was a problem hiding this comment.
Not convinced that's much more helpful. Really thinking about something that helps the user know what happened and what to do - in the RP2040 case it doesn't really make sense to be signing anyway, no?
It is a valid use case to be sealing an RP2040 binary, as an RP2350 may want to hash/signature check an RP2040 binary before loading it onto an RP2040. Would this error message be clearer: |
This is required due to 2.1.0 and 2.1.1 SDK releases pointing at picotool develop branch rather than the respective picotool releases (raspberrypi/pico-sdk#2401)
This adds support for creating self-decrypting binaries, which can be created using
This introduces a breaking change to
picotool encryptto take a 4-way AES key share, rather than just taking an AES key, as this makes it simpler to mask the power signature when decrypting the binary. The only difference from a user perspective is that they now need to use a 1024 bit binary file instead of the 256 bit file used before. The AES key is derived from the 4-way share as follows:This also introduces a breaking change that
picotool encryptnow requires an IV salt binary to be passed to it as the 4th file, so the signing_key is now the 5th file and the OTP JSON is now the 6th file.This PR should be merged in parallel with raspberrypi/pico-sdk#2315 and raspberrypi/pico-examples#619 to avoid breaking the pico-examples encrypted bootloader compilation