Skip to content

Commit c434774

Browse files
cjpattonLekensteyn
authored andcommitted
crypto/tls: Fix nil dereference in greased ECH acceptance signal
When greasing the ECH acceptance signal in the HRR, the server uses `c.config.Rand`, which may be `nil`. This prevents the nil dereference by using `c.config.rand()`, which first checks if `c.config.Rand == nil`'. This bug was found when interop testing with boringSSL.
1 parent 5d8d981 commit c434774

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/crypto/tls/handshake_server_tls13.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ func (hs *serverHandshakeStateTLS13) doHelloRetryRequest(selectedGroup CurveID)
595595
// "encrypted_client_hello" extension with a payload of 8 random bytes;
596596
// see Section 10.9.4 for details.
597597
helloRetryRequest.ech = make([]byte, 8)
598-
if _, err := io.ReadFull(c.config.Rand, helloRetryRequest.ech); err != nil {
598+
if _, err := io.ReadFull(c.config.rand(), helloRetryRequest.ech); err != nil {
599599
c.sendAlert(alertInternalError)
600600
return fmt.Errorf("tls: internal error: rng failure: %s", err)
601601
}

0 commit comments

Comments
 (0)