Contents

HSMs, SHE and secure key storage

Protected hardware keeps secret keys away from ordinary software and controls how an ECU can use them.

6 min read · Discipline stake: Hardware Security BSW Software

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:

Classic crypto request
CallerRequests an operation using a key identifier
CsmManages configured crypto jobs
CryIfRoutes to the configured driver
Crypto DriverInvokes the selected implementation
HSM or SHEUses the protected key internally

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.

MAC generation with a protected key
Application
CsmCrypto Service Manager
HSMHolds the non-exportable key
Request MACMessage and configured job
Generate MACVia CryIf and Crypto Driver
Compute MACAuthorized operation; key stays inside
MAC resultVia Crypto Driver and CryIf
MAC result

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.

What it means for your discipline

  • Hardware & silicon Core

    Selects the security hardware, checks isolated memory and debug access, and validates entropy, power and reset behaviour. Reviews evidence of resistance to physical attacks rather than relying on an HSM label.

  • Cybersecurity Partial

    Defines which attackers the hardware must resist, which callers may use each key, and what provisioning and recovery must enforce. Reviews supplier security evidence and tests key misuse: protected storage alone does not prevent compromised software from requesting valid cryptographic operations.

  • Base software Partial

    Maps AUTOSAR crypto jobs and key identifiers to hardware services, configures queues and permissions, and handles timeouts and unavailable keys.

  • HPC & application software Partial

    Uses key handles instead of copying secrets into application memory. On central computers, integrates crypto providers and trusted services while checking which operations actually remain inside protected hardware.

No direct stake: E/E architecture · Functional safety · Networks & communication · Diagnostics & lifecycle · Software update & OTA

Where it sits in the software stack

Generic layered software of a central HPC (application processor with hypervisor, plus a safety island) and of a classic MCU-based ECU (AUTOSAR Classic). Highlighted modules matter for this topic. Click any module to open its page.

HPC · application processor (MPU) and safety island (MCU)
  • Security services — Routes cryptographic requests to protected providers and enforces permissions on key use.
  • AUTOSAR Adaptive — Exposes ara::crypto interfaces whose providers determine key storage, export restrictions and hardware execution.
  • Secure boot chain · TEE — Uses TEE isolation to protect trusted software and hardware-backed key operations.
  • Boot ROM · HSM — Uses the safety island HSM for protected keys and supported boot authentication operations.
MCU-based ECU · AUTOSAR Classic
  • Microcontroller · HSM — Hosts HSM or SHE functions that isolate keys, check permissions and execute supported cryptographic operations.
  • Memory · crypto · WdgM — Routes Csm jobs through CryIf and Crypto Drivers to the configured hardware backend.
  • Flash bootloader · secure boot — Enforces hardware boot verification results and extends authentication checks to subsequent executable stages.