What is Secure enclave?

A TEE approach in which part of an application runs in a region whose memory the CPU encrypts and protects, hidden even from the OS and hypervisor.

Field: Hardware Security

Japanese name: エンクレーブ

How an enclave works

An enclave runs only the part of an application that handles secrets such as keys or personal data in a special memory region that the CPU protects. In Intel SGX, the best-known example, enclave pages are encrypted in main memory outside the CPU and decrypted only inside it. The CPU refuses reads and writes from code outside the enclave and, depending on the implementation, also detects tampering with the memory. The OS and hypervisor still handle memory allocation and scheduling, but they cannot read or modify the enclave's contents.

Shrinking what must be trusted

An ordinary application can protect its secrets only if it trusts the OS, hypervisor, drivers, administrators and more. With an enclave, the trusted computing base (TCB) shrinks to the CPU hardware and firmware plus the enclave's own code. The enclave code is measured when it starts, and through remote attestation, in which that measurement is signed with a key inside the CPU, a user can confirm that the correct code is running in a genuine enclave before handing over secret data.

Limitations and side-channel attacks

Enclaves are not a cure-all. Code inside an enclave cannot make system calls directly, so file and network handling must be delegated to outside code, and each crossing in and out costs time. Some implementations cap the amount of protected memory, so performance can drop with large data. In addition, research has repeatedly shown secrets leaking from enclaves through side-channel attacks exploiting cache timing, page-fault patterns or speculative execution. Code whose branches and memory accesses do not depend on secrets, along with microcode updates, is therefore important.

Compared with TrustZone and confidential VMs

TEEs come in several forms. Arm TrustZone splits the CPU into a secure world and a normal world and runs a dedicated small OS and apps in the secure world, protecting a different unit than an enclave, which carves out part of an application. Confidential VMs such as AMD SEV and Intel TDX encrypt the memory of an entire virtual machine to protect it from the hypervisor; existing OSes and apps run almost unchanged, but the whole guest OS falls inside the trusted base.

Try it: questions about Secure enclave

What characterizes enclave-style TEEs such as Intel SGX?

  1. AThe entire OS kernel runs from an external hard disk
  2. BPart of an application runs in a region whose memory the CPU encrypts and protects, so even the OS and hypervisor cannot read it
  3. CAnyone can freely modify data inside the enclave
Show answer and explanation

Answer: B. Part of an application runs in a region whose memory the CPU encrypts and protects, so even the OS and hypervisor cannot read it

In an enclave, only the part of an application handling secrets runs in a special memory region, which the CPU encrypts before it reaches main memory (some implementations also detect tampering). Neither the OS, the hypervisor nor an attacker physically reading memory can see its contents. Only the CPU and that code need be trusted. Vulnerabilities to side-channel attacks have also been reported, so careful use is needed.

Among the TEEs used in confidential computing, which correctly describes the difference between VM-based TEEs that protect a whole virtual machine (such as AMD SEV-SNP and Intel TDX) and enclave-based TEEs that protect part of an application (such as Intel SGX)?

  1. AVM-based TEEs do not encrypt virtual machine memory and protect it only by checking access permissions; only enclave-based TEEs encrypt memory
  2. BVM-based TEEs run existing OSes and applications almost unchanged, but the whole guest OS becomes part of the trusted computing base (TCB)
  3. CWith enclaves the OS and hypervisor are also part of what must be trusted, whereas with VM-based TEEs only the CPU needs to be trusted
Show answer and explanation

Answer: B. VM-based TEEs run existing OSes and applications almost unchanged, but the whole guest OS becomes part of the trusted computing base (TCB)

An enclave runs only the part of an application that handles secrets in a protected region, so what must be trusted (the TCB: trusted computing base) shrinks to the CPU and the enclave code, but the application has to be split and rewritten. A VM-based TEE encrypts the memory of a whole virtual machine and protects it from the hypervisor and the cloud administrators, so existing software can be moved almost unchanged. In exchange, the guest OS and all the software on top of it enter the TCB, and any vulnerability there can leak secrets. A smaller TCB is easier to verify and offers a smaller attack surface, so the choice is a trade-off between ease of use and the size of what must be trusted.

FAQ

What is an enclave, in simple terms?

A mechanism that runs the secret-handling part of an application in a region whose memory the CPU encrypts and protects, so that even the OS and hypervisor cannot read its contents. Intel SGX is the leading example, and it is one form of TEE (trusted execution environment).

What is the difference between an enclave and TrustZone?

TrustZone splits the CPU into secure and normal worlds and runs a dedicated OS and apps on the secure side. An enclave carves out part of an application running on the ordinary OS as its own protected region. They differ in the unit they protect and in how much software must be trusted.

Is Apple's Secure Enclave the same thing?

The names are similar, but the design is different. Apple's Secure Enclave is a security subsystem built into the SoC separately from the main CPU, handling tasks such as key management and biometric data. An SGX-style enclave is a scheme in which the main CPU itself protects and runs part of an application.

Books on Hardware Security Ad

As an Amazon Associate I earn from qualifying purchases.

Comparisons that include this term

This page was drafted with AI and fact-checked by a separate AI review before publication. Our Editorial policy explains how we write and check content. If you spot an error, please tell us on our Contact page.

Back to the glossary