SGX stands out from its predecessors by the amount of code covered by the
attestation, which is in the Trusted Computing Base (TCB) for the system using
hardware protection. The attestations produced by the original TPM design
covered the whole of the software running on a computer, and TXT attestations covered
the code inside a VMX \citep{uhlig2005vmx} virtual machine. In SGX, an
\textit{enclave} (secure container) only contains the private data in a
computation, and the code that operates on it.

For example, a cloud service that performs image processing on confidential
medical images could be implemented by having users upload encrypted images.
The users would send the encryption keys to software running inside an enclave.
The enclave would contain the code for decrypting images, the image processing
algorithm, and the code for encrypting the results. The code that receives the
uploaded encrypted images and stores them would be left outside the enclave.
This example is illustrated in Figure~\ref{fig:sgx_example}.

\begin{figure}[htpb]
  \centering
  \includegraphics[width=85mm]{figures/sgx_example.pdf}
  \caption{
    An example software application that uses SGX to implement a private function analyzing a medical image.
  }
  \label{fig:sgx_example}
\end{figure}

An SGX-enabled processor protects the integrity and confidentiality of the
computation inside an enclave by isolating the enclave's code and data from other software, including the operating system and hypervisor, and
hardware devices attached to the system bus. At the same time, the SGX model
remains compatible with the traditional software layering in the Intel
architecture, where the OS kernel and hypervisor manage the computer's
resources.
