]> Cypherpunks.ru repositories - gostls13.git/commit
crypto/x509: use platform verifier on darwin
authorRoland Shoemaker <roland@golang.org>
Wed, 29 Sep 2021 18:31:01 +0000 (11:31 -0700)
committerRoland Shoemaker <roland@golang.org>
Fri, 5 Nov 2021 22:28:32 +0000 (22:28 +0000)
commitfeb024f4153395e5bbb2a51bb3d1ddc4f5b0d2dc
tree36380121da842b5310fc17a548505752039f9826
parent8f923a4e3c03829874b43291f2bdfd12e2d8189b
crypto/x509: use platform verifier on darwin

When VerifyOptions.Roots is nil, default to using the platform X.509
certificate verification APIs on darwin, rather than using the Go
verifier. Since our oldest supported version of macOS is 10.12, we are
able to use the modern verification APIs, and don't need to resort to
the complex chain building trickery employed by chromium et al.

Unfortunately there is not a clean way to programmatically add test
roots to the system trust store that the builders would tolerate. The
most obvious solution, using 'security add-trusted-cert' requires human
interaction for authorization. We could also manually add anchors to
the constructed SecTrustRef, but that would require adding a whole
bunch of plumbing for test functionality, and would mean we weren't
really testing the actual non-test path. The path I've chosen here is
to just utilize existing valid, and purposefully invalid, trusted
chains, from google.com and the badssl.com test suite. This requires
external network access, but most accurately reflects real world
contexts.

This change removes the x509.SystemCertPool() functionality, which will
be ammended in a follow-up change which supports the suggested hybrid
pool approach described in #46287.

Updates #46287
Fixes #42414
Fixes #38888
Fixes #35631
Fixes #19561

Change-Id: I17f0d6c5cb3ef8a1f2731ce3296478b28d30df46
Reviewed-on: https://go-review.googlesource.com/c/go/+/353132
Trust: Roland Shoemaker <roland@golang.org>
Run-TryBot: Roland Shoemaker <roland@golang.org>
Reviewed-by: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
src/crypto/x509/cert_pool.go
src/crypto/x509/internal/macos/corefoundation.go
src/crypto/x509/internal/macos/corefoundation.s
src/crypto/x509/internal/macos/security.go
src/crypto/x509/internal/macos/security.s
src/crypto/x509/root_darwin.go
src/crypto/x509/root_darwin_test.go
src/crypto/x509/verify.go
src/crypto/x509/verify_test.go
src/crypto/x509/x509_test.go