crypto/tls: remove the tlsunsafeekm GODEBUG setting

Updates #75316

Change-Id: I2efa3e485653f5b403d92e5d99959e356a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/777380
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
yuhan6665
2026-09-10 22:25:08 -04:00
parent 72e1a2490a
commit 5f5c7a1144
3 changed files with 2 additions and 13 deletions
-5
View File
@@ -338,11 +338,6 @@ type ConnectionState struct {
// the seed. If the connection was set to allow renegotiation via
// Config.Renegotiation, or if the connections supports neither TLS 1.3 nor
// Extended Master Secret, this function will return an error.
//
// Exporting key material without Extended Master Secret or TLS 1.3 was disabled
// in Go 1.22 due to security issues (see the Security Considerations sections
// of RFC 5705 and RFC 7627), but can be re-enabled with the GODEBUG setting
// tlsunsafeekm=1.
func (cs *ConnectionState) ExportKeyingMaterial(label string, context []byte, length int) ([]byte, error) {
return cs.ekm(label, context, length)
}
+1 -7
View File
@@ -1703,13 +1703,7 @@ func (c *Conn) connectionStateLocked() ConnectionState {
if c.config.Renegotiation != RenegotiateNever {
state.ekm = noEKMBecauseRenegotiation
} else if c.vers != VersionTLS13 && !c.extMasterSecret {
state.ekm = func(label string, context []byte, length int) ([]byte, error) {
// if ekmgodebug.Value() == "1" {
// ekmgodebug.IncNonDefault()
// return c.ekm(label, context, length)
// }
return noEKMBecauseNoEMS(label, context, length)
}
state.ekm = noEKMBecauseNoEMS
} else {
state.ekm = c.ekm
}
+1 -1
View File
@@ -250,7 +250,7 @@ func noEKMBecauseRenegotiation(label string, context []byte, length int) ([]byte
// Master Secret is not negotiated and thus we wish to fail all key-material
// export requests.
func noEKMBecauseNoEMS(label string, context []byte, length int) ([]byte, error) {
return nil, errors.New("crypto/tls: ExportKeyingMaterial is unavailable when neither TLS 1.3 nor Extended Master Secret are negotiated; override with GODEBUG=tlsunsafeekm=1")
return nil, errors.New("crypto/tls: ExportKeyingMaterial is unavailable when neither TLS 1.3 nor Extended Master Secret are negotiated")
}
// ekmFromMasterSecret generates exported keying material as defined in RFC 5705.