Skip to content

Commit

Permalink
Add script to check build reproducibility (#242)
Browse files Browse the repository at this point in the history
Ref #241
  • Loading branch information
tiziano88 committed Sep 30, 2019
1 parent 0d73e14 commit 0c0cff1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions scripts/check_enclave_reproducibility
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o xtrace

# This script builds the Asylo server twice from scratch (cleaning the Bazel cache before each
# compilation), saves the hash of the trusted enclave code to a temporary file, and compares the
# hashes of the two artifacts.
# It prints nothing if the hashes match, or a diff in case they don't match.
# TODO: Perform variations of the build context to verify that the artifacts are unaffected.
# See http://manpages.ubuntu.com/manpages/cosmic/man1/reprotest.1.html#variations

bazel clean
rm -rf ./bazel-cache/*
./scripts/build_server
./scripts/print_enclave_hash > /tmp/hash_0

bazel clean
rm -rf ./bazel-cache/*
./scripts/build_server
./scripts/print_enclave_hash > /tmp/hash_1

diff /tmp/hash_0 /tmp/hash_1
9 changes: 9 additions & 0 deletions scripts/print_enclave_hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o xtrace

# Prints the SHA1 hash of the trusted enclave code.

sha1sum ./bazel-bin/oak/server/asylo/{oak_enclave_unsigned.so,oak_enclave.so}

0 comments on commit 0c0cff1

Please sign in to comment.