Skip to content

Commit 4f71339

Browse files
authored
quic: always use empty session ID (#297)
1 parent 1f5d7d7 commit 4f71339

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

u_parrots.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,12 +2672,21 @@ func (uconn *UConn) ApplyPreset(p *ClientHelloSpec) error {
26722672
hello.CipherSuites[i] = GetBoringGREASEValue(uconn.greaseSeed, ssl_grease_cipher)
26732673
}
26742674
}
2675-
var sessionID [32]byte
2676-
_, err = io.ReadFull(uconn.config.rand(), sessionID[:])
2677-
if err != nil {
2678-
return err
2675+
2676+
// A random session ID is used to detect when the server accepted a ticket
2677+
// and is resuming a session (see RFC 5077). In TLS 1.3, it's always set as
2678+
// a compatibility measure (see RFC 8446, Section 4.1.2).
2679+
//
2680+
// The session ID is not set for QUIC connections (see RFC 9001, Section 8.4).
2681+
if uconn.quic == nil {
2682+
var sessionID [32]byte
2683+
_, err = io.ReadFull(uconn.config.rand(), sessionID[:])
2684+
if err != nil {
2685+
return err
2686+
}
2687+
uconn.HandshakeState.Hello.SessionId = sessionID[:]
26792688
}
2680-
uconn.HandshakeState.Hello.SessionId = sessionID[:]
2689+
26812690
uconn.Extensions = make([]TLSExtension, len(p.Extensions))
26822691
copy(uconn.Extensions, p.Extensions)
26832692

0 commit comments

Comments
 (0)