Add SHE Key Update operation#2692
Open
MannXo wants to merge 2 commits into
Open
Conversation
Generates the AUTOSAR SHE (Secure Hardware Extension) memory update protocol messages M1-M5 for loading a key into a SHE module. Supports the standard key slots, the SHE and SHE+ constants, and the protection flags. Verified against the AUTOSAR memory update protocol test vectors.
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.
Description
Adds a new SHE Key Update operation (Encryption / Encoding category) that generates the AUTOSAR SHE (Secure Hardware Extension) memory update protocol messages M1 to M5 used to load a key into a SHE module.
The input is the new key value (KEY_NEW, 16 bytes). M1, M2 and M3 are the messages sent to the SHE module to import the key, and M4 and M5 are the messages the module returns for verification. Keys K1 to K4 are derived from the authorising key and the new key with the SHE KDF, which is a Miyaguchi-Preneel one-way compression built on AES-128.
Options:
The operation reuses the existing node-forge dependency for AES and does not add any new libraries, keeping everything client-side.
Existing Issue
Closes #2679
Screenshots

AI disclosure
I have used Claude Code (Opus 4.8) but personally reviewed every change and verified the results.
Test Coverage
Added
tests/operations/tests/SHEKeyUpdate.mjswith five cases: three positive cases reproducing the AUTOSAR memory update protocol test vectors exactly (basic SHE, SHE with the KEY_USAGE flag, and the SHE+ constants), plus two invalid-input cases (a new key that is not 16 bytes, and a UID that is not 15 bytes). The full operation test suite passes.