Skip to content

Commit

Permalink
Exclude additional lints in GetCertificateChain and support multiple …
Browse files Browse the repository at this point in the history
…error codes in InitializeContext.
  • Loading branch information
mmiranda96 authored and jhand2 committed Aug 29, 2024
1 parent 52d9c6d commit 2e02db5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions verification/testing/getCertificateChain.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func checkCertificateChain(t *testing.T, certData []byte) []*x509.Certificate {
// We will need to truncate the serial numbers for those certs and
// then enable this lint.
"e_subject_dn_serial_number_max_length",
// Firmware certificates don't get revocated, so there is no need
// for a CRSL to be specified in the CA certificate.
"w_distribution_point_missing_ldap_or_uri",
// Authority Information Access for CA can also be an HTTPS URI.
"w_ext_aia_access_location_missing",
},
})
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions verification/testing/initializeContext.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ func testInitContext(d client.TestDPEInstance, c client.DPEClient, t *testing.T,
// Try to initialize another default context.
_, err := c.InitializeContext(client.InitIsDefault)
if err == nil {
t.Fatal("The instance should return an error when trying to initialize another default context.")
} else if !errors.Is(err, client.StatusArgumentNotSupported) {
t.Fatalf("Incorrect error type. Should return %q, but returned %q", client.StatusArgumentNotSupported, err)
t.Error("The instance should return an error when trying to initialize another default context.")
} else if !(errors.Is(err, client.StatusArgumentNotSupported) || errors.Is(err, client.StatusInvalidArgument)) {
t.Errorf("Incorrect error type. Should return %q or %q, but returned %q", client.StatusArgumentNotSupported, client.StatusInvalidArgument, err)
}

// Try to initialize a context that is neither default or simulation.
_, err = c.InitializeContext(client.InitCtxFlags(0))
if err == nil {
t.Fatal("The instance should return an error when not default or simulation.")
t.Error("The instance should return an error when not default or simulation.")
} else if !errors.Is(err, client.StatusInvalidArgument) {
t.Fatalf("Incorrect error type. Should return %q, but returned %q", client.StatusInvalidArgument, err)
t.Errorf("Incorrect error type. Should return %q, but returned %q", client.StatusInvalidArgument, err)
}

// TODO: test exhausting handles. This requires the ability to query how
Expand Down

0 comments on commit 2e02db5

Please sign in to comment.