Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds MRENCLAVE and digest information to SGX build scripts #223

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions build-dist-sgx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ $ROOT_DIR/firmware/build/build-sgx $CHECKPOINT $DIFFICULTY $NETWORK > /dev/null
cp $ROOT_DIR/firmware/src/sgx/bin/hsmsgx $HSM_DIR/
cp $ROOT_DIR/firmware/src/sgx/bin/hsmsgx_enclave.signed $HSM_DIR/

HOST_HASH=$(sha256sum $ROOT_DIR/firmware/src/sgx/bin/hsmsgx | cut -d ' ' -f 1)
ENCLAVE_HASH=$($ROOT_DIR/firmware/build/extract-mrenclave $ROOT_DIR/firmware/src/sgx/bin/hsmsgx_enclave.signed)
echo "$HSM_DIR/hsmsgx:"
echo $HOST_HASH
echo
echo "$HSM_DIR/hsmsgx_enclave.signed"
echo "$ENCLAVE_HASH"

echo
echo -e "\e[32mBuild complete.\e[0m"

Expand Down
17 changes: 17 additions & 0 deletions firmware/build/build-sgx
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,20 @@ BUILD_CMD="\$SGX_ENVSETUP && make clean $BUILD_TARGET CHECKPOINT=$1 TARGET_DIFFI
DOCKER_USER="$(id -u):$(id -g)"

docker run -t --rm --user $DOCKER_USER -w /hsm2/firmware/src/sgx -v ${HSM_ROOT}:/hsm2 ${DOCKER_IMAGE} /bin/bash -c "$BUILD_CMD"

if [[ $? -ne 0 ]]; then
echo "Build failed"
exit 1
fi

HOST_BIN=$HSM_ROOT/firmware/src/sgx/bin/hsmsgx
ENCLAVE_BIN=$HSM_ROOT/firmware/src/sgx/bin/hsmsgx_enclave.signed

echo "*******************"
echo "Build successful."
echo "$(realpath $HOST_BIN --relative-to=$HSM_ROOT):"
sha256sum $HOST_BIN | cut -d ' ' -f 1
echo ""
echo "$(realpath $ENCLAVE_BIN --relative-to=$HSM_ROOT):"
$BUILD_ROOT/extract-mrenclave $ENCLAVE_BIN
echo "*******************"
Loading