Skip to main content
Be Bitwise

Hardware Security Mechanisms

Processor Security Features · CPU Architectures track

6 min read

In this module

Security Built Into Silicon

Software security measures fall the moment a software vulnerability finds them. Hardware security features sit at a layer software can't easily reach — a compromised OS still can't read data protected by hardware encryption, and a kernel exploit still can't forge a hardware-authenticated pointer. This lesson maps the major hardware security mechanisms baked into modern processors.

Intel SGX: Software Guard Extensions

Intel SGX carves out hardware-protected memory regions called enclaves. Code and data inside an enclave are encrypted in memory by the CPU itself. The data only decrypts when the CPU loads it into its internal registers and caches. The OS, the hypervisor, even someone snooping physical memory with a logic analyser — none of them can read enclave contents.

An enclave lives in a restricted environment. It can't make system calls directly (it has to exit the enclave, make the call, and re-enter), and its memory is capped — the Enclave Page Cache (EPC) originally sat at 128MB. Despite the constraints, SGX makes a handful of things possible:

  • Confidential computing: process sensitive data (medical records, financial transactions) on untrusted cloud servers
  • Secure key management: store and use cryptographic keys without exposing them to the OS
  • DRM: enforce content protection without trusting the entire software stack

SGX has taken a real beating from side-channel attacks. Foreshadow, Plundervolt, SGAxe and friends pulled enclave secrets out via cache timing, power analysis, and speculative execution. Intel has dropped SGX from consumer CPUs (11th gen and later) but keeps it alive on server platforms. Intel TDX (Trust Domain Extensions) is the spiritual successor for server confidential computing, protecting whole virtual machines rather than individual enclaves.

Enclave Measurement

Every enclave gets a cryptographic measurement — a hash of its initial code and data taken during creation. The measurement rides along inside attestation reports signed by the CPU's hardware key. A remote party can check that the enclave is running specific, unmodified code. If an attacker tampers with the code, the measurement shifts and attestation fails. That's the trick that lets confidential computing deliver verifiable guarantees to a remote party.

Here's how that plays out when a remote server wants to hand a secret, say a database key, to an enclave. The flow is simplified from SGX's DCAP attestation, but the shape is the same for every technology in this lesson:

The nonce stops an attacker replaying an old quote, and binding a key into the report means only that enclave can open the secret.

ARM TrustZone

ARM TrustZone splits the processor into two worlds. The Normal World runs the regular OS and applications. The Secure World runs trusted software. Hardware enforces the divide — Normal World code can't poke at Secure World memory or registers.

TrustZone takes a fundamentally different approach to SGX. Rather than protecting individual enclaves, it protects an entire execution environment. The Secure World runs a trusted OS (often OP-TEE) that hosts Trusted Applications (TAs). The Normal World talks to TAs through a defined API: the GlobalPlatform TEE Client API.

TrustZone is everywhere in mobile devices. It guards biometric data (fingerprints, face recognition), DRM key management, secure payment processing, and key storage. Android Keystore sits on top of it. Apple's Secure Enclave borrows similar concepts but goes further: it's a separate coprocessor with its own boot ROM and encrypted memory, built into the same SoC rather than running as a mode of the application cores. (Intel Macs with the T2 chip had it on that separate chip.) TrustZone isn't bulletproof either: bugs in vendors' trusted OSes, such as Qualcomm's QSEE, have repeatedly let normal-world attackers into the secure world.

AMD SEV: Secure Encrypted Virtualisation

AMD SEV encrypts VM memory with per-VM keys managed by the AMD Secure Processor — a dedicated ARM core tucked inside the main processor. The hypervisor can't read guest VM memory because the key isn't in its hands.

SEV evolved through three generations:

  • SEV: encrypts VM memory, but the hypervisor can still mess with encrypted pages
  • SEV-ES (Encrypted State): adds VM register state encryption on context switches
  • SEV-SNP (Secure Nested Paging): adds integrity protection, blocking the hypervisor from replaying or remapping encrypted pages

SEV-SNP is AMD's most complete answer so far — confidential VMs designed to hold up even against a compromised hypervisor. Designed to, not guaranteed to: researchers keep finding cracks, such as CacheWarp (2023), which abused cache invalidation to roll back guest memory, and ciphertext side channels that infer data from how encrypted pages change. It's AMD's counterpart to Intel TDX, and AWS, Azure, and Google Cloud all use it for their confidential computing offerings.

The four technologies draw the trust boundary in different places. What sits inside it is the trusted computing base (TCB): everything that has to be free of bugs and honest for the protection to hold.

SGX enclaveTrustZone trusted appSEV-SNP VMTDX trust domain
Your codeOnly the enclave partThe trusted appWhole guest OS and appsWhole guest OS and apps
Host or normal-world OSUntrustedUntrustedUntrustedUntrusted
HypervisorUntrustedUntrustedUntrustedUntrusted
Firmware and special codeCPU microcodeSecure-world OS and EL3 monitorAMD Secure Processor firmwareIntel's TDX module
SiliconCPUSoCCPUCPU

SGX has the smallest TCB, but it makes you split your application in two. The VM-based designs let you run unmodified software, at the cost of trusting an entire guest kernel.

Memory Encryption

Both Intel and AMD ship transparent memory encryption:

Intel TME (Total Memory Encryption): encrypts main memory with a single key, blocking physical memory snooping (cold boot attacks, bus probes). The key is generated at boot and never exposed to software.

Intel MKTME (Multi-Key TME): lets different memory regions use different keys, enabling per-VM or per-process encryption without the full weight of SGX or TDX.

AMD SME (Secure Memory Encryption): TME's AMD counterpart — single-key encryption of all memory.

These features protect data at rest in DRAM but do nothing against software attacks. The CPU decrypts data transparently for anyone with access to the virtual address.

Secure Boot Chain

A secure boot chain keeps unauthorised software off the device, starting from the hardware root of trust:

  1. ROM bootloader: burned into the chip at manufacturing. Trusted implicitly.
  2. First-stage bootloader: verified by the ROM bootloader against a built-in public key.
  3. Second-stage bootloader (UEFI): verified by the first stage.
  4. OS kernel: verified by UEFI Secure Boot against keys in the UEFI key database.
  5. Kernel modules/drivers: verified by the kernel against its keyring.

Each stage verifies the next before surrendering control. Any verification failure halts the boot dead. The chain stops bootkits — malware that loads before the OS gets a say — and lands the system in a known-good state every time it powers on.