Why it exists
A strong encryption algorithm cannot protect a key that an attacker can simply read. Secrets stored in ordinary flash or working memory may escape through a software vulnerability, an unlocked debug port or a compromised production tool. A copied key can let someone impersonate an electronic control unit (ECU) or create messages that appear authentic.
Hardware protection gives keys a boundary separate from ordinary application software. Software asks the protected component to perform an operation and receives the result. It does not need to receive the secret itself.
That boundary also needs rules. If compromised software can request arbitrary message authentication, it may misuse a key without extracting it. Keeping a key secret and controlling its use are separate requirements.
What it is
A hardware security module (HSM) combines protected key handling with cryptographic operations. In automotive systems, the term often means a security subsystem inside a microcontroller (MCU).
Secure Hardware Extension (SHE) is a smaller, defined set of security functions. The AUTOSAR Specification of Secure Hardware Extensions specifies the Advanced Encryption Standard with 128-bit keys (AES-128) and cipher-based message authentication codes (CMACs). A message authentication code (MAC) checks authenticity and integrity using a shared secret. SHE provides logical key slots with defined roles and protection attributes, rather than ordinary addresses from which software reads secret bytes.
The EVITA research project—E-safety Vehicle Intrusion proTected Applications—described HSM classes with different capability and cost targets:
| Class | Intended emphasis |
|---|---|
| Full | Richer protection and cryptographic capabilities, including asymmetric operations for demanding security functions. |
| Medium | Protected processing and symmetric cryptography for in-vehicle applications. |
| Light | A smaller symmetric-crypto implementation for constrained controllers. |
These are architectural reference classes, not interchangeable product certifications. SHE and EVITA-light address similar constrained use cases, but the labels do not establish identical interfaces or attack resistance.
Modern MCU HSMs often contain their own processing core, isolated memory, crypto accelerators and a true random number generator (TRNG). Accelerators execute supported algorithms efficiently. The TRNG obtains entropy from a physical source; conditioning and health checks matter as much as its presence.
On a high-performance computer (HPC), other mechanisms complement an HSM:
| Mechanism | Main role |
|---|---|
| Trusted Platform Module (TPM) 2.0 | Protects keys and supports platform measurements, policy-based key use and attestation—evidence about platform state. |
| Trusted execution environment (TEE), such as one built using Arm TrustZone | Isolates trusted software and its memory from the normal operating environment. |
TrustZone supplies isolation mechanisms; a complete TEE also needs trusted software and correct system configuration. Neither a TEE nor a TPM label alone establishes resistance to physical attacks.
How it works
The host submits data, an operation and a key identifier. Protected logic checks permissions, accesses the key internally and returns a result. Persistent keys may occupy protected nonvolatile memory or be stored externally as encrypted, integrity-protected objects bound to a hardware-held root secret.
In AUTOSAR Classic, requests follow the crypto stack:
Hardware protection depends on the selected driver and backend.
The Crypto Service Manager (Csm) manages jobs and priorities. The Crypto Interface (CryIf) routes requests to a Crypto Driver. A driver can use hardware or a software library, so using this stack does not automatically mean that keys have hardware protection.
AUTOSAR Adaptive exposes cryptographic services through ara::crypto. Providers connect those interfaces to available implementations. Integrators must verify where keys reside, whether export is possible and which callers may use them.
For SHE secure boot, the hardware checks a configured boot region against an expected MAC using a protected boot key. This authenticates that region; it does not encrypt the program. Trusted boot logic must enforce the result and extend checking to subsequent executable stages. MAC verification alone also does not prevent rollback to an older, correctly authenticated image.
Production provisioning establishes the initial trust. A controlled station authenticates the device and loads protected key material, or requests key generation inside capable hardware. Where supported, private keys stay inside while public keys leave for certification. Provisioning records bind device identity, credentials and lifecycle state. SHE supports an authenticated key-update protocol that protects transported keys and counters replay. Production procedures must also handle interrupted programming and verify protection settings before shipment.
This example assumes a configured HSM backend and a non-exportable key; intermediate routing and job completion details are simplified.
When to use it — and when not
Use hardware-backed storage for long-lived device identities, boot trust anchors and authentication secrets whose extraction would enable impersonation. A brake ECU or front-left zone controller may need bounded latency for message authentication. A central HPC may additionally need TPM-backed platform evidence and a TEE for trusted services.
Choose SHE when its symmetric algorithms, slot model and boot functions meet the requirements. Choose a programmable HSM when broader algorithms, flexible policy or additional protected processing are needed.
Public verification keys do not need secrecy, but they do need integrity protection. Software cryptography can suit development and operations on public data. A crypto accelerator that reads keys from ordinary memory improves speed without necessarily providing secure storage.
Best practices
- Define key purposes, authorized callers, export rules and replacement paths before selecting hardware.
- Separate development and production credentials. Use device-specific identities and limit the impact of any shared secrets.
- Check side-channel resistance: timing, power consumption and electromagnetic emissions can reveal information about secret operations.
- Check fault-injection resistance: disturbed voltage, clocks or electromagnetic conditions can corrupt execution or bypass checks. Ask for evaluation evidence covering the actual implementation.
- Measure end-to-end latency under competing workloads, including queueing, memory transfers and hardware startup.
- Plan authenticated recovery, key rotation, debug restrictions and decommissioning. Verify that interruption during provisioning cannot leave an ambiguous lifecycle state.
Common pitfalls
- Treating “HSM-equipped” as proof of tamper resistance. Isolation, entropy quality and physical protection vary.
- Copying protected keys into host memory for convenience, defeating the intended boundary.
- Allowing every application to use every key. Non-exportable keys can still be abused through overly broad permissions.
- Confusing measured boot with enforced secure boot. Recording measurements does not itself stop execution.
- Assuming a successful boot MAC proves that all running software is trusted, current and free from vulnerabilities.