-
Notifications
You must be signed in to change notification settings - Fork 958
Encrypted improvements #619
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
Merged
Merged
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6a6c18f
Use key share for AES file
will-v-pi e43e08b
Improve checking for malicious flash data
will-v-pi 55fee2f
Incorporate latest changes to aes.S
will-v-pi a7291e1
Encorporated latest encryption code with 4-way shares
will-v-pi b3a23e4
Apply encrypted-example 6de8084b6eda
will-v-pi 2b64157
Add hello_encrypted example
will-v-pi 805e007
Use new `enable_interrupts` function
will-v-pi d4ed998
Remove update-key.cmake
will-v-pi e8266aa
Add hello_encrypted to readme
will-v-pi bba9a5e
Update enc_bootloader with latest aes.S (picotool 333d571c)
will-v-pi bcce195
Add IV salts
will-v-pi 05557f5
Update with latest aes.S
will-v-pi ad9842a
Update readmes
will-v-pi d933765
Add secret file to print out
will-v-pi 522208e
Add notes about unique AES keys, and not losing keys/salts
will-v-pi c3bc79a
Update readmes
will-v-pi bde13d6
Fix enc_bootloader example OTP output
will-v-pi d0379cb
Remove OTP key locking functionality from encrypted examples
will-v-pi 4235e8f
Improve TBYB sequence
will-v-pi 25d5b43
Review fixups
will-v-pi 06295b4
Add MbedTLS self-decrypting example
will-v-pi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
Replace private.pem and privateaes.bin with your own keys - your signing key must be for the _secp256k1_ curve, in PEM format. You can create a .PEM file with: | ||
For security you **must** replace private.pem and privateaes.bin with your own keys, and ivsalt.bin with your own per-device salt. Make sure you **don't lose your keys and salts**, else you may not be able to update the code on your device. | ||
|
||
Your signing key must be for the _secp256k1_ curve, in PEM format. You can create a .PEM file with: | ||
|
||
```bash | ||
openssl ecparam -name secp256k1 -genkey -out private.pem | ||
``` | ||
|
||
The AES key is just be a 32 byte binary file - you can create one with | ||
The AES key is stored as a 4-way share in a 128 byte binary file - you can create one with | ||
|
||
```bash | ||
dd if=/dev/urandom of=privateaes.bin bs=1 count=128 | ||
``` | ||
Comment on lines
+9
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if it might be worth changing the |
||
|
||
or in Powershell 7 | ||
```powershell | ||
[byte[]] $(Get-SecureRandom -Maximum 256 -Count 128) | Set-Content privateaes.bin -AsByteStream | ||
``` | ||
|
||
The IV salt is just a 16 byte binary file - you can create it the same way, replacing `128` with `16` and `privateaes.bin` with `ivsalt.bin` in the commands above. | ||
|
||
You will need to program your OTP using the `otp.json` file generated by the build in your build folder | ||
NOTE: This will enable secure boot on your device, so only correctly signed binaries can then run, and will also lock down the OTP pages the AES key and IV salt are stored in. | ||
```bash | ||
dd if=/dev/urandom of=privateaes.bin bs=1 count=32 | ||
picotool otp load otp.json | ||
``` | ||
|
||
> For more information on security see chapter 10 of the [RP2350 datasheet](https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf), and for information on how to sign other binaries to run on a secure chip see section 5.10 | ||
Then either drag & drop the UF2 files to the device in order (enc_bootloader first, then hello_serial_enc) waiting for a reboot in-between, or run | ||
```bash | ||
picotool load enc_bootloader.uf2 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.