Skip to content

Commit

Permalink
Add support for re-keying with TLS 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallimore committed Sep 30, 2024
1 parent 873b3ee commit ae97f8e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions java/org/apache/tomcat/util/net/SecureNioChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class SecureNioChannel extends NioChannel {
protected SSLEngine sslEngine;

protected boolean handshakeComplete = false;
protected boolean needHandshakeWrap = false;
protected HandshakeStatus handshakeStatus; //gets set by handshake

protected boolean closed = false;
Expand Down Expand Up @@ -480,6 +481,14 @@ public int read(ByteBuffer dst) throws IOException {
//perform any tasks if needed
if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
tasks();
} else if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_WRAP) {
if (getOutboundRemaining() == 0) {
handshakeWrap(true);
} else if (needHandshakeWrap) {
throw new IOException(sm.getString("channel.nio.ssl.handshakeWrapPending"));
} else {
needHandshakeWrap = true;
}
}
//if we need more network data, then bail out for now.
if (unwrap.getStatus() == Status.BUFFER_UNDERFLOW) {
Expand Down

0 comments on commit ae97f8e

Please sign in to comment.