Skip to content

Commit 3b1605d

Browse files
NOISSUE - Add vTPM AK hash to SEV-SNP report (#543)
* add vTPM AK to SEV-SNP report * fix ci errors
1 parent 77a11c6 commit 3b1605d

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

pkg/attestation/vtpm/vtpm.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,15 @@ func VTPMVerify(quote []byte, teeNonce []byte, vtpmNonce []byte, writer io.Write
213213
return errors.Wrap(fmt.Errorf("failed to unmarshal quote"), err)
214214
}
215215

216-
if err := quoteprovider.VerifyAttestationReportTLS(attestation.GetSevSnpAttestation(), teeNonce, policy); err != nil {
216+
akPub := attestation.GetAkPub()
217+
218+
nonce := make([]byte, 0, len(teeNonce)+len(akPub))
219+
nonce = append(nonce, teeNonce...)
220+
nonce = append(nonce, akPub...)
221+
222+
attestData := sha3.Sum512(nonce)
223+
224+
if err := quoteprovider.VerifyAttestationReportTLS(attestation.GetSevSnpAttestation(), attestData[:], policy); err != nil {
217225
return fmt.Errorf("failed to verify TEE attestation report: %v", err)
218226
}
219227

@@ -307,7 +315,15 @@ func FetchQuote(nonce []byte) (*attest.Attestation, error) {
307315
}
308316

309317
func addTEEAttestation(attestation *attest.Attestation, nonce []byte, vmpl uint) error {
310-
rawTeeAttestation, err := quoteprovider.FetchAttestation(nonce, vmpl)
318+
akPub := attestation.GetAkPub()
319+
320+
teeNonce := make([]byte, 0, len(nonce)+len(akPub))
321+
teeNonce = append(teeNonce, nonce...)
322+
teeNonce = append(teeNonce, akPub...)
323+
324+
attestData := sha3.Sum512(teeNonce)
325+
326+
rawTeeAttestation, err := quoteprovider.FetchAttestation(attestData[:], vmpl)
311327
if err != nil {
312328
return fmt.Errorf("failed to fetch TEE attestation report: %v", err)
313329
}

0 commit comments

Comments
 (0)