crypto/tls: send two session tickets to TLS 1.3 clients

This commit is contained in:
Filippo Valsorda 2017-01-30 18:03:46 +00:00 committed by Peter Wu
parent 44df381ccb
commit 9b94b65b7b

6
13.go
View File

@ -24,6 +24,10 @@ import (
"golang_org/x/crypto/curve25519"
)
// numSessionTickets is the number of different session tickets the
// server sends to a TLS 1.3 client, whom will use each only once.
const numSessionTickets = 2
func (hs *serverHandshakeState) doTLS13Handshake() error {
config := hs.c.config
c := hs.c
@ -544,6 +548,7 @@ func (hs *serverHandshakeState) sendSessionTicket13() error {
maxEarlyDataLen: c.config.Max0RTTDataSize,
}
for i := 0; i < numSessionTickets; i++ {
ticket, err := c.encryptTicket(sessionState.marshal())
if err != nil {
c.sendAlert(alertInternalError)
@ -559,6 +564,7 @@ func (hs *serverHandshakeState) sendSessionTicket13() error {
if _, err := c.writeRecord(recordTypeHandshake, ticketMsg.marshal()); err != nil {
return err
}
}
return nil
}