raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.94k stars 844 forks source link

Output OTP decryption key JSON file for `encrypted` example always uses example key (`00010203...`) #528

Closed 0xTJ closed 1 month ago

0xTJ commented 3 months ago

In the example at bootloaders/encrypted, the README.md file gives instructions on how to generate a new AES key with the command:

dd if=/dev/urandom of=privateaes.bin bs=1 count=32

However, the otp.json file in the CMake build binary directory, which contains the data to be programmed into the decryption key OTP rows , is simply a copy of the otp.json in the example directory. This can be confusing to the user since, if (the CMake binary directory copy of) otp.json is used to program OTP, the example key will be permanently burned into OTP, when they might expect the new key to be used instead.

This is particularly confusing as the signing key is correctly filed out (by picotool) to hello_serial_enc.otp.json. I believe that there should either be a note indicating that the key in otp.json will not be updated with a newly-generated key, or some script/instructions for generating a decryption key OTP file (from privateaes.bin) should be added.

will-v-pi commented 1 month ago

Merged into develop