go/src
Brad Fitzpatrick 3357daa96e crypto/x509: speed up and deflake non-cgo Darwin root cert discovery
Piping into security verify-cert only worked on macOS Sierra, and was
flaky for unknown reasons. Users reported that the number of trusted
root certs stopped randomly jumping around once they switched to using
verify-cert against files on disk instead of /dev/stdin.

But even using "security verify-cert" on 150-200 certs took too
long. It took 3.5 seconds on my machine. More than 4 goroutines
hitting verify-cert didn't help much, and soon started to hurt
instead.

New strategy, from comments in the code:

// 1. Run "security trust-settings-export" and "security
//    trust-settings-export -d" to discover the set of certs with some
//    user-tweaked trusy policy. We're too lazy to parse the XML (at
//    least at this stage of Go 1.8) to understand what the trust
//    policy actually is. We just learn that there is _some_ policy.
//
// 2. Run "security find-certificate" to dump the list of system root
//    CAs in PEM format.
//
// 3. For each dumped cert, conditionally verify it with "security
//    verify-cert" if that cert was in the set discovered in Step 1.
//    Without the Step 1 optimization, running "security verify-cert"
//    150-200 times takes 3.5 seconds. With the optimization, the
//    whole process takes about 180 milliseconds with 1 untrusted root
//    CA. (Compared to 110ms in the cgo path)

Fixes #18203

Change-Id: I4e9c11fa50d0273c615382e0d8f9fd03498d4cb4
Reviewed-on: https://go-review.googlesource.com/34389
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Quentin Smith <quentin@golang.org>
2016-12-20 04:48:09 +00:00
..
archive Revert: "archive/zip: handle mtime in NTFS/UNIX/ExtendedTS extra fields" 2016-12-20 01:39:35 +00:00
bufio
builtin
bytes
cmd cmd/cover: fix spelling mistake 2016-12-20 04:45:25 +00:00
compress
container
context all: make spelling consistent 2016-12-08 23:22:37 +00:00
crypto crypto/x509: speed up and deflake non-cgo Darwin root cert discovery 2016-12-20 04:48:09 +00:00
database/sql database/sql: do not store Tx options in Context 2016-12-14 18:13:13 +00:00
debug cmd/objdump: copy gosym.PCValue into internal package 2016-12-01 18:20:04 +00:00
encoding all: make spelling consistent 2016-12-08 23:22:37 +00:00
errors
expvar
flag
fmt fmt: undo clearflags in catchPanic after error message has been printed 2016-12-11 21:59:59 +00:00
go go/internal/gccgoimporter: accept missed portions of v2 format 2016-12-14 18:47:56 +00:00
hash
html html/template: lock in application/json as valid JS test 2016-12-04 03:59:31 +00:00
image
index/suffixarray
internal internal/pprof/profile: parse mutex profile including comments 2016-11-29 18:04:37 +00:00
io io: update documentation on LimitedReader 2016-12-09 23:19:06 +00:00
log
math crypto/*: document use or non-use of constant-time algorithms 2016-12-07 16:34:50 +00:00
mime
net net: clarify IP.IsGlobalUnicast docs 2016-12-16 15:35:55 +00:00
os os: must fixup path when 248 bytes long 2016-12-13 03:21:00 +00:00
path path/filepath: deprecate HasPrefix 2016-12-16 22:30:12 +00:00
plugin cmd/go, plugin: disable plugins on darwin 2016-12-15 05:46:20 +00:00
reflect runtime: clean up and improve reflect.methodValue comments 2016-12-19 21:02:53 +00:00
regexp
runtime runtime: use mincore to detect physical page size as last resort on Android 2016-12-19 22:00:50 +00:00
sort sort: add Slice example 2016-12-01 05:43:05 +00:00
strconv
strings
sync runtime/internal/atomic: crash on unaligned 64-bit ops on 32-bit MIPS 2016-11-22 02:05:07 +00:00
syscall runtime, syscall: update openbsd for changes to syskill 2016-12-12 01:30:39 +00:00
testing Revert "testing: add T.Context method" 2016-12-09 04:04:11 +00:00
text
time time: parse WITA timezone correctly 2016-12-12 20:14:12 +00:00
unicode
unsafe
vendor/golang_org/x vendor/golang_org/x/crypto/chacha20poly1305: revendor to pick up fix for #18154 2016-12-02 06:00:05 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash
make.bat
make.rc build: fix cross-compile on Plan 9 2016-11-22 01:32:28 +00:00
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc