Skip to content

Commit

Permalink
ca: minor comment additions
Browse files Browse the repository at this point in the history
  • Loading branch information
wgreenberg committed Feb 27, 2024
1 parent 856df11 commit 392fa46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
20 changes: 11 additions & 9 deletions ca/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ var ocspMustStapleExt = pkix.Extension{
Value: []byte{0x30, 0x03, 0x02, 0x01, 0x05},
}

// Returns whether the given extensions array contains an OCSP Must-Staple
// extension.
func extensionsContainsOCSPMustStaple(extensions []pkix.Extension) bool {
for _, ext := range extensions {
if ext.Id.Equal(ocspMustStapleExt.Id) && bytes.Equal(ext.Value, ocspMustStapleExt.Value) {
return true
}
}
return false
}

func (ca *CAImpl) CompleteOrder(order *core.Order) {
// Lock the order for reading
order.RLock()
Expand Down Expand Up @@ -427,15 +438,6 @@ func (ca *CAImpl) CompleteOrder(order *core.Order) {
order.Unlock()
}

func extensionsContainsOCSPMustStaple(extensions []pkix.Extension) bool {
for _, ext := range extensions {
if ext.Id.Equal(ocspMustStapleExt.Id) && bytes.Equal(ext.Value, ocspMustStapleExt.Value) {
return true
}
}
return false
}

func (ca *CAImpl) GetNumberOfRootCerts() int {
return len(ca.chains)
}
Expand Down
2 changes: 1 addition & 1 deletion ca/ca_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func TestSettingOCSPMustStapleExtension(t *testing.T) {
t.Error("Expected foundOCSPExtension.Critical to be false, but it was true")
}

// Test w/ several extensions
// Test w/ duplicate extensions
ca = makeCa()
order = makeCertOrderWithExtensions([]pkix.Extension{
{
Expand Down

0 comments on commit 392fa46

Please sign in to comment.