https://github.com/tristartom/sgx-emulator
An Emulator and SDK for Intel SGX extension
https://github.com/tristartom/sgx-emulator
emulator enclave kernel-module kernel-space sdk sgx sgx-emulator
Last synced: 3 months ago
JSON representation
An Emulator and SDK for Intel SGX extension
- Host: GitHub
- URL: https://github.com/tristartom/sgx-emulator
- Owner: tristartom
- Created: 2015-09-25T14:16:07.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-03-06T20:41:00.000Z (over 9 years ago)
- Last Synced: 2024-11-10T04:36:47.490Z (over 1 year ago)
- Topics: emulator, enclave, kernel-module, kernel-space, sdk, sgx, sgx-emulator
- Language: C++
- Homepage:
- Size: 160 KB
- Stars: 31
- Watchers: 9
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-sgx - tristartom/sgx-emulator - An Emulator and SDK for Intel SGX extension. (EMULATOR)
README
SGX-emulator and SDK
===
Use the emulator with the following specific setting only!
**64-bit `Ubuntu 14.04.3 LTS` guest OS in VirtualBox**
(This is the setting we have tested so far, and we can ensure the working of our emulator! We may relieve the requirement on VirtualBox in the future release.)
Before execution, make sure about the right Linux version
```
uname -r
3.19.0-25-generic
```
Here's a prebuilt VirtualBox image. The username and password to login the system are both "sgx"
https://www.dropbox.com/s/z18a12m09ajw6ry/sgx-env.vdi?dl=0
Demo
---
```
sudo insmod sgx.ko
make sha
#sudo dmesg -c
make r # view the standard output
dmesg # view kernel output
sudo rmmod sgx
```
(alternative, you can also run `make` in the second line).
#### Explanation
This demo will show you a simple Enclave program that computes `sha1` (cryptographic hash from `openssl`) inside Enclave.
- In user-space code, it appears to be a simple function call into a dynamically loaded library.
- In `dmesg`, you can see that the function call is "captured" in the kernel space (triggered by an illegal instruction, verified through the following "experiment"). We use this kernel-space hooking to emulate the SGX ENCLU instructions (`EENTER` and `EEXIT`).
```
sudo rmmod sgx
make r #you should be able to see the "illegal instruction" exception
```