go/src/crypto
Quentin Smith 7e5b2e0ec1 crypto/x509: read Darwin trust settings for root CAs
Darwin separately stores bits indicating whether a root certificate
should be trusted; this changes Go to read and use those when
initializing SystemCertPool.

Unfortunately, the trust API is very slow. To avoid a delay of up to
0.5s in initializing the system cert pool, we assume that
the trust settings found in kSecTrustSettingsDomainSystem will always
indicate trust. (That is, all root certs Apple distributes are trusted.)
This is not guaranteed by the API but is true in practice.

In the non-cgo codepath, we do not have that benefit, so we must check
the trust status of every certificate. This causes about 0.5s of delay
in initializing the SystemCertPool.

On OS X 10.11 and older, the "security" command requires a certificate
to be provided in a file and not on stdin, so the non-cgo codepath
creates temporary files for each certificate, further slowing initialization.

Updates #18141.

Change-Id: If681c514047afe5e1a68de6c9d40ceabbce54755
Reviewed-on: https://go-review.googlesource.com/33721
Run-TryBot: Quentin Smith <quentin@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-12-01 19:24:34 +00:00
..
aes crypto/{cipher,tls,internal/cryptohw}: prioritise AES-GCM when hardware support is present. 2016-11-07 20:01:18 +00:00
cipher crypto/{aes,cipher}: fix panic in CBC on s390x when src length is 0 2016-10-13 21:42:23 +00:00
des all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
dsa crypto/dsa: eliminate invalid PublicKey early 2016-04-05 17:41:47 +00:00
ecdsa crypto/ecdsa: correct code comment. 2016-10-02 19:38:37 +00:00
elliptic all: spell "marshal" and "unmarshal" consistently 2016-11-12 00:13:35 +00:00
hmac crypto/hmac: don't test for length equality in Equal. 2016-08-17 23:23:28 +00:00
internal/cipherhw crypto/{cipher,tls,internal/cryptohw}: prioritise AES-GCM when hardware support is present. 2016-11-07 20:01:18 +00:00
md5 crypto/md5, crypto/sha1, crypto/sha256: add examples for checksumming a file 2016-09-19 17:29:19 +00:00
rand math/big: add Baillie-PSW test to (*Int).ProbablyPrime 2016-11-22 02:05:47 +00:00
rc4 all: fix assembly vet issues 2016-08-25 18:52:31 +00:00
rsa crypto/rsa: clarify comment on maximum message length. 2016-09-22 03:06:25 +00:00
sha1 all: make copyright headers consistent with one space after period 2016-11-04 20:46:25 +00:00
sha256 all: make copyright headers consistent with one space after period 2016-11-04 20:46:25 +00:00
sha512 crypto/sha512: improve performance for sha512.block on ppc64le 2016-10-31 19:13:52 +00:00
subtle crypto/subtle: expand abbreviation to eliminate confusion 2016-06-09 15:30:48 +00:00
tls crypto/tls: update CBC Lucky13 warning a bit 2016-11-29 21:38:45 +00:00
x509 crypto/x509: read Darwin trust settings for root CAs 2016-12-01 19:24:34 +00:00
crypto.go