Skip to content

Commit 38cfa20

Browse files
aamirrasheedclaude
andcommitted
Fix tpm2_nvread: use -C o (owner hierarchy) and write to file
Azure CVM NV indices have ownerread attribute, requiring -C o for auth. Also write to temp file instead of piping (avoids stdout/stderr issues). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1b87481 commit 38cfa20

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

privateclaw

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,19 @@ cmd_attest() {
5353
fi
5454

5555
# Read HCL report (contains SNP attestation report)
56-
HCL_REPORT=$(tpm2_nvread "$HCL_REPORT_NV" 2>/dev/null | xxd -p | tr -d '\n')
57-
if [ -z "$HCL_REPORT" ]; then
56+
# -C o = owner hierarchy auth (required for Azure CVM NV indices with ownerread attribute)
57+
HCL_TMPFILE=$(mktemp)
58+
if ! tpm2_nvread "$HCL_REPORT_NV" -C o -o "$HCL_TMPFILE" 2>/dev/null; then
59+
rm -f "$HCL_TMPFILE"
5860
echo "ERROR: Failed to read HCL report from TPM NV index $HCL_REPORT_NV"
5961
exit 1
6062
fi
63+
HCL_REPORT=$(xxd -p "$HCL_TMPFILE" | tr -d '\n')
64+
rm -f "$HCL_TMPFILE"
65+
if [ -z "$HCL_REPORT" ]; then
66+
echo "ERROR: HCL report is empty"
67+
exit 1
68+
fi
6169

6270
# Build evidence JSON with the raw HCL report + host key binding
6371
cat > "$EVIDENCE_FILE" << EOFEVIDENCE

0 commit comments

Comments
 (0)