Skip to content

Commit dc08e97

Browse files
committed
exctract pcr0 from eif file
1 parent eb48297 commit dc08e97

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

.github/workflows/build-eif.yml

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,30 +88,20 @@ jobs:
8888
- name: Setup Nix Cache
8989
uses: DeterminateSystems/magic-nix-cache-action@main
9090

91-
- name: Build EIF with nix-enclaver
91+
- name: Build EIF
9292
run: |
93-
nix build '.#x86_64-eif' -L 2>&1 | tee build.log || true
94-
95-
# Extract PCR0 from build log
96-
PCR0=$(grep -oP '"PCR0":\s*"\K[a-f0-9]+' build.log | head -1)
97-
echo "PCR0_FROM_BUILD=$PCR0" >> $GITHUB_ENV
93+
nix build '.#x86_64-eif' -L || true
9894
9995
EIF=$(ls -d /nix/store/*batcher-x86_64 2>/dev/null | head -1)
100-
echo "Found: $EIF"
101-
ls -la "$EIF"
102-
103-
if [ -f "$EIF" ]; then
104-
cp "$EIF" ./enclave.eif
105-
elif [ -d "$EIF" ]; then
106-
cp "$EIF"/* ./enclave.eif 2>/dev/null || cp -r "$EIF" ./enclave-dir
107-
fi
96+
[ -f "$EIF" ] && cp "$EIF" ./enclave.eif
97+
[ -d "$EIF" ] && cp "$EIF"/* ./enclave.eif 2>/dev/null
10898
109-
ls -la ./enclave*
99+
ls -la ./enclave.eif
110100
111-
- name: Compute Enclave Hash
101+
- name: Get PCR0
112102
run: |
113-
PCR0="${{ env.PCR0_FROM_BUILD }}"
114-
[ -z "$PCR0" ] && { echo "No PCR0 found"; exit 1; }
103+
ENCLAVER=$(nix build '.#enclaver' --print-out-paths --no-link)
104+
PCR0=$("${ENCLAVER}/bin/enclaver" describe ./enclave.eif | grep -oP '"PCR0":\s*"\K[a-f0-9]+')
115105
116106
PCR0_KECCAK=$(cast keccak "0x${PCR0}")
117107
echo "PCR0: $PCR0"

0 commit comments

Comments
 (0)