tempfork/x509: fix build on darwin and windows

These fixes were originally in the updates to CL 229917 after
Trybots failed there.
See https://go-review.googlesource.com/c/go/+/229917/1..3
This commit is contained in:
Brad Fitzpatrick
2020-04-25 08:03:10 -07:00
parent bfc1261ab6
commit 8fd8fc9c7d
3 changed files with 18 additions and 7 deletions
+7 -2
View File
@@ -305,8 +305,13 @@ func loadSystemRoots() (*CertPool, error) {
untrustedRoots.AppendCertsFromPEM(buf)
trustedRoots := NewCertPool()
for _, c := range roots.certs {
if !untrustedRoots.contains(c) {
for i := 0; i < roots.len(); i++ {
c := roots.mustCert(i)
contains, err := untrustedRoots.contains(c)
if err != nil {
return nil, err
}
if !contains {
trustedRoots.AddCert(c)
}
}