mirror of
https://github.com/XTLS/REALITY.git
synced 2026-09-27 17:38:00 +03:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user