mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
crypto/tls: add offered cipher suites to the handshake error
This change makes debugging easier if the server handshake fails because the client only offers unsupported algorithms. Change-Id: I7daac173a16af2e073aec3d9b59709560f540c6f Reviewed-on: https://go-review.googlesource.com/c/go/+/631555 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Filippo Valsorda <filippo@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
a6e7445457
commit
3046b49991
@ -378,7 +378,8 @@ func (hs *serverHandshakeState) pickCipherSuite() error {
|
||||
hs.suite = selectCipherSuite(preferenceList, hs.clientHello.cipherSuites, hs.cipherSuiteOk)
|
||||
if hs.suite == nil {
|
||||
c.sendAlert(alertHandshakeFailure)
|
||||
return errors.New("tls: no cipher suite supported by both client and server")
|
||||
return fmt.Errorf("tls: no cipher suite supported by both client and server; client offered: %x",
|
||||
hs.clientHello.cipherSuites)
|
||||
}
|
||||
c.cipherSuite = hs.suite.id
|
||||
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"crypto/rsa"
|
||||
"crypto/tls/internal/fips140tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"hash"
|
||||
"internal/byteorder"
|
||||
"io"
|
||||
@ -190,7 +191,8 @@ func (hs *serverHandshakeStateTLS13) processClientHello() error {
|
||||
}
|
||||
if hs.suite == nil {
|
||||
c.sendAlert(alertHandshakeFailure)
|
||||
return errors.New("tls: no cipher suite supported by both client and server")
|
||||
return fmt.Errorf("tls: no cipher suite supported by both client and server; client offered: %x",
|
||||
hs.clientHello.cipherSuites)
|
||||
}
|
||||
c.cipherSuite = hs.suite.id
|
||||
hs.hello.cipherSuite = hs.suite.id
|
||||
|
Loading…
x
Reference in New Issue
Block a user