From 67192c2a5eb498e18f27ccfedb48e5e8e41e775c Mon Sep 17 00:00:00 2001 From: Gaukas Wang Date: Mon, 4 Sep 2023 14:38:20 -0600 Subject: [PATCH] fix: lost secondary keyshares (#238) Fix an unchecked overriding behavior which may lose pre-created handshake keys. --- u_conn.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/u_conn.go b/u_conn.go index efa4ee79..38e5149d 100644 --- a/u_conn.go +++ b/u_conn.go @@ -567,7 +567,9 @@ func (c *UConn) clientHandshake(ctx context.Context) (err error) { hs13 := c.HandshakeState.toPrivate13() hs13.serverHello = serverHello hs13.hello = hello - hs13.keySharesParams = NewKeySharesParameters() + if hs13.keySharesParams == nil { + hs13.keySharesParams = NewKeySharesParameters() + } if !sessionIsLocked { hs13.earlySecret = earlySecret hs13.binderKey = binderKey