Skip to content

Commit 6097233

Browse files
committed
TLS: Defer sealHashAlgorithms to after ClientHello retry
1 parent e965064 commit 6097233

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tls/src/main/java/org/bouncycastle/tls/TlsClientProtocol.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,22 +484,34 @@ protected void handleHandshakeMessage(short type, HandshakeMessageInput buf)
484484
{
485485
process13HelloRetryRequest(serverHello);
486486
handshakeHash.notifyPRFDetermined();
487-
handshakeHash.sealHashAlgorithms();
487+
488488
TlsUtils.adjustTranscriptForRetry(handshakeHash);
489+
489490
buf.updateHash(handshakeHash);
490491
this.connection_state = CS_SERVER_HELLO_RETRY_REQUEST;
491492

492493
send13ClientHelloRetry();
493494
this.connection_state = CS_CLIENT_HELLO_RETRY;
495+
496+
/*
497+
* PSK binders (if any) when retrying ClientHello currently require handshakeHash buffering
498+
*/
499+
handshakeHash.sealHashAlgorithms();
494500
}
495501
else
496502
{
497503
processServerHello(serverHello);
498504
handshakeHash.notifyPRFDetermined();
505+
499506
if (TlsUtils.isTLSv13(securityParameters.getNegotiatedVersion()))
500507
{
501508
handshakeHash.sealHashAlgorithms();
502509
}
510+
else
511+
{
512+
// For pre-1.3 wait until ServerHelloDone is received
513+
}
514+
503515
buf.updateHash(handshakeHash);
504516
this.connection_state = CS_SERVER_HELLO;
505517

0 commit comments

Comments
 (0)