Skip to content

Commit a16f9fc

Browse files
committed
cczoo: Add librats project into cczoo
Signed-off-by: Liang Yang <liang3.yang@intel.com>
1 parent 7d8c045 commit a16f9fc

File tree

2 files changed

+117
-0
lines changed

2 files changed

+117
-0
lines changed
Loading

documents/readthedoc/docs/source/Solutions/rats-tls/index.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,120 @@ The configuration of the instance as blow:
360360
- Instance OS : Ubuntu20.04
361361
- Instance Encrypted Memory: 128GB(64G EPC Memory)
362362
- Instance vCPU : 16
363+
364+
## Librats
365+
366+
librats provides attestation and verification capability of SGX and TDX.
367+
It can support to get evidence in HW-TEE by API librats_collect_evidence and verify evidence
368+
by API librats_verify_evidence. This implementation simplifies and shields the underlying
369+
complex remote attestation flow of HW-TEE. Let user be easy to complete the attestation and verification
370+
leveraging both APIs in libats.
371+
The source code: [librats](https://github.com/inclavare-containers/librats)
372+
373+
### Architecture Overview
374+
375+
![librats.png](./img/librats.png)
376+
377+
### Build Requirements
378+
379+
- git
380+
- make
381+
- autoconf
382+
- libtool
383+
- libcurl
384+
- gcc
385+
- g++
386+
- openssl-devel / libssl-dev
387+
- cargo (only needed in host mode)
388+
- python, bzip2 (only needed in wasm mode)
389+
- SGX driver, Intel SGX SDK & PSW: Please refer to this [guide](https://download.01.org/intel-sgx/sgx-linux/2.14/docs/Intel_SGX_SW_Installation_Guide_for_Linux.pdf) to install.
390+
- [SGX DCAP](https://github.com/intel/SGXDataCenterAttestationPrimitives): please download and install the packages from this [page](https://download.01.org/intel-sgx/sgx-dcap/#version#linux/distro).
391+
- ubuntu 18.04: `libsgx-dcap-quote-verify-dev`, `libsgx-dcap-ql-dev`, `libsgx-uae-service`
392+
- For TDX, please see the README in TDX MVP Stack. You need to download the packages and following TDX_E2E_attestation_software_stack_Installation_README-dcap-2021XXXX.txt to do step 2 & step 3 to setup build and dependence libraries.
393+
394+
### Build and Install
395+
396+
Please follow the command to build librats from the latested source code on your system.
397+
398+
1. Download the latest source code of librats
399+
400+
```shell
401+
mkdir -p "$WORKSPACE"
402+
cd "$WORKSPACE"
403+
git clone https://github.com/inclavare-containers/librats
404+
```
405+
406+
2. Build and install librats
407+
408+
If you want to build instances related to sgx(sgx\_ecdsa, sgx\_ecdsa\_qve, sgx\_la), please type the following command.
409+
410+
```shell
411+
cmake -DRATS_BUILD_MODE="sgx" -H. -Bbuild
412+
make -C build install
413+
```
414+
415+
If you want to run instances on libos occlum, please type the following command.
416+
417+
```shell
418+
cmake -DRATS_BUILD_MODE="occlum" -H. -Bbuild
419+
make -C build install
420+
```
421+
422+
If you want to run TDX instances, please type the following command.
423+
```shell
424+
cmake -DRATS_BUILD_MODE="tdx" -H. -Bbuild
425+
make -C build install
426+
```
427+
428+
Note that [SGX LVI mitigation](https://software.intel.com/security-software-guidance/advisory-guidance/load-value-injection) is enabled by default. You can set macro `SGX_LVI_MITIGATION` to `0` to disable SGX LVI mitigation.
429+
430+
3. Wasm support
431+
432+
Librats provides support for [WebAssembly](https://webassembly.org), which enables it to run in the browser and [WAMR](https://github.com/bytecodealliance/wasm-micro-runtime).
433+
434+
If you want to run it in browser, please type the following command.
435+
```shell
436+
source wasm/emscripten/pre_build.sh
437+
cmake -DRATS_BUILD_MODE="wasm" -H. -Bbuild
438+
make -C build
439+
```
440+
441+
When the compilation is finished, you can find the results in build/wasm.
442+
443+
If you want to run it in WAMR, please type the following command.
444+
```shell
445+
# install librats in host mode first
446+
cmake -H. -Bbuild
447+
make -C build install
448+
449+
# export librats APIs to wamr
450+
cd wasm/wamr
451+
cmake -H. -Bbuild
452+
make -C build
453+
454+
# run the sample
455+
cd build
456+
./iwasm --native-lib=librats_wamr.so sample/test.wasm
457+
```
458+
459+
#### RUN
460+
461+
Right now, Librats supports the following instance types:
462+
463+
| Priority | Attester instances | Verifier instances |
464+
| ---------- | -------------------------- | -------------------------- |
465+
| 0 | nullattester | nullverifier |
466+
| 15 | sgx\_la | sgx\_la |
467+
| 42 | tdx\_ecdsa | tdx\_ecdsa |
468+
| 52 | sgx\_ecdsa | sgx\_ecdsa |
469+
| 53 | sgx\_ecdsa | sgx\_ecdsa\_qve |
470+
471+
For instance priority, the higher, the stronger. By default, Librats will select the **highest priority** instance to use.
472+
473+
474+
**Notice: special prerequisites for TDX remote attestation in bios configuration and hardware capability.**
475+
476+
Check msr 0x503, return value must be 0:
477+
```
478+
sudo rdmsr 0x503s
479+
```

0 commit comments

Comments
 (0)