aboutsummaryrefslogtreecommitdiff
path: root/src/math
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2020-04-23 13:58:46 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2020-04-24 05:30:31 +0000
commit619c7a48a38b28b521591b490fd14ccb7ea5e821 (patch)
tree82bfb500ce8043c03f584f15f8ec989f24da6ec7 /src/math
parentd0ea533c54092e034ab474691df56f8da05ed0d5 (diff)
downloadgo-619c7a48a38b28b521591b490fd14ccb7ea5e821.tar.xz
crypto/x509: add x509omitbundledroots build tag to not embed roots
On darwin/arm64, the copy of the system roots takes 256 KiB of disk and 560 KiB of memory after parsing them (which is retained forever in a package global by x509/root.go). In constrained environments like iOS NetworkExtensions where total disk+RAM is capped at 15 MiB, these certs take 5.3% of the total allowed memory. It turns out you can get down from 816 KiB to 110 KiB by instead storing compressed x509 certs in the binary and lazily inflating just the needed certs at runtime as a function of the certs presented to you by the server, then building a custom root CertPool in the crypto/tls.Config.VerifyPeerCertificate hook. This then saves 706 KiB. Arguably that should be the default Go behavior, but involves cooperation between x509 and tls, and adds a dependency to compress/gzip. Also, it may not be the right trade-off for everybody, as it involves burning more CPU on new TLS connections. Most iOS apps don't run in a NetworkExtension context limiting them to 15 MiB. The build tag is chosen to match the existing "nethttpomithttp2". Change-Id: I7b1c845de08b22674f81dd546e7fadc7dda68bd7 Reviewed-on: https://go-review.googlesource.com/c/go/+/229762 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Filippo Valsorda <filippo@golang.org>
Diffstat (limited to 'src/math')
0 files changed, 0 insertions, 0 deletions