Fix: always store client hello in ConnectionState (#161)

always store CH in ConnectionState

Fixes a bug. On a server side, ConnectionState.ClientHello was filled
only in case server was handling TLSv1.3
Esse commit está contido em:
Henry Case 2019-03-13 12:10:20 +00:00 commit de GitHub
commit af21f3083c
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados
ID da chave GPG: 4AEE18F83AFDEB23
3 arquivos alterados com 3 adições e 6 exclusões

2
13.go
Ver arquivo

@ -234,8 +234,6 @@ func (hs *serverHandshakeState) doTLS13Handshake() error {
c := hs.c c := hs.c
hs.c.cipherSuite, hs.hello.cipherSuite = hs.suite.id, hs.suite.id hs.c.cipherSuite, hs.hello.cipherSuite = hs.suite.id, hs.suite.id
hs.c.clientHello = hs.clientHello.marshal()
// When picking the group for the handshake, priority is given to groups // When picking the group for the handshake, priority is given to groups
// that the client provided a keyShare for, so to avoid a round-trip. // that the client provided a keyShare for, so to avoid a round-trip.
// After that the order of CurvePreferences is respected. // After that the order of CurvePreferences is respected.

Ver arquivo

@ -180,7 +180,7 @@ func main() {
for _, ng := range strings.Split(named_groups, ":") { for _, ng := range strings.Split(named_groups, ":") {
id, err := getIDByName(namedGroupsToName, ng) id, err := getIDByName(namedGroupsToName, ng)
if err != nil { if err != nil {
panic("Wrong TLS version provided") panic("Wrong group name provided")
} }
client.TLS.CurvePreferences = append(client.TLS.CurvePreferences, tls.CurveID(id)) client.TLS.CurvePreferences = append(client.TLS.CurvePreferences, tls.CurveID(id))
} }

Ver arquivo

@ -65,10 +65,9 @@ func (c *Conn) serverHandshake() error {
if err != nil { if err != nil {
return err return err
} }
c.clientHello = hs.clientHello.marshal()
// For an overview of TLS handshaking, see https://tools.ietf.org/html/rfc5246#section-7.3
// and https://tools.ietf.org/html/draft-ietf-tls-tls13-18#section-2
c.buffering = true c.buffering = true
if c.vers >= VersionTLS13 { if c.vers >= VersionTLS13 {
if err := hs.doTLS13Handshake(); err != nil { if err := hs.doTLS13Handshake(); err != nil {
return err return err