\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb}
\usepackage{algorithm,algpseudocode}
\usepackage{bm}
\usepackage{hyperref}
\usepackage{float}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage{xcolor}
\definecolor{darkgreen}{rgb}{0.0, 0.5, 0.0}
\definecolor{aaltoBlue}{RGB}{0, 51, 102}
\definecolor{pinegreen}{cmyk}{0.92,0,0.59,0.25}
\definecolor{royalblue}{cmyk}{1,0.50,0,0}
\definecolor{lavander}{cmyk}{0,0.48,0,0}
\definecolor{violet}{cmyk}{0.79,0.88,0,0}
\definecolor{lightblue}{RGB}{173, 216, 230}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc,arrows.meta,positioning,fit,shapes.geometric,shapes.misc,intersections,patterns,decorations.pathreplacing,backgrounds,matrix}
\usepgfplotslibrary{fillbetween,groupplots}
\setcounter{secnumdepth}{-\maxdimen}
% Long unbreakable tokens (the ISO/IEC author names in citations, term names
% in the title) otherwise overflow the margin by a few points; a modest
% emergency stretch lets TeX loosen the paragraph instead.
\emergencystretch=2em
\usepackage{mleftright}
% Project macros used by this entry (auto-extracted).
\newcommand{\featurevec}{\vx}
\newcommand{\hypothesis}{h}
\newcommand{\learnthypothesis}{\widehat{\hypothesis}}
\newcommand{\vw}[0]{{\bf w}}
\newcommand{\vx}[0]{{\bf x}}
\newcommand{\weights}{\vw}

\begin{document}

\section{trusted execution environment (TEE)}

\subsection*{Author and editors}
Alexander Jung\textsuperscript{*}, Department of Computer Science, Aalto University, Espoo, Finland (ORCID \mbox{\href{https://orcid.org/0000-0001-7538-0990}{0000-0001-7538-0990}}) \\
Editors: Konstantina Olioumtsevits (ORCID \mbox{\href{https://orcid.org/0000-0003-2697-8659}{0000-0003-2697-8659}}), Ekkehard Schnoor (ORCID \mbox{\href{https://orcid.org/0000-0001-8252-1499}{0000-0001-8252-1499}}), Aalto University, Espoo, Finland \\
\textsuperscript{*}Corresponding author: \href{mailto:alex.jung@aalto.fi}{alex.jung@aalto.fi}

\subsection{Synonyms}
secure enclave

\subsection{Abstract}
A trusted execution environment (TEE) is a part of a computing system that isolates code and data from other software. Even the operating system cannot directly read or alter its protected memory. Remote attestation can prove to another party which code it runs. Processor features such as Arm TrustZone and Intel SGX provide TEEs on ordinary chips. In machine learning (ML), a TEE protects input feature vectors, learned model parameters and the integrity of the computed prediction. It does not limit what the prediction reveals; differential privacy (DP) addresses that problem. Physical and software side channels require additional countermeasures. Compared with fully homomorphic encryption (FHE), a TEE runs at near-native speed but replaces a mathematical guarantee with trust in the chip vendor and its hardware.

\subsection{Definition}
Consider an embedded
		controller in a refrigerated medicine cabinet. Each minute, it reads a
		temperature sensor and forms a feature vector $\featurevec$ from the current
		temperature and its recent changes. A learned hypothesis computes the
		prediction $\learnthypothesis(\featurevec)$ of whether the cooling system
		is failing. The controller sits in a sealed metal box with no network cable and
		no radio. Its only inputs are the sensor cable and the power cable, and its only
		output is an alarm display. The model parameters $\widehat{\weights}$ of
		$\learnthypothesis$ and the recorded temperature readings never leave the box.
\par
		A TEE is the part of the processor that provides the logical isolation. Software
		outside it cannot directly read or alter its protected code and memory, even if
		that software is a privileged operating system (Sabt et al., 2015). The metal enclosure is not the TEE;
		it is a separate layer that protects the processor against physical probing and
		fault injection.
\par
		Most TEEs are a mode of an ordinary processor.
		Arm TrustZone splits the processor of the controller into two parts. The normal
		world runs the display software. The secure world runs the prediction code
		and holds $\widehat{\weights}$ and the temperature readings.
		The normal world cannot read the memory of the secure world even with root
		privileges (Pinto and Santos, 2019).
\par
		Intel SGX provides similar isolation for an enclave inside a process on a server
		(Costan and Devadas, 2016). Remote attestation lets a client verify a signed digest of
		the enclave's code before it sends any data. The isolation guarantee concerns direct access through
		software and memory interfaces; information revealed by outputs, side channels
		and physical attacks requires additional protection. Fig.~\ref{fig_tee_dict}
		shows the embedded controller and what each part can see.
		\begin{figure}[H]
			\begin{center}
			\begin{tikzpicture}[>=Stealth, every node/.style={font=\small}]
			% the sealed enclosure
			\draw[thick, dashed, rounded corners] (-0.4,-0.4) rectangle (8.4,3.9);
			\node[anchor=south west, font=\footnotesize] at (-0.4,3.9) {additional physical protection (electromagnetic shield, no radio, no network)};
			% the board
			\draw[thick] (0,0) rectangle (8.0,3.4);
			\node[font=\footnotesize] at (4.0,3.1) {embedded controller};
			% normal world
			\draw (0.2,0.2) rectangle (3.4,2.8);
			\node[align=center] at (1.8,2.35) {normal world};
			\node[align=center, font=\footnotesize] at (1.8,1.3) {display software\\sees only $\learnthypothesis(\featurevec)$};
			% secure world
			\draw[fill=gray!20] (4.6,0.2) rectangle (7.8,2.8);
			\node[align=center] at (6.2,2.35) {secure world (TEE)};
			\node[align=center, font=\footnotesize] at (6.2,1.3) {prediction code\\model parameters $\widehat{\weights}$\\temperature readings};
			% flows
			\draw[->, thick] (9.6,1.9) node[right, font=\footnotesize] {temperature sensor $\featurevec$} -- (7.8,1.9);
			\draw[->, thick] (4.6,0.7) -- node[above=1pt, font=\footnotesize] {$\learnthypothesis(\featurevec)$} (3.4,0.7);
			\draw[->, thick] (0.2,0.7) -- (-1.4,0.7) node[left, font=\footnotesize] {alarm display};
			% the blocked probe
			\draw[thick] (6.2,-1.3) node[below, font=\footnotesize] {electromagnetic probe} -- (6.2,-0.6);
			\draw[thick] (5.9,-0.75) -- (6.5,-0.45) (5.9,-0.45) -- (6.5,-0.75);
			\end{tikzpicture}
			\end{center}
		\caption{A TEE in an embedded temperature-monitoring controller. The secure
			world (the TEE) holds the prediction code, the model parameters and the
			recorded temperature readings; the normal world receives only the
			prediction for the alarm display. Separately, the sealed enclosure
				reduces the physical side channels available to a probe outside the processor
				\label{fig_tee_dict}}
		\end{figure}
		A TEE protects three assets of a machine learning (ML) system. The first is the
		data: the temperature history is an operational record that the cabinet
		operator must not disclose or allow an attacker to alter. The second is the
		learned hypothesis. Its model parameters $\widehat{\weights}$ are the
		outcome of training on a costly dataset. An attack that reads
		them out obtains the hypothesis without the dataset. The third is the integrity of the
		prediction: nobody can alter the code so that it suppresses an alarm
		when the cooling system is failing.
\par
		A TEE does not protect what the prediction reveals. A
		membership inference attack that only observes predictions is unaffected
		by it, and differential privacy (DP) addresses that part.
\par
		A TEE also does not, by itself, protect against physical side channels. The
		processor's current and electromagnetic field depend on the data it processes.
		A probe held near the chip can recover secret keys from these traces
		(Kocher et al., 1999).
		The same probe recovers the model parameters and the layer structure of an
		artificial neural network (ANN) running on an embedded processor, one multiplication at a time
		(Batina et al., 2019). A short electromagnetic pulse or a glitch on the supply
		voltage can also skip an instruction, e.g., the check that rejects unsigned
		code (Bar-El et al., 2006).
\par
		The metal enclosure attenuates the emitted field and blocks the pulse. Tamper
		sensors erase $\widehat{\weights}$ when the box is opened. Constant-time code
		makes the power trace independent of the data.
\par
		However, server TEEs are also exposed to software and processor-level side
		channels.
		The operating system can see the memory access pattern of an enclave. Therefore,
		ML code inside an enclave must be data-oblivious. Its access patterns must
		not depend on the data (Ohrimenko et al., 2016). Speculative
		execution has also leaked enclave memory outright (Van Bulck et al., 2018).
\par
		Two uses of TEEs beyond the sealed box are prediction in the cloud and
		federated learning (FL). A hospital that rents a server can require an SGX enclave. It first
		uses attestation to verify the agreed prediction code. It then encrypts
		its feature vectors for the enclave, so the cloud provider never sees them
		(Ohrimenko et al., 2016).
\par
		In FL, a server enclave can provide a hardware-based implementation of
		secure aggregation. Clients encrypt their model parameters updates for
		the enclave. It decrypts and sums the updates, while the server operator sees
		only the sum. Separately, the TrustZone secure world of
		each phone can protect its local update before transmission; a system can use
		either protection or combine both (Mo et al., 2021).
\par
		A TEE, fully homomorphic encryption (FHE) and DP provide different guarantees by
		different means. FHE hides the data during computation without
		trusting the processor, at a cost of orders of magnitude in time and memory. A
		TEE obtains near-native speed by trusting the chip vendor, the hardware
		implementation and the countermeasures against side channels. DP
		bounds what the released prediction reveals about any single
		data point (Dwork and Roth, 2014, Def.~2.4) and can be combined with either.

\subsection{Cross References}
FHE, secure aggregation, DP, privacy protection, privacy attack, membership inference attack, attack, FL, edge device, cloud computing, ML system, trustworthy AI

\subsection{References}
\begin{enumerate}
  \item Dwork and Roth (2014). The Algorithmic Foundations of Differential Privacy. Foundations and Trends\textregistered in Theoretical Computer Science, 9(3--4), pp.~211--407.
  \item Bar-El et al. (2006). The Sorcerer's Apprentice Guide to Fault Attacks. Proceedings of the IEEE, 94(2), pp.~370--382.
  \item Batina et al. (2019). CSI NN: Reverse Engineering of Neural Network Architectures Through Electromagnetic Side Channel. In: Proc. 28th USENIX Security Symposium, pp.~515--532.
  \item Costan and Devadas (2016). Intel SGX Explained. IACR Cryptology ePrint Archive, Report 2016/086.
  \item Kocher et al. (1999). Differential Power Analysis. In: Advances in Cryptology -- CRYPTO '99, pp.~388--397. Springer.
  \item Mo et al. (2021). PPFL: Privacy-preserving Federated Learning with Trusted Execution Environments. In: Proc. 19th Annual Int. Conf. Mobile Systems, Applications, and Services (MobiSys), pp.~94--108.
  \item Ohrimenko et al. (2016). Oblivious Multi-Party Machine Learning on Trusted Processors. In: Proc. 25th USENIX Security Symposium, pp.~619--636.
  \item Pinto and Santos (2019). Demystifying Arm TrustZone: A Comprehensive Survey. ACM Computing Surveys, 51(6), pp.~130:1--130:36.
  \item Sabt et al. (2015). Trusted Execution Environment: What It is, and What It is Not. In: Proc. IEEE Trustcom/BigDataSE/ISPA, pp.~57--64.
  \item Van Bulck et al. (2018). Foreshadow: Extracting the Keys to the Intel SGX Kingdom with Transient Out-of-Order Execution. In: Proc. 27th USENIX Security Symposium, pp.~991--1008.
\end{enumerate}

\end{document}
