File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed
src/java.base/share/classes/sun/security/ssl
test/jdk/javax/net/ssl/SSLSession Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -568,15 +568,15 @@ public byte[] produce(ConnectionContext context) throws IOException {
568568 "No new session is allowed and " +
569569 "no existing session can be resumed" );
570570 }
571-
572- if (chc .maximumActiveProtocol .useTLS13PlusSpec () &&
573- SSLConfiguration .useCompatibilityMode ) {
574- // In compatibility mode, the TLS 1.3 legacy_session_id
575- // field MUST be non-empty, so a client not offering a
576- // pre-TLS 1.3 session MUST generate a new 32-byte value.
577- sessionId =
571+ }
572+ if (sessionId .length () == 0 &&
573+ chc .maximumActiveProtocol .useTLS13PlusSpec () &&
574+ SSLConfiguration .useCompatibilityMode ) {
575+ // In compatibility mode, the TLS 1.3 legacy_session_id
576+ // field MUST be non-empty, so a client not offering a
577+ // pre-TLS 1.3 session MUST generate a new 32-byte value.
578+ sessionId =
578579 new SessionId (true , chc .sslContext .getSecureRandom ());
579- }
580580 }
581581
582582 ProtocolVersion minimumVersion = ProtocolVersion .NONE ;
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ final class SSLConfiguration implements Cloneable {
9797 static final boolean allowLegacyMasterSecret =
9898 Utilities .getBooleanProperty ("jdk.tls.allowLegacyMasterSecret" , true );
9999
100- // Allow full handshake without Extended Master Secret extension .
100+ // Use TLS1.3 middlebox compatibility mode .
101101 static final boolean useCompatibilityMode = Utilities .getBooleanProperty (
102102 "jdk.tls.client.useCompatibilityMode" , true );
103103
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
2626
2727/*
2828 * @test
29- * @bug 8211806
29+ * @bug 8211806 8277881
3030 * @summary TLS 1.3 handshake server name indication is missing on a session resume
3131 * @run main/othervm ResumeTLS13withSNI
3232 */
@@ -338,6 +338,9 @@ private static void checkResumedClientHelloSNI(ByteBuffer resCliHello)
338338
339339 // Get the legacy session length and skip that many bytes
340340 int sessIdLen = Byte .toUnsignedInt (resCliHello .get ());
341+ if (sessIdLen == 0 ) {
342+ throw new Exception ("SessionID field empty" );
343+ }
341344 resCliHello .position (resCliHello .position () + sessIdLen );
342345
343346 // Skip over all the cipher suites
You can’t perform that action at this time.
0 commit comments