-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tools/sgx] Modify RA-TLS to adhere to Interoperable RA-TLS standard
Interoperable RA-TLS is a spec that allows different RA-TLS implementations (from different SGX frameworks, e.g. Gramine and Occlum) to interoperate and recognize each others' SGX evidence (SGX quotes and attached SGX claims). For example, Gramine app enclave can establish a TLS connection with an Occlum app enclave and verify its SGX evidence. The spec standardizes the OID extension for X.509 certs that is used for the SGX evidence. It also standardizes the format of the OID contents: a CBOR-formatted tag with an array that contains the SGX quote and a dict of related claims (with the most important dict item being the public key hash encoded as a CBOR array `pubkey-hash`). Current RA-TLS implementation creates X.509 certs that have both the old (legacy) OID with plain SGX quote as well as the new (standardized) OID with the CBOR-formatted SGX evidence. Thus, backward compatibility is preserved at a small cost of larger-sized certs. Signed-off-by: Dmitrii Kuvaiskii <[email protected]>
- Loading branch information
Dmitrii Kuvaiskii
committed
Aug 6, 2024
1 parent
67a00de
commit 7d589f8
Showing
22 changed files
with
885 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ Maintainer: Wojtek Porczyk <[email protected]> | |
Build-Depends: debhelper-compat (= 13), | ||
autoconf, | ||
bison, | ||
cmake, | ||
jq, | ||
gawk, | ||
libcurl4-openssl-dev (>= 7.58), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ makedepends=" | |
autoconf | ||
binutils-dev | ||
bison | ||
cmake | ||
coreutils | ||
findutils | ||
gawk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
/curl-*/ | ||
/gcc-*/ | ||
/glibc-*/ | ||
/libcbor-*/ | ||
/mbedtls-*/ | ||
/musl-*/ | ||
/tomlc99-*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[wrap-file] | ||
directory = libcbor-0.11.0 | ||
source_url = https://github.com/PJK/libcbor/archive/refs/tags/v0.11.0.tar.gz | ||
source_fallback_url = https://packages.gramineproject.io/distfiles/libcbor-v0.11.0.tar.gz | ||
source_filename = libcbor-0.11.0.tar.gz | ||
source_hash = 89e0a83d16993ce50651a7501355453f5250e8729dfc8d4a251a78ea23bb26d7 | ||
patch_directory = libcbor-0.11.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
log() { | ||
echo "libcbor (static): $*" | ||
} | ||
|
||
if [ "$#" -ne 3 ]; then | ||
echo "Usage: $0 <source dir> <build dir> <private dir>" >&2 | ||
exit 2 | ||
fi | ||
|
||
SOURCE_DIR="$1" | ||
BUILD_DIR="$2" | ||
PRIVATE_DIR="$3" | ||
|
||
BUILD_LOG=$(realpath "$BUILD_DIR/libcbor-build.log") | ||
rm -f "$BUILD_LOG" | ||
|
||
log "see $BUILD_LOG for full build log" | ||
|
||
log "preparing sources..." | ||
|
||
rm -rf "$PRIVATE_DIR" | ||
cp -ar "$SOURCE_DIR" "$PRIVATE_DIR" | ||
|
||
( | ||
cd "$PRIVATE_DIR" | ||
|
||
log "running cmake..." | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | ||
-DCMAKE_INSTALL_LIBDIR=lib \ | ||
-DCMAKE_INSTALL_PREFIX="$BUILD_DIR" \ | ||
. >>"$BUILD_LOG" 2>&1 | ||
|
||
log "running make..." | ||
make -j"$(nproc)" >>"$BUILD_LOG" 2>&1 | ||
make install >>"$BUILD_LOG" 2>&1 | ||
) | ||
|
||
cp -ar "$BUILD_DIR"/include/. "$BUILD_DIR" | ||
cp -ar "$BUILD_DIR"/lib/. "$BUILD_DIR" | ||
|
||
log "done" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
project('libcbor', 'c', version: '0.11.0') | ||
|
||
fs = import('fs') | ||
|
||
# NOTE: This is custom_target, because CMake integration in Meson doesn't work correctly with PIC | ||
# static libraries, see https://github.com/mesonbuild/meson/issues/10764. | ||
libcbor_lib = custom_target('libcbor', | ||
command: [ | ||
find_program('compile.sh'), | ||
'@CURRENT_SOURCE_DIR@', | ||
meson.current_build_dir(), | ||
'@PRIVATE_DIR@', | ||
], | ||
|
||
input: 'CMakeLists.txt', | ||
output: [ | ||
'libcbor.a', | ||
'cbor.h', | ||
], | ||
|
||
console: true, | ||
install: false, | ||
) | ||
|
||
# We can't use `include_directories('include')` because the `include/` dir is generated in the | ||
# custom target above, but Meson checks for existence of the dir *before* running the target, | ||
# see https://github.com/mesonbuild/meson/issues/1855 | ||
libcbor_inc = include_directories('.') | ||
|
||
libcbor_dep = declare_dependency( | ||
link_with: libcbor_lib[0], | ||
# HACK: Use the generated "cbor.h" file and propagate it as part of the RA-TLS build dependency | ||
# to enforce compile order, i.e., to make sure libcbor headers are ready before RA-TLS sources | ||
# start compiling. | ||
sources: libcbor_lib[1], | ||
include_directories: libcbor_inc, | ||
compile_args: '-Wno-strict-prototypes', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.