Skip to content

Commit

Permalink
Improve tcb advisory error test
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <dw@edgeless.systems>
  • Loading branch information
daniel-weisse committed Oct 2, 2024
1 parent f1130a8 commit 5035c93
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions api/attestation/attestation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ func TestVerifyCertificate(t *testing.T) {
"tcb error with advisories rejected": {
config: func() Config {
config := defaultConfig
config.AcceptedTCBStatuses = []string{"SWHardeningNeeded"}
config.AcceptedAdvisories = []string{"INTEL-SA-0002"}
return config
}(),
Expand Down Expand Up @@ -278,6 +279,25 @@ func TestVerifyCertificate(t *testing.T) {
}, attestation.ErrTCBLevelInvalid
},
},
"report contains tcb advisory parsing error": {
config: func() Config {
config := defaultConfig
config.AcceptedTCBStatuses = []string{"SWHardeningNeeded"}
config.AcceptedAdvisories = []string{"INTEL-SA-0001"}
return config
}(),
verify: func([]byte) (attestation.Report, error) {
return attestation.Report{
Data: quoteData[:],
SecurityVersion: 2,
ProductID: []byte{0x03, 0x00},
SignerID: []byte{0xAB, 0xCD},
TCBStatus: tcbstatus.SWHardeningNeeded,
TCBAdvisoriesErr: assert.AnError,
}, attestation.ErrTCBLevelInvalid
},
wantErr: true,
},
}

for name, tc := range testCases {
Expand Down

0 comments on commit 5035c93

Please sign in to comment.