Add secure communication#31
Merged
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR brings the capability to secure communication between IMServer and IMBootloader.
The security mechanism is based on Monocypher.
How it works
The client (IMBootloader) and server (IMServer) exchange the keys to calculate the shared key. The shared key is used to encrypt the file (firmware or new bootloader) on the server side and decrypt the file on the client side.
Purpose
Protection from cloners.
Protection from malicious software attacks.
Current support
Currently, it only supports the STM32H7 MCUs family.
Usage
Build it with:
make stm32h7xx secure=truemake matek_H7_slim secure=trueThis will set a SECURED macro that will activate code for a secure bootloader.
Man In The Middle attack prevention
Each time communication is started new keys are generated. This means each time different data is sent from server to client, in other words, captured data can't be used to flash it to another board with the same bootloader.
Pre-shared protection
In order for a file that is arriving to be fully protected Flash read protection needs to be activated at IMBootlaoader.
This way the pre-shared key is protected from JTAG/SWD readout.
If the SECURED flag is enabled, IMBootloader will prevent any unencrypted data to be written.
Other
When a secure bootloader is flashed loading unencrypted data with IMFlasher is disabled by default to prevent malicious software injection.