crypto/tls: send two session tickets to TLS 1.3 clients
This commit is contained in:
parent
44df381ccb
commit
9b94b65b7b
34
13.go
34
13.go
@ -24,6 +24,10 @@ import (
|
|||||||
"golang_org/x/crypto/curve25519"
|
"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 {
|
func (hs *serverHandshakeState) doTLS13Handshake() error {
|
||||||
config := hs.c.config
|
config := hs.c.config
|
||||||
c := hs.c
|
c := hs.c
|
||||||
@ -544,20 +548,22 @@ func (hs *serverHandshakeState) sendSessionTicket13() error {
|
|||||||
maxEarlyDataLen: c.config.Max0RTTDataSize,
|
maxEarlyDataLen: c.config.Max0RTTDataSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
ticket, err := c.encryptTicket(sessionState.marshal())
|
for i := 0; i < numSessionTickets; i++ {
|
||||||
if err != nil {
|
ticket, err := c.encryptTicket(sessionState.marshal())
|
||||||
c.sendAlert(alertInternalError)
|
if err != nil {
|
||||||
return err
|
c.sendAlert(alertInternalError)
|
||||||
}
|
return err
|
||||||
ticketMsg := &newSessionTicketMsg13{
|
}
|
||||||
lifetime: 24 * 3600, // TODO(filippo)
|
ticketMsg := &newSessionTicketMsg13{
|
||||||
maxEarlyDataLength: c.config.Max0RTTDataSize,
|
lifetime: 24 * 3600, // TODO(filippo)
|
||||||
withEarlyDataInfo: c.config.Max0RTTDataSize > 0,
|
maxEarlyDataLength: c.config.Max0RTTDataSize,
|
||||||
ageAdd: sessionState.ageAdd,
|
withEarlyDataInfo: c.config.Max0RTTDataSize > 0,
|
||||||
ticket: ticket,
|
ageAdd: sessionState.ageAdd,
|
||||||
}
|
ticket: ticket,
|
||||||
if _, err := c.writeRecord(recordTypeHandshake, ticketMsg.marshal()); err != nil {
|
}
|
||||||
return err
|
if _, err := c.writeRecord(recordTypeHandshake, ticketMsg.marshal()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user