IncNonDefault panics if Value was not called. That's too much DoS risk
in crypto/tls, when the call to Value is distant from the call to
IncNonDefault (see #65991). Value is cheap, though, so we can just call
it before each isolated IncNonDefault.
Change-Id: I6dbed345381e60e029b0a5ef2232e846aa089736
Reviewed-on: https://go-review.googlesource.com/c/go/+/586755
Reviewed-by: Roland Shoemaker <roland@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
}
if hs.c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
+ tlsrsakex.Value() // ensure godebug is initialized
tlsrsakex.IncNonDefault()
}
c.out.version = c.vers
if c.config.MinVersion == 0 && c.vers < VersionTLS12 {
+ tls10server.Value() // ensure godebug is initialized
tls10server.IncNonDefault()
}
c.cipherSuite = hs.suite.id
if c.config.CipherSuites == nil && !needFIPS() && rsaKexCiphers[hs.suite.id] {
+ tlsrsakex.Value() // ensure godebug is initialized
tlsrsakex.IncNonDefault()
}