Skip to content

Commit c8763b3

Browse files
committed
Update SNP attestation workflow
1. Update snpguest fetch commands to align with recent upstream snpguest tool changes. 2. Improve error handling. Signed-off-by: Srikanth Aithal <[email protected]>
1 parent 5997bad commit c8763b3

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

qemu/deps/sev-snp/regular_attestation_workflow.sh

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
2-
set -e
2+
3+
check_status() {
4+
if [ $? -ne 0 ]; then
5+
echo "Error: $1"
6+
exit 1
7+
fi
8+
}
39

410
# Check for the required CPU model parameter
511
if [[ -z "$1" ]]; then
@@ -30,23 +36,22 @@ fetch_retry() {
3036

3137
# Verify regular attestation workflow on snp guest
3238
snpguest report attestation-report.bin request-data.txt --random
39+
if [[ ! -f attestation-report.bin ]]; then
40+
echo "Error: attestation-report.bin not created."
41+
exit 1
42+
fi
3343
snpguest display report attestation-report.bin
34-
44+
check_status "Error: Failed display attestation-report."
3545

3646
# Fetch cert
37-
set +e
38-
fetch_retry "snpguest fetch ca pem ${cpu_model} ./ -e vcek"
39-
if [[ $? -ne 0 ]]; then
40-
echo "ok"
41-
exit 1
42-
fi
47+
fetch_retry "snpguest fetch ca -e vcek pem ./ ${cpu_model}"
48+
check_status "Error: Failed to fetch CA certificate."
4349

44-
fetch_retry "snpguest fetch vcek pem ${cpu_model} ./ attestation-report.bin"
45-
if [[ $? -ne 0 ]]; then
46-
exit 1
47-
fi
50+
fetch_retry "snpguest fetch vcek -p ${cpu_model} pem ./ attestation-report.bin"
51+
check_status "Error: Failed to fetch VCEK certificate."
4852

4953
# Verify certs
50-
set -e
5154
snpguest verify certs ./
52-
snpguest verify attestation ./ attestation-report.bin
55+
check_status "Error: Failed to verify certificates."
56+
snpguest verify attestation -p ${cpu_model} ./ attestation-report.bin
57+
check_status "Error: Failed to verify attestation."

0 commit comments

Comments
 (0)