mcuboot
mcuboot copied to clipboard
scripts: imgtool: added fixed signature script option
This PR adds the option of passing fix-sig-script as an external script to be called for signature generation, to then let the process continue as if it had generated the signature itself.
The current flow
To use a public key and an external signature provider, you'd have to:
- Run
imgtoolwith--vector-to-signto save the vector - Fetch public key corresponding to signature generation
- Call external script with the vector to sign, save or otherwise pass signature
- Run
imgtoolagain, this time providing it with--fix-sigand--fix-sig-pubkey - Have signed image
New possible flow with proposed changes
- Fetch public key corresponding to signature generation
- Run
imgtoolwith--fix-sig-scriptand--fix-sig-pubkeymatching - Have signed image
Codebases or other downstream dependencies that rely on baking in calls to imgtool and mainly having a singular call in the normal path, but otherwise taking in all imgtool options now gets to keep that, and simply provide the script as an extra option, but not needing a different flow from e.g. a debug build.
This lets the difference between e.g. a debug and a release build be entirely managed in the signature script, and so lets the same pipeline be used opaquely while still generating different builds signed with different keys depending on e.g. the environment it is run in.
@nordicjm @gchwier Any thoughts or inputs to this PR? We're specifically using this internally with good success and a subsequent patch to the b0_mcuboot_signing.cmake