ieee802154: MAC security procedure minus CCM* #578
Merged
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 implements the incoming and outgoing frame security procedures, save for the actual calls to CCM* encryption/decryption. That will have to wait for CBC encryption to be in mainline. Along the way, it also does the following things:
capsules::mac
: it turns out the radio already does this.AddressMode#from_mode
andseq_suppressed
inHeader#decode
. Thanks @ptcrews.Here's a few notes on the incoming security procedure: When a secured frame arrives, the process in this PR parses the header portion of the frame, unsecures it, and then re-parses the full header (including payload IEs). One could conceivably store the parts of the header that were already parsed and update them after unsecuring, but I chose not to do that because parsing is relatively fast (it's only a few bytes). Secondly, we expose plaintext frames to the user without removing the auxiliary security header. Technically, the IEEE 802.15.4 spec says that the unsecuring process should also remove this auxiliary security header and update the "Security present" bit, but this would prevent the user from ever knowing if the frame was secured. While this currently makes no difference, I think there might be a use-case for checking if the frame had link-layer security and performing some kind of business logic.