## Install SGX driver

Install the SGX driver in the usual way.  This example is on a stock
Ubuntu 22.04.

```
apt install build-essential ocaml ocamlbuild automake autoconf libtool \
    wget python-is-python3 libssl-dev git cmake perl unzip debhelper \
    libcurl4-openssl-dev protobuf-compiler reprepro

git clone https://github.com/intel/linux-sgx-driver
cd linux-sgx-driver
make
sudo mkdir -p "/lib/modules/"`uname -r`"/kernel/drivers/intel/sgx"
sudo cp isgx.ko "/lib/modules/"`uname -r`"/kernel/drivers/intel/sgx"
sudo sh -c "cat /etc/modules | grep -Fxq isgx || echo isgx >> /etc/modules"
sudo /sbin/depmod
sudo /sbin/modprobe isgx
```

## Install SGX SDK

We install version 2.16, bu there's a small bug (since fixed but not yet
released) in the installer, which we manually patch.

```
cd
git clone https://github.com/intel/linux-sgx
cd linux-sgx
git checkout sgx_2.16
```
Edit linux/installer/bin/install-sgx-psw.bin.tmpl
  Change line 83 to:

  `PATH=/usr/sbin:/usr/bin:/sbin:/bin`

Then:
```
make preparation
make sdk_install_pkg
cd linux/installer/bin/
sudo ./sgx_linux_x64_sdk_2.16.100.4.bin
```
Answer to the prompts:

 - no
 - /opt/intel

```
cd ~/linux-sgx
make psw_install_pkg
cd linux/installer/bin/
sudo ./sgx_linux_x64_psw_2.16.100.4.bin
```

## Install SGX crypto library

```
cd
git clone https://github.com/intel/intel-sgx-ssl
cd intel-sgx-ssl
cd openssl_source
wget https://www.openssl.org/source/openssl-1.1.1n.tar.gz
cd ../Linux
make
sudo make install
```
