Skip to content

Commit

Permalink
TKSS-739: Backport JDK-8326643: JDK server does not send a dummy chan…
Browse files Browse the repository at this point in the history
…ge_cipher_spec record after HelloRetryRequest message
  • Loading branch information
johnshajiang committed Mar 22, 2024
1 parent ceee95b commit 2ec1a5a
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -803,6 +803,15 @@ public byte[] produce(ConnectionContext context,
hhrm.write(shc.handshakeOutput);
shc.handshakeOutput.flush();

// In TLS1.3 middlebox compatibility mode the server sends a
// dummy change_cipher_spec record immediately after its
// first handshake message. This may either be after
// a ServerHello or a HelloRetryRequest.
// (RFC 8446, Appendix D.4)
shc.conContext.outputRecord.changeWriteCiphers(
SSLWriteCipher.nullTlsWriteCipher(),
(clientHello.sessionId.length() != 0));

// Stateless, shall we clean up the handshake context as well?
shc.handshakeHash.finish(); // forgot about the handshake hash
shc.handshakeExtensions.clear();
Expand Down

0 comments on commit 2ec1a5a

Please sign in to comment.