Skip to content

Commit

Permalink
Update fortanix-sgx-tools version due to libunwind update
Browse files Browse the repository at this point in the history
Update aesm-client version due to ECDSA operations
  • Loading branch information
AdrianCX committed May 20, 2020
1 parent 01d1d94 commit b2ee2d5
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 50 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 13 additions & 48 deletions doc/FORTANIX-SGX-ABI.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Fortanix SGX ABI v0.3.0
# Fortanix SGX ABI v0.3.2

This document describes the ABI of SGX enclaves built using `libenclave`.

## ABI version compatibility

| ABI version | Rust std version | enclave-runner version |
| -----------:| ----------------:| ----------------------:|
| 0.3.1 | TBD | 0.1.0 |
| 0.3.0 | 15a2607.. | 0.1.0 |
| 0.3.2 | 50f3d6e.. | 0.1.0~0.3.1 |
| 0.3.1 | bd47d68.. | 0.1.0~0.3.1 |
| 0.3.0 | 15a2607.. | 0.1.0~0.3.1 |

| ABI version | libenclave version | enclave-interface version |
| -----------:| ------------------:| -------------------------:|
Expand All @@ -18,84 +19,48 @@ This document describes the ABI of SGX enclaves built using `libenclave`.
| 0.1.3 | 0.1.0-0.1.3 | 0.1.0-0.1.1 |
| 0.1.0 | 0.1.0-0.1.3 | 0.1.0-0.1.1 |

## Changelog
### Changelog

### Version 0.3.2
#### Version 0.3.2

* *No semantic changes.*
* More changes to allow building as a crates.io dependency of `std`.

### Version 0.3.1
#### Version 0.3.1

* *No semantic changes.*
* Changes to allow building as a crates.io dependency of `std`.

### Version 0.3.0
#### Version 0.3.0

* Return values are now two registers wide instead of one.
* No longer distinguish between “panic exit” and “usercall exit”. Panic
signalling is now done at the API level.
* Renamed “libenclave ABI” to “Fortanix SGX ABI”.
* TLS size and contents updated.

### Version 0.2.3
#### Version 0.2.3

* TLS size and contents updated.

### Version 0.2.2
#### Version 0.2.2

* TLS size updated. Debug TLS size is now the same as non-debug size.

### Version 0.2.1
#### Version 0.2.1

* AEX debug handler removed.

### Version 0.2.0
#### Version 0.2.0

* Usercall register saving semantics changed. The enclave no longer
distinguishes between normal enters and usercall enters for purposes of
saving user register state.

### Version 0.1.3
#### Version 0.1.3

* TLS size and contents updated.

## Thread settings

This section describes the requirements on the SGX thread control structure
(TCS), thread local storage (TLS) and thread stacks.

### TCS

- `NSSA` should be set to 1.
- `OGSBASGX` should point to a thread-specific memory region (e.g. TLS) of at
least 112 bytes.

### TLS

The memory region pointed to by `OGSBASGX` should be initialized as follows:

- Offset `0x0`: Top-of-Stack offset from image base.
- Offset `0x8`: `1` if this is an executable and this is a secondary TCS, `0`
otherwise.
- Offsets `0x10`, `0x18`, `0x20`: `0`
- Other offsets: uninitialized.

## Globals

This section describes the requirements for various global constants in the SGX
binary.

- `HEAP_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the heap area, little-endian.
- `HEAP_SIZE`. Size 8 bytes. The heap size in bytes, little-endian.
- `ENCLAVE_SIZE`. Size 8 bytes. The enclave size in bytes, little-endian.
- `CFGDATA_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the enclave configuration area, little-endian.
- `RELA`. Size 8 bytes. Value of the RELA entry in the dynamic table.
- `RELACOUNT`. Size 8 bytes. Value of the RELACOUNT entry in the dynamic table.
- `DEBUG`. Size 1 byte. Non-zero if debugging is enabled, zero otherwise.

## Enclave calling convention

Upon `EENTER`, besides the standard SGX control registers, parameters are
Expand Down
72 changes: 72 additions & 0 deletions doc/FORTANIX-SGX-ELF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Fortanix SGX ELF specification

ELF is only an intermediate stage for the Fortanix SGX toolchain. Compatibility
is maintained at the source code and SGXS ABI level (see
[FORTANIX-SGX-ABI.md](FORTANIX-SGX-ABI.md)).

Nonetheless, this document describes the intermediate ELF format. This is for
reference purposes only, third parties should *not* rely on this format.

## ELF compatibility level

The compatibility level is contained in an ELF note section named
`.note.x86_64-fortanix-unknown-sgx`, note type `NT_VERSION` with name
`toolchain-version`. The contents of the note is a 32-bit little-endian number.

| toolchain-version | fortanix-sgx-tools version | Rust std version |
| -----------------:| --------------------------:|-----------------:|
| 1 | 0.4.0 | TBD |
| 0 | 0.1.0~0.4.0 | 33e6df4.. |

### Changelog

#### Version 1

* Updated libunwind integration for new libunwind version

## Thread settings

This section describes the requirements on the SGX thread control structure
(TCS), thread local storage (TLS) and thread stacks.

### TCS

- `NSSA` should be set to 1.
- `OGSBASGX` should point to a thread-specific memory region (e.g. TLS) of at
least 112 bytes.

### TLS

The memory region pointed to by `OGSBASGX` should be initialized as follows:

- Offset `0x0`: Top-of-Stack offset from image base.
- Offset `0x8`: `1` if this is an executable and this is a secondary TCS, `0`
otherwise.
- Offsets `0x10`, `0x18`, `0x20`: `0`
- Other offsets: uninitialized.

## Globals

This section describes the requirements for various global constants in the SGX
binary.

- `HEAP_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the heap area, little-endian.
- `HEAP_SIZE`. Size 8 bytes. The heap size in bytes, little-endian.
- `ENCLAVE_SIZE`. Size 8 bytes. The enclave size in bytes, little-endian.
- `CFGDATA_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the enclave configuration area, little-endian.
- `RELA`. Size 8 bytes. Value of the RELA entry in the dynamic table.
- `RELACOUNT`. Size 8 bytes. Value of the RELACOUNT entry in the dynamic table.
- `DEBUG`. Size 1 byte. Non-zero if debugging is enabled, zero otherwise.
- `TEXT_BASE`. Size 8 bytes. The base address (relative to enclave start) of
the enclave text section.
- `TEXT_SIZE`. Size 8 bytes. The size in bytes of the enclave text section.
- `EH_FRM_HDR_OFFSET`. Size 8 bytes. The base address (relative to enclave
start) of the ELF section named '.eh_frame_hdr'.
- `EH_FRM_HDR_LEN`. Size 8 bytes. The size in bytes of the ELF section named
'.eh_frame_hdr'.
- `EH_FRM_OFFSET`. Size 8 bytes. The base address (relative to enclave start)
of the ELF section named '.eh_frame'.
- `EH_FRM_LEN`. Size 8 bytes. The size in bytes of the ELF section named
'.eh_frame'.
2 changes: 1 addition & 1 deletion fortanix-sgx-tools/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortanix-sgx-tools"
version = "0.3.1"
version = "0.4.0"
authors = ["Fortanix, Inc."]
license = "MPL-2.0"
description = """
Expand Down

0 comments on commit b2ee2d5

Please sign in to comment.