# SGX/TEE
- Each enclave is an isolated region within system memory that contains both code and data. Applications that harness this technology can make a call to the TEE using a trusted function — a piece of code created by a software developer that can be executed within an enclave. In the previously mentioned example, for instance, the trusted function might check your medical records within an enclave to detect any potential conflicting medications. The enclave then returns a value to the main application, such as “clash detached” or “no clash detected”.
- 
- Only trusted functions are allowed to run in the enclave and the memory is otherwise unaddressable, meaning that any other attempt to access enclave data will automatically be rejected by the processor. The important thing to note here is that as encryption is taking place at hardware level, it protects against software-based attacks. In effect, this means that even if a hacker has access to the entire operating system and BIOS of the system on which the TEE is running, confidential data will remain secret.
- The smaller the application's surface, the more secure the application is. TEEs limit the surface area, for example AWS Nitro allows communications via vsock sockets only, and the open sockets are fully controlled by the TEE.
- Besides making compute more secure, TEEs offer assurances to the participants. All three hardware platforms (Intel SGX, AWS Nitro and AMD SEV) provide hardware-backed measurements of the software, for example a hash of the application executable memory with all its data. These measurements prove to attestors that the application is running expected code before they can allow any sensitive data into the TEEs. The process of attestation is the mechanism of building trust between parties that don't want to share data with each other without constraining the use of the data. I'll discuss how attestation is done for Intel SGX and AWS Nitro in subsequent posts.
- The three major clouds, AWS, Azure, and GCP, offer these TEEs:
- AWS - Nitro enclaves on the AWS Nitro chips. Nitro enclaves are "application-size" virtual machines, they are managed by the Nitro hypervisor. The memory is not necessarily encrypted.
- Azure - Intel SGX enclaves and AMD SEV VMs. Intel SGX enclaves are processes, think smaller attack surface compared to confidential VMs on AMD SEV, memory is encrypted by Intel hardware keys.
- GCP - AMD SEV confidential VMs. AMD VMs have memory encrypted by a hardware key generated per VM.
- Intel SGX is a set of CPU instructions and a kernel driver that make it possible to create secure enclaves. An Intel SGX enclave is a protected region of memory encrypted with a hardware key generated per enclave. Any access to the memory from outside of it results in an error regardless of whether it is done from kernel, driver, or user mode outside of the enclave. The interactions with an enclave are done via E and O calls, into enclave and out of enclave respectively. The set of allowed calls is defined at the enclave creation time.
# How will we use TEE in solvers?
Solvers are having valuable information of the order flow of the users
# Refs
- https://medium.com/@integritee/tee-101-how-intel-sgx-works-and-why-we-use-it-at-integritee-5cb2957c050f
- https://www.linkedin.com/pulse/tees-introduction-intel-sgx-max-lepikhin/