Skip to content

Commit

Permalink
crypto/x509: fix system root tests + darwin intermediate handling
Browse files Browse the repository at this point in the history
On Windows, replace tests which rely on a root that expired last year.
On Darwin fix an test which wasn't testing the expected behavior, and
fix the behavior which was broken.

Fixes #58791

Change-Id: I771175b9e123b8bb0e4efdf58cc2bb93aa94fbae
Reviewed-on: https://go-review.googlesource.com/c/go/+/472295
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Bryan Mills <[email protected]>
Run-TryBot: Roland Shoemaker <[email protected]>
  • Loading branch information
rolandshoemaker committed Mar 1, 2023
1 parent 0384235 commit bb8f9a6
Show file tree
Hide file tree
Showing 3 changed files with 238 additions and 259 deletions.
5 changes: 3 additions & 2 deletions src/crypto/x509/root_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate
return nil, err
}
sc, err := macOS.SecCertificateCreateWithData(c.Raw)
if err == nil {
macOS.CFArrayAppendValue(certs, sc)
if err != nil {
return nil, err
}
macOS.CFArrayAppendValue(certs, sc)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/crypto/x509/root_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestLoadSystemCertsLoadColonSeparatedDirs(t *testing.T) {
tmpDir := t.TempDir()

rootPEMs := []string{
geoTrustRoot,
gtsRoot,
googleLeaf,
startComRoot,
}
Expand Down
Loading

0 comments on commit bb8f9a6

Please sign in to comment.