File tree 3 files changed +14
-11
lines changed
src/share/classes/sun/security/ssl
test/javax/net/ssl/SSLSession
3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -495,15 +495,15 @@ public byte[] produce(ConnectionContext context) throws IOException {
495
495
"No new session is allowed and " +
496
496
"no existing session can be resumed" );
497
497
}
498
-
499
- if (chc .maximumActiveProtocol .useTLS13PlusSpec () &&
500
- SSLConfiguration .useCompatibilityMode ) {
501
- // In compatibility mode, the TLS 1.3 legacy_session_id
502
- // field MUST be non-empty, so a client not offering a
503
- // pre-TLS 1.3 session MUST generate a new 32-byte value.
504
- sessionId =
498
+ }
499
+ if (sessionId .length () == 0 &&
500
+ chc .maximumActiveProtocol .useTLS13PlusSpec () &&
501
+ SSLConfiguration .useCompatibilityMode ) {
502
+ // In compatibility mode, the TLS 1.3 legacy_session_id
503
+ // field MUST be non-empty, so a client not offering a
504
+ // pre-TLS 1.3 session MUST generate a new 32-byte value.
505
+ sessionId =
505
506
new SessionId (true , chc .sslContext .getSecureRandom ());
506
- }
507
507
}
508
508
509
509
ProtocolVersion minimumVersion = ProtocolVersion .NONE ;
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ final class SSLConfiguration implements Cloneable {
95
95
static final boolean allowLegacyMasterSecret =
96
96
Utilities .getBooleanProperty ("jdk.tls.allowLegacyMasterSecret" , true );
97
97
98
- // Allow full handshake without Extended Master Secret extension .
98
+ // Use TLS1.3 middlebox compatibility mode .
99
99
static final boolean useCompatibilityMode = Utilities .getBooleanProperty (
100
100
"jdk.tls.client.useCompatibilityMode" , true );
101
101
Original file line number Diff line number Diff line change 1
1
/*
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.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
26
26
27
27
/*
28
28
* @test
29
- * @bug 8211806
29
+ * @bug 8211806 8277881
30
30
* @summary TLS 1.3 handshake server name indication is missing on a session resume
31
31
* @run main/othervm ResumeTLS13withSNI
32
32
*/
@@ -338,6 +338,9 @@ private static void checkResumedClientHelloSNI(ByteBuffer resCliHello)
338
338
339
339
// Get the legacy session length and skip that many bytes
340
340
int sessIdLen = Byte .toUnsignedInt (resCliHello .get ());
341
+ if (sessIdLen == 0 ) {
342
+ throw new Exception ("SessionID field empty" );
343
+ }
341
344
resCliHello .position (resCliHello .position () + sessIdLen );
342
345
343
346
// Skip over all the cipher suites
You can’t perform that action at this time.
0 commit comments