mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-08-01 08:01:01 +00:00
RTG-2418 Update qtls
This commit is contained in:
27
vendor/github.com/marten-seemann/qtls-go1-18/conn.go
generated
vendored
27
vendor/github.com/marten-seemann/qtls-go1-18/conn.go
generated
vendored
@@ -125,6 +125,9 @@ type Conn struct {
|
||||
used0RTT bool
|
||||
|
||||
tmp [16]byte
|
||||
|
||||
connStateMutex sync.Mutex
|
||||
connState ConnectionStateWith0RTT
|
||||
}
|
||||
|
||||
// Access to net.Conn methods.
|
||||
@@ -1533,19 +1536,16 @@ func (c *Conn) handshakeContext(ctx context.Context) (ret error) {
|
||||
|
||||
// ConnectionState returns basic TLS details about the connection.
|
||||
func (c *Conn) ConnectionState() ConnectionState {
|
||||
c.handshakeMutex.Lock()
|
||||
defer c.handshakeMutex.Unlock()
|
||||
return c.connectionStateLocked()
|
||||
c.connStateMutex.Lock()
|
||||
defer c.connStateMutex.Unlock()
|
||||
return c.connState.ConnectionState
|
||||
}
|
||||
|
||||
// ConnectionStateWith0RTT returns basic TLS details (incl. 0-RTT status) about the connection.
|
||||
func (c *Conn) ConnectionStateWith0RTT() ConnectionStateWith0RTT {
|
||||
c.handshakeMutex.Lock()
|
||||
defer c.handshakeMutex.Unlock()
|
||||
return ConnectionStateWith0RTT{
|
||||
ConnectionState: c.connectionStateLocked(),
|
||||
Used0RTT: c.used0RTT,
|
||||
}
|
||||
c.connStateMutex.Lock()
|
||||
defer c.connStateMutex.Unlock()
|
||||
return c.connState
|
||||
}
|
||||
|
||||
func (c *Conn) connectionStateLocked() ConnectionState {
|
||||
@@ -1576,6 +1576,15 @@ func (c *Conn) connectionStateLocked() ConnectionState {
|
||||
return toConnectionState(state)
|
||||
}
|
||||
|
||||
func (c *Conn) updateConnectionState() {
|
||||
c.connStateMutex.Lock()
|
||||
defer c.connStateMutex.Unlock()
|
||||
c.connState = ConnectionStateWith0RTT{
|
||||
Used0RTT: c.used0RTT,
|
||||
ConnectionState: c.connectionStateLocked(),
|
||||
}
|
||||
}
|
||||
|
||||
// OCSPResponse returns the stapled OCSP response from the TLS server, if
|
||||
// any. (Only valid for client connections.)
|
||||
func (c *Conn) OCSPResponse() []byte {
|
||||
|
1
vendor/github.com/marten-seemann/qtls-go1-18/handshake_client.go
generated
vendored
1
vendor/github.com/marten-seemann/qtls-go1-18/handshake_client.go
generated
vendored
@@ -306,6 +306,7 @@ func (c *Conn) clientHandshake(ctx context.Context) (err error) {
|
||||
c.config.ClientSessionCache.Put(cacheKey, toClientSessionState(hs.session))
|
||||
}
|
||||
|
||||
c.updateConnectionState()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/marten-seemann/qtls-go1-18/handshake_client_tls13.go
generated
vendored
4
vendor/github.com/marten-seemann/qtls-go1-18/handshake_client_tls13.go
generated
vendored
@@ -83,6 +83,7 @@ func (hs *clientHandshakeStateTLS13) handshake() error {
|
||||
if err := hs.processServerHello(); err != nil {
|
||||
return err
|
||||
}
|
||||
c.updateConnectionState()
|
||||
if err := hs.sendDummyChangeCipherSpec(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -95,6 +96,7 @@ func (hs *clientHandshakeStateTLS13) handshake() error {
|
||||
if err := hs.readServerCertificate(); err != nil {
|
||||
return err
|
||||
}
|
||||
c.updateConnectionState()
|
||||
if err := hs.readServerFinished(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -115,7 +117,7 @@ func (hs *clientHandshakeStateTLS13) handshake() error {
|
||||
})
|
||||
|
||||
atomic.StoreUint32(&c.handshakeStatus, 1)
|
||||
|
||||
c.updateConnectionState()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
1
vendor/github.com/marten-seemann/qtls-go1-18/handshake_server.go
generated
vendored
1
vendor/github.com/marten-seemann/qtls-go1-18/handshake_server.go
generated
vendored
@@ -132,6 +132,7 @@ func (hs *serverHandshakeState) handshake() error {
|
||||
c.ekm = ekmFromMasterSecret(c.vers, hs.suite, hs.masterSecret, hs.clientHello.random, hs.hello.random)
|
||||
atomic.StoreUint32(&c.handshakeStatus, 1)
|
||||
|
||||
c.updateConnectionState()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/marten-seemann/qtls-go1-18/handshake_server_tls13.go
generated
vendored
4
vendor/github.com/marten-seemann/qtls-go1-18/handshake_server_tls13.go
generated
vendored
@@ -56,6 +56,7 @@ func (hs *serverHandshakeStateTLS13) handshake() error {
|
||||
if err := hs.checkForResumption(); err != nil {
|
||||
return err
|
||||
}
|
||||
c.updateConnectionState()
|
||||
if err := hs.pickCertificate(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -78,6 +79,7 @@ func (hs *serverHandshakeStateTLS13) handshake() error {
|
||||
if err := hs.readClientCertificate(); err != nil {
|
||||
return err
|
||||
}
|
||||
c.updateConnectionState()
|
||||
if err := hs.readClientFinished(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -89,7 +91,7 @@ func (hs *serverHandshakeStateTLS13) handshake() error {
|
||||
})
|
||||
|
||||
atomic.StoreUint32(&c.handshakeStatus, 1)
|
||||
|
||||
c.updateConnectionState()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user