]> Cypherpunks repositories - gostls13.git/commit
crypto/x509: new home for root fetchers; build chains using Windows API
authorMikkel Krautz <mikkel@krautz.dk>
Wed, 7 Mar 2012 18:12:35 +0000 (13:12 -0500)
committerAdam Langley <agl@golang.org>
Wed, 7 Mar 2012 18:12:35 +0000 (13:12 -0500)
commita324a5ac2081f3760aefaf27ab47efbd59fecb17
tree65087e0085e914cfd2864a990a5b27f0ad808caf
parent807aadcd3e148110d0e7d4dc251d831c35af30b6
crypto/x509: new home for root fetchers; build chains using Windows API

This moves the various CA root fetchers from crypto/tls into crypto/x509.

The move was brought about by issue 2997. Windows doesn't ship with all
its root certificates, but will instead download them as-needed when using
CryptoAPI for certificate verification.

This CL changes crypto/x509 to verify a certificate using the system root
CAs when VerifyOptions.RootCAs == nil. On Windows, this verification is
now implemented using Windows's CryptoAPI. All other root fetchers are
unchanged, and still use Go's own verification code.

The CL also fixes the hostname matching logic in crypto/tls/tls.go, in
order to be able to test whether hostname mismatches are honored by the
Windows verification code.

The move to crypto/x509 also allows other packages to use the OS-provided
root certificates, instead of hiding them inside the crypto/tls package.

Fixes #2997.

R=agl, golang-dev, alex.brainman, rsc, mikkel
CC=golang-dev
https://golang.org/cl/5700087
16 files changed:
src/pkg/crypto/tls/common.go
src/pkg/crypto/tls/handshake_client.go
src/pkg/crypto/tls/root_test.go
src/pkg/crypto/tls/root_windows.go [deleted file]
src/pkg/crypto/tls/tls.go
src/pkg/crypto/x509/root.go [new file with mode: 0644]
src/pkg/crypto/x509/root_darwin.go [moved from src/pkg/crypto/tls/root_darwin.go with 90% similarity]
src/pkg/crypto/x509/root_stub.go [moved from src/pkg/crypto/tls/root_stub.go with 51% similarity]
src/pkg/crypto/x509/root_unix.go [moved from src/pkg/crypto/tls/root_unix.go with 76% similarity]
src/pkg/crypto/x509/root_windows.go [new file with mode: 0644]
src/pkg/crypto/x509/verify.go
src/pkg/crypto/x509/verify_test.go
src/pkg/syscall/syscall_windows.go
src/pkg/syscall/zsyscall_windows_386.go
src/pkg/syscall/zsyscall_windows_amd64.go
src/pkg/syscall/ztypes_windows.go