-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DONTMERGE [tools/sgx] Interoperable RA-TLS
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 `hash-entry`). 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
Jan 13, 2023
1 parent
67b1b9f
commit af400b3
Showing
17 changed files
with
801 additions
and
61 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
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
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.9.0 | ||
source_url = https://github.com/PJK/libcbor/archive/refs/tags/v0.9.0.tar.gz | ||
source_fallback_url = https://packages.gramineproject.io/distfiles/libcbor-v0.9.0.tar.gz | ||
source_filename = libcbor-0.9.0.tar.gz | ||
source_hash = da81e4f9333e0086d4e2745183c7052f04ecc4dbcffcf910029df24f103c15d1 | ||
patch_directory = libcbor |
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,44 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
log() { | ||
echo "libcbor (static): $*" | ||
} | ||
|
||
CURRENT_SOURCE_DIR="$1" | ||
CURRENT_BUILD_DIR="$2" | ||
PRIVATE_DIR="$3" | ||
|
||
BUILD_LOG=$(realpath "$CURRENT_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 "$CURRENT_SOURCE_DIR" "$PRIVATE_DIR" | ||
|
||
( | ||
cd "$PRIVATE_DIR" | ||
|
||
log "running cmake..." | ||
cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | ||
-DCMAKE_INSTALL_PREFIX="$CURRENT_BUILD_DIR" \ | ||
. >>"$BUILD_LOG" 2>&1 | ||
|
||
log "running make..." | ||
make -j"$(nproc)" >>"$BUILD_LOG" 2>&1 | ||
make install >>"$BUILD_LOG" 2>&1 | ||
) | ||
|
||
cp -ar "$CURRENT_BUILD_DIR"/include/. "$CURRENT_BUILD_DIR" | ||
cp -ar "$CURRENT_BUILD_DIR"/lib/. "$CURRENT_BUILD_DIR" | ||
|
||
log "ls -la $CURRENT_BUILD_DIR" | ||
ls -la $CURRENT_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,37 @@ | ||
project('libcbor', 'c', version: '0.9.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 | ||
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.