fix: lost secondary keyshares

Fix an unchecked overriding behavior which may lose pre-created handshake keys.
This commit is contained in:
Gaukas Wang 2023-09-04 14:31:13 -06:00
parent fc79497d3f
commit a9a1cc0137
No known key found for this signature in database
GPG key ID: 9E2F8986D76F8B5D

View file

@ -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