Skip to content

Add SHE Key Update operation#2692

Open
MannXo wants to merge 2 commits into
gchq:masterfrom
MannXo:she-key-update
Open

Add SHE Key Update operation#2692
MannXo wants to merge 2 commits into
gchq:masterfrom
MannXo:she-key-update

Conversation

@MannXo

@MannXo MannXo commented Jul 24, 2026

Copy link
Copy Markdown

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:

  • Authorising key (KeyAUTH) and UID.
  • Named key slots for the new key (ID) and the authorising key (AuthID): MASTER_ECU_KEY, BOOT_MAC_KEY, KEY_1 to KEY_10, RAM_KEY, and the rest of the standard slots.
  • 28-bit counter (CID).
  • SHE / SHE+ variant, which selects the memory update constants.
  • The six protection flags (write, boot, debugger, key usage, wildcard, verify only).

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
she_key_update

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.mjs with 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.

MannXo added 2 commits July 24, 2026 16:09
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.
@CLAassistant

CLAassistant commented Jul 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal for Adding SHE Key Generation Function

2 participants