-
Notifications
You must be signed in to change notification settings - Fork 132
Add support for creating self-decrypting binaries, and use 4-way AES key shares instead of just the AES key #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
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) |
enc_bootloader requires SDK 2.1.2 rename binary_data to embedded_data move mbedtls TODO into header
expand comment on configuring mbedtls 2.0.0->2.1.2 message reword mbedtls todo
These would mess up signing/encryption of an already signed/encrypted binary
Remove they -t argument from all key files (bin & pem) and JSON files, as they should always have the correct extension so it's not necessary
Implement suggested changes, and add note about IV salt
Specify file types where useful for untyped files (json, pem, bin) Expand IV salt description Abstract filename_to_hex_array into separate function
Remove uneccessary extra setup, which isn't actually required and throws deprecation warnings in CMake 4.0.0
…ach OTP page Disabled for now behind `#if FIB_WORKAROUND`, until the bootloader change to handle this is implemented
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 |
<signing_key> | ||
Signing Key file | ||
<otp> | ||
File to save OTP to (will edit existing file if it exists) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that in main.cpp
this has been updated to "JSON file to save OTP to (will edit existing file if it exists)", so I guess you might want to use #220 here? 😀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I think I'll merge #220 into develop, then merge develop into here again and run it
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
This adds support for creating self-decrypting binaries, which can be created using
This introduces a breaking change to
picotool encrypt
to 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 encrypt
now 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