-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add support for creating self-decrypting binaries #2315
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
e684dcc
to
4c7b909
Compare
For now, this function embeds the decrypting bootloader, but probably better to integrate (or replace) existing pico_encrypt_binary function
Add newlines for readability, and explain why MbedTLS version is insecure
4c7b909
to
fd83496
Compare
…e examples compilation passes
# Encrypt the target binary with the given AES key (should be a binary | ||
# file containing 32 bytes of a random key), and sign the encrypted binary. | ||
# This sets PICOTOOL_AESFILE to AESFILE, and PICOTOOL_ENC_SIGFILE to SIGFILE | ||
# if present, else PICOTOOL_SIGFILE. | ||
function(pico_encrypt_binary TARGET AESFILE) | ||
# file containing 128 bytes of a random key), and sign the encrypted binary. |
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 guess this is now a 128-byte file (key share) OR a 32 byte file (key) OR a 64-character hex string (key) ?
# Salts the public IV with the provided IVFILE (should be a binary file | ||
# containing 16 bytes of a random IV), to give the IV used by the encryption. |
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.
And similarly I guess this is now a 16-byte file OR a 32-char hex string?
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.
...although I guess if you tried specifying a hex-string here that'd mess up the later pico_add_link_depend
step!
This adds extra functionality to the
pico_encrypt_binary
function to allow creating self-decrypting binaries, including specifying the OTP page to use for the AES key.The main non-backwards-compatible change is the addition of a new IV salt bin file which is required and must be passed as the second argument. This will break any uses of
pico_encrypt_binary
, and has been added for security purposes, as we now salt the public IV with a salt stored in OTP.The other non-backwards-compatible change it that if you previously called:
you now need to call
due to the new argument parsing. I think that this is fine, because the only time you'd pass a separated
SIGFILE
topico_encrypt_binary
is when you're using a different signing key for the binary vs the encrypted blob, which is not a common use case.This PR requires use of the picotool encrypted-shares branch (raspberrypi/picotool#207), so should be merged after that.