author | apetcher |
Tue, 28 Aug 2018 14:46:44 -0400 | |
branch | JDK-8171279-XDH-TLS-branch-2 |
changeset 56871 | bda6e40cd2f4 |
parent 56864 | ec60669bc501 |
child 56878 | 55bac0266042 |
permissions | -rw-r--r-- |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1 |
/* |
50768 | 2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
4 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
10 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
15 |
* accompanied this code). |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
16 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
20 |
* |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
23 |
* questions. |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
24 |
*/ |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
25 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
26 |
package sun.security.ssl; |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
27 |
|
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
28 |
import java.io.IOException; |
50768 | 29 |
import java.nio.ByteBuffer; |
30 |
import java.security.AccessController; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
31 |
import java.security.AlgorithmConstraints; |
50768 | 32 |
import java.security.AlgorithmParameters; |
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
33 |
import java.security.CryptoPrimitive; |
56858 | 34 |
import java.security.GeneralSecurityException; |
50768 | 35 |
import java.security.NoSuchAlgorithmException; |
56858 | 36 |
import java.security.SecureRandom; |
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
37 |
import java.security.spec.AlgorithmParameterSpec; |
50768 | 38 |
import java.security.spec.ECGenParameterSpec; |
39 |
import java.security.spec.ECParameterSpec; |
|
40 |
import java.security.spec.InvalidParameterSpecException; |
|
56858 | 41 |
import java.security.spec.NamedParameterSpec; |
50768 | 42 |
import java.text.MessageFormat; |
43 |
import java.util.ArrayList; |
|
44 |
import java.util.Collections; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
45 |
import java.util.EnumSet; |
56862 | 46 |
import java.util.concurrent.ConcurrentHashMap; |
50768 | 47 |
import java.util.LinkedList; |
48 |
import java.util.List; |
|
49 |
import java.util.Locale; |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
50 |
import java.util.Map; |
56858 | 51 |
import java.util.Optional; |
50768 | 52 |
import javax.crypto.spec.DHParameterSpec; |
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
53 |
import javax.net.ssl.SSLProtocolException; |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
54 |
import sun.security.action.GetPropertyAction; |
50768 | 55 |
import static sun.security.ssl.SSLExtension.CH_SUPPORTED_GROUPS; |
56 |
import static sun.security.ssl.SSLExtension.EE_SUPPORTED_GROUPS; |
|
57 |
import sun.security.ssl.SSLExtension.ExtensionConsumer; |
|
58 |
import sun.security.ssl.SSLExtension.SSLExtensionSpec; |
|
59 |
import sun.security.ssl.SSLHandshake.HandshakeMessage; |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
60 |
|
50768 | 61 |
/** |
62 |
* Pack of the "supported_groups" extensions [RFC 4492/7919]. |
|
63 |
*/ |
|
64 |
final class SupportedGroupsExtension { |
|
65 |
static final HandshakeProducer chNetworkProducer = |
|
66 |
new CHSupportedGroupsProducer(); |
|
67 |
static final ExtensionConsumer chOnLoadConsumer = |
|
68 |
new CHSupportedGroupsConsumer(); |
|
69 |
static final SSLStringizer sgsStringizer = |
|
70 |
new SupportedGroupsStringizer(); |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
71 |
|
50768 | 72 |
static final HandshakeProducer eeNetworkProducer = |
73 |
new EESupportedGroupsProducer(); |
|
74 |
static final ExtensionConsumer eeOnLoadConsumer = |
|
75 |
new EESupportedGroupsConsumer(); |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
76 |
|
50768 | 77 |
/** |
78 |
* The "supported_groups" extension. |
|
79 |
*/ |
|
80 |
static final class SupportedGroupsSpec implements SSLExtensionSpec { |
|
81 |
final int[] namedGroupsIds; |
|
82 |
||
83 |
private SupportedGroupsSpec(int[] namedGroupsIds) { |
|
84 |
this.namedGroupsIds = namedGroupsIds; |
|
85 |
} |
|
86 |
||
87 |
private SupportedGroupsSpec(List<NamedGroup> namedGroups) { |
|
88 |
this.namedGroupsIds = new int[namedGroups.size()]; |
|
89 |
int i = 0; |
|
90 |
for (NamedGroup ng : namedGroups) { |
|
91 |
namedGroupsIds[i++] = ng.id; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
92 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
93 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
94 |
|
50768 | 95 |
private SupportedGroupsSpec(ByteBuffer m) throws IOException { |
96 |
if (m.remaining() < 2) { // 2: the length of the list |
|
97 |
throw new SSLProtocolException( |
|
98 |
"Invalid supported_groups extension: insufficient data"); |
|
99 |
} |
|
100 |
||
101 |
byte[] ngs = Record.getBytes16(m); |
|
102 |
if (m.hasRemaining()) { |
|
103 |
throw new SSLProtocolException( |
|
104 |
"Invalid supported_groups extension: unknown extra data"); |
|
105 |
} |
|
106 |
||
107 |
if ((ngs == null) || (ngs.length == 0) || (ngs.length % 2 != 0)) { |
|
108 |
throw new SSLProtocolException( |
|
109 |
"Invalid supported_groups extension: incomplete data"); |
|
110 |
} |
|
111 |
||
112 |
int[] ids = new int[ngs.length / 2]; |
|
113 |
for (int i = 0, j = 0; i < ngs.length;) { |
|
114 |
ids[j++] = ((ngs[i++] & 0xFF) << 8) | (ngs[i++] & 0xFF); |
|
115 |
} |
|
116 |
||
117 |
this.namedGroupsIds = ids; |
|
118 |
} |
|
119 |
||
120 |
@Override |
|
121 |
public String toString() { |
|
122 |
MessageFormat messageFormat = new MessageFormat( |
|
123 |
"\"versions\": '['{0}']'", Locale.ENGLISH); |
|
124 |
||
125 |
if (namedGroupsIds == null || namedGroupsIds.length == 0) { |
|
126 |
Object[] messageFields = { |
|
127 |
"<no supported named group specified>" |
|
128 |
}; |
|
129 |
return messageFormat.format(messageFields); |
|
130 |
} else { |
|
131 |
StringBuilder builder = new StringBuilder(512); |
|
132 |
boolean isFirst = true; |
|
133 |
for (int ngid : namedGroupsIds) { |
|
134 |
if (isFirst) { |
|
135 |
isFirst = false; |
|
136 |
} else { |
|
137 |
builder.append(", "); |
|
138 |
} |
|
139 |
||
140 |
builder.append(NamedGroup.nameOf(ngid)); |
|
141 |
} |
|
142 |
||
143 |
Object[] messageFields = { |
|
144 |
builder.toString() |
|
145 |
}; |
|
146 |
||
147 |
return messageFormat.format(messageFields); |
|
148 |
} |
|
149 |
} |
|
150 |
} |
|
151 |
||
152 |
private static final |
|
153 |
class SupportedGroupsStringizer implements SSLStringizer { |
|
154 |
@Override |
|
155 |
public String toString(ByteBuffer buffer) { |
|
156 |
try { |
|
157 |
return (new SupportedGroupsSpec(buffer)).toString(); |
|
158 |
} catch (IOException ioe) { |
|
159 |
// For debug logging only, so please swallow exceptions. |
|
160 |
return ioe.getMessage(); |
|
161 |
} |
|
162 |
} |
|
163 |
} |
|
164 |
||
56862 | 165 |
enum NamedGroupType { |
50768 | 166 |
NAMED_GROUP_ECDHE, // Elliptic Curve Groups (ECDHE) |
167 |
NAMED_GROUP_FFDHE, // Finite Field Groups (DHE) |
|
168 |
NAMED_GROUP_XDH, // Finite Field Groups (XDH) |
|
169 |
NAMED_GROUP_ARBITRARY, // arbitrary prime and curves (ECDHE) |
|
170 |
NAMED_GROUP_NONE; // Not predefined named group |
|
171 |
||
172 |
boolean isSupported(List<CipherSuite> cipherSuites) { |
|
173 |
for (CipherSuite cs : cipherSuites) { |
|
174 |
if (cs.keyExchange == null || cs.keyExchange.groupType == this) { |
|
175 |
return true; |
|
176 |
} |
|
177 |
} |
|
178 |
||
179 |
return false; |
|
180 |
} |
|
181 |
} |
|
182 |
||
56862 | 183 |
public static abstract class NamedGroupFunctions { |
56858 | 184 |
|
56862 | 185 |
// cache to speed up the parameters construction |
186 |
protected static final Map<NamedGroup, AlgorithmParameters> |
|
187 |
namedGroupParams = new ConcurrentHashMap<>(); |
|
56858 | 188 |
|
189 |
private final NamedGroup ng; |
|
190 |
||
56862 | 191 |
protected NamedGroupFunctions(NamedGroup ng) { |
192 |
this.ng = ng; |
|
193 |
} |
|
194 |
||
195 |
public AlgorithmParameters getParameters() { |
|
56864 | 196 |
|
56862 | 197 |
AlgorithmParameters result = namedGroupParams.get(ng); |
198 |
if (result == null) { |
|
199 |
Optional<AlgorithmParameters> paramsOpt = getParametersImpl(); |
|
200 |
if (paramsOpt.isPresent()) { |
|
201 |
result = paramsOpt.get(); |
|
202 |
namedGroupParams.put(ng, result); |
|
203 |
} |
|
204 |
} |
|
56864 | 205 |
|
56862 | 206 |
return result; |
207 |
} |
|
208 |
||
209 |
public NamedGroup getNamedGroup() { |
|
210 |
return ng; |
|
211 |
} |
|
212 |
||
213 |
public abstract SSLKeyAgreementCredentials decodeCredentials(byte[] encoded) |
|
214 |
throws IOException, GeneralSecurityException; |
|
215 |
||
216 |
public abstract SSLPossession createPossession(SecureRandom random); |
|
217 |
||
218 |
public abstract SSLKeyDerivation createKeyDerivation(HandshakeContext hc) |
|
219 |
throws IOException; |
|
220 |
||
221 |
protected abstract Optional<AlgorithmParameters> getParametersImpl(); |
|
222 |
public abstract AlgorithmParameterSpec getParameterSpec(); |
|
223 |
||
224 |
public abstract boolean isAvailable(); |
|
225 |
} |
|
226 |
||
227 |
private static class FFDHFunctions extends NamedGroupFunctions { |
|
228 |
||
229 |
||
56858 | 230 |
FFDHFunctions(NamedGroup ng) { |
56862 | 231 |
super(ng); |
56858 | 232 |
} |
233 |
||
234 |
@Override |
|
235 |
public SSLKeyAgreementCredentials decodeCredentials(byte[] encoded) |
|
236 |
throws IOException, GeneralSecurityException { |
|
56862 | 237 |
return DHKeyExchange.DHECredentials.valueOf(getNamedGroup(), encoded); |
56858 | 238 |
} |
239 |
||
240 |
@Override |
|
241 |
public SSLPossession createPossession(SecureRandom random) { |
|
56862 | 242 |
return new DHKeyExchange.DHEPossession(getNamedGroup(), random); |
56858 | 243 |
} |
244 |
||
245 |
@Override |
|
246 |
public SSLKeyDerivation createKeyDerivation(HandshakeContext hc) |
|
247 |
throws IOException { |
|
248 |
return DHKeyExchange.kaGenerator.createKeyDerivation(hc); |
|
249 |
} |
|
250 |
||
251 |
@Override |
|
252 |
public AlgorithmParameterSpec getParameterSpec() { |
|
56862 | 253 |
return getDHParameterSpec(); |
56858 | 254 |
} |
255 |
||
56862 | 256 |
DHParameterSpec getDHParameterSpec() { |
56858 | 257 |
|
56862 | 258 |
AlgorithmParameters params = getParameters(); |
56858 | 259 |
try { |
260 |
return params.getParameterSpec(DHParameterSpec.class); |
|
261 |
} catch (InvalidParameterSpecException ipse) { |
|
262 |
// should be unlikely |
|
56862 | 263 |
return getPredefinedDHParameterSpec(getNamedGroup()); |
56858 | 264 |
} |
265 |
} |
|
266 |
||
267 |
private static DHParameterSpec getFFDHEDHParameterSpec( |
|
56861 | 268 |
NamedGroup namedGroup) { |
269 |
||
56858 | 270 |
DHParameterSpec spec = null; |
271 |
switch (namedGroup) { |
|
272 |
case FFDHE_2048: |
|
273 |
spec = PredefinedDHParameterSpecs.ffdheParams.get(2048); |
|
274 |
break; |
|
275 |
case FFDHE_3072: |
|
276 |
spec = PredefinedDHParameterSpecs.ffdheParams.get(3072); |
|
277 |
break; |
|
278 |
case FFDHE_4096: |
|
279 |
spec = PredefinedDHParameterSpecs.ffdheParams.get(4096); |
|
280 |
break; |
|
281 |
case FFDHE_6144: |
|
282 |
spec = PredefinedDHParameterSpecs.ffdheParams.get(6144); |
|
283 |
break; |
|
284 |
case FFDHE_8192: |
|
285 |
spec = PredefinedDHParameterSpecs.ffdheParams.get(8192); |
|
286 |
} |
|
287 |
||
288 |
return spec; |
|
289 |
} |
|
290 |
||
291 |
private static DHParameterSpec getPredefinedDHParameterSpec( |
|
56861 | 292 |
NamedGroup namedGroup) { |
293 |
||
56858 | 294 |
DHParameterSpec spec = null; |
295 |
switch (namedGroup) { |
|
296 |
case FFDHE_2048: |
|
297 |
spec = PredefinedDHParameterSpecs.definedParams.get(2048); |
|
298 |
break; |
|
299 |
case FFDHE_3072: |
|
300 |
spec = PredefinedDHParameterSpecs.definedParams.get(3072); |
|
301 |
break; |
|
302 |
case FFDHE_4096: |
|
303 |
spec = PredefinedDHParameterSpecs.definedParams.get(4096); |
|
304 |
break; |
|
305 |
case FFDHE_6144: |
|
306 |
spec = PredefinedDHParameterSpecs.definedParams.get(6144); |
|
307 |
break; |
|
308 |
case FFDHE_8192: |
|
309 |
spec = PredefinedDHParameterSpecs.definedParams.get(8192); |
|
310 |
} |
|
311 |
||
312 |
return spec; |
|
313 |
} |
|
314 |
||
315 |
@Override |
|
316 |
public boolean isAvailable() { |
|
317 |
||
56864 | 318 |
AlgorithmParameters params = getParameters(); |
319 |
return params != null; |
|
56858 | 320 |
} |
56862 | 321 |
|
322 |
@Override |
|
323 |
protected Optional<AlgorithmParameters> getParametersImpl() { |
|
324 |
try { |
|
56864 | 325 |
AlgorithmParameters params = JsseJce.getAlgorithmParameters("DiffieHellman"); |
326 |
AlgorithmParameterSpec spec = getFFDHEDHParameterSpec(getNamedGroup()); |
|
327 |
params.init(spec); |
|
328 |
return Optional.of(params); |
|
329 |
} catch(InvalidParameterSpecException | NoSuchAlgorithmException ex) { |
|
56862 | 330 |
return Optional.empty(); |
331 |
} |
|
332 |
} |
|
333 |
||
56858 | 334 |
} |
335 |
||
56862 | 336 |
private static class ECDHFunctions extends NamedGroupFunctions { |
56858 | 337 |
|
338 |
ECDHFunctions(NamedGroup ng) { |
|
56862 | 339 |
super(ng); |
56858 | 340 |
} |
341 |
||
342 |
@Override |
|
343 |
public SSLKeyAgreementCredentials decodeCredentials(byte[] encoded) |
|
344 |
throws IOException, GeneralSecurityException { |
|
56862 | 345 |
return ECDHKeyExchange.ECDHECredentials.valueOf(getNamedGroup(), encoded); |
56858 | 346 |
} |
347 |
||
348 |
@Override |
|
349 |
public SSLPossession createPossession(SecureRandom random) { |
|
56862 | 350 |
return new ECDHKeyExchange.ECDHEPossession(getNamedGroup(), random); |
56858 | 351 |
} |
352 |
||
353 |
@Override |
|
354 |
public SSLKeyDerivation createKeyDerivation(HandshakeContext hc) |
|
355 |
throws IOException { |
|
356 |
return ECDHKeyExchange.ecdheKAGenerator.createKeyDerivation(hc); |
|
357 |
} |
|
358 |
||
359 |
@Override |
|
360 |
public AlgorithmParameterSpec getParameterSpec() { |
|
56862 | 361 |
return SupportedGroups.getECGenParamSpec(getNamedGroup()); |
56858 | 362 |
} |
363 |
||
364 |
@Override |
|
365 |
public boolean isAvailable() { |
|
366 |
||
56864 | 367 |
AlgorithmParameters params = getParameters(); |
368 |
return params != null; |
|
56858 | 369 |
} |
56862 | 370 |
|
371 |
@Override |
|
372 |
protected Optional<AlgorithmParameters> getParametersImpl() { |
|
373 |
try { |
|
56864 | 374 |
AlgorithmParameters params = JsseJce.getAlgorithmParameters("EC"); |
375 |
AlgorithmParameterSpec spec = new ECGenParameterSpec(getNamedGroup().oid); |
|
376 |
params.init(spec); |
|
377 |
return Optional.of(params); |
|
378 |
} catch(InvalidParameterSpecException | NoSuchAlgorithmException ex) { |
|
56862 | 379 |
return Optional.empty(); |
380 |
} |
|
381 |
} |
|
56858 | 382 |
} |
383 |
||
56862 | 384 |
private static class XDHFunctions extends NamedGroupFunctions { |
56858 | 385 |
|
386 |
XDHFunctions(NamedGroup ng) { |
|
56862 | 387 |
super(ng); |
56858 | 388 |
} |
389 |
||
390 |
@Override |
|
391 |
public SSLKeyAgreementCredentials decodeCredentials(byte[] encoded) |
|
392 |
throws IOException, GeneralSecurityException { |
|
56862 | 393 |
return XDHKeyExchange.XDHECredentials.valueOf(getNamedGroup(), encoded); |
56858 | 394 |
} |
395 |
||
396 |
@Override |
|
397 |
public SSLPossession createPossession(SecureRandom random) { |
|
56862 | 398 |
return new XDHKeyExchange.XDHEPossession(getNamedGroup(), random); |
56858 | 399 |
} |
400 |
||
401 |
@Override |
|
402 |
public SSLKeyDerivation createKeyDerivation(HandshakeContext hc) |
|
403 |
throws IOException { |
|
404 |
return XDHKeyExchange.xdheKAGenerator.createKeyDerivation(hc); |
|
405 |
} |
|
406 |
||
407 |
@Override |
|
408 |
public AlgorithmParameterSpec getParameterSpec() { |
|
56862 | 409 |
return new NamedParameterSpec(getNamedGroup().algorithm); |
56858 | 410 |
} |
411 |
||
412 |
@Override |
|
413 |
public boolean isAvailable() { |
|
414 |
||
415 |
try { |
|
56862 | 416 |
JsseJce.getKeyAgreement(getNamedGroup().algorithm); |
56858 | 417 |
return true; |
418 |
} catch (NoSuchAlgorithmException ex) { |
|
419 |
return false; |
|
420 |
} |
|
421 |
} |
|
56862 | 422 |
|
423 |
@Override |
|
424 |
protected Optional<AlgorithmParameters> getParametersImpl() { |
|
425 |
return Optional.empty(); |
|
426 |
} |
|
56858 | 427 |
} |
428 |
||
50768 | 429 |
static enum NamedGroup { |
430 |
// Elliptic Curves (RFC 4492) |
|
431 |
// |
|
432 |
// See sun.security.util.CurveDB for the OIDs |
|
433 |
// NIST K-163 |
|
434 |
SECT163_K1 (0x0001, "sect163k1", "1.3.132.0.1", true, |
|
435 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
436 |
SECT163_R1 (0x0002, "sect163r1", "1.3.132.0.2", false, |
|
437 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
438 |
||
439 |
// NIST B-163 |
|
440 |
SECT163_R2 (0x0003, "sect163r2", "1.3.132.0.15", true, |
|
441 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
442 |
SECT193_R1 (0x0004, "sect193r1", "1.3.132.0.24", false, |
|
443 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
444 |
SECT193_R2 (0x0005, "sect193r2", "1.3.132.0.25", false, |
|
445 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
446 |
||
447 |
// NIST K-233 |
|
448 |
SECT233_K1 (0x0006, "sect233k1", "1.3.132.0.26", true, |
|
449 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
450 |
||
451 |
// NIST B-233 |
|
452 |
SECT233_R1 (0x0007, "sect233r1", "1.3.132.0.27", true, |
|
453 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
454 |
SECT239_K1 (0x0008, "sect239k1", "1.3.132.0.3", false, |
|
455 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
456 |
||
457 |
// NIST K-283 |
|
458 |
SECT283_K1 (0x0009, "sect283k1", "1.3.132.0.16", true, |
|
459 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
460 |
||
461 |
// NIST B-283 |
|
462 |
SECT283_R1 (0x000A, "sect283r1", "1.3.132.0.17", true, |
|
463 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
464 |
||
465 |
// NIST K-409 |
|
466 |
SECT409_K1 (0x000B, "sect409k1", "1.3.132.0.36", true, |
|
467 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
468 |
||
469 |
// NIST B-409 |
|
470 |
SECT409_R1 (0x000C, "sect409r1", "1.3.132.0.37", true, |
|
471 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
472 |
||
473 |
// NIST K-571 |
|
474 |
SECT571_K1 (0x000D, "sect571k1", "1.3.132.0.38", true, |
|
475 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
476 |
||
477 |
// NIST B-571 |
|
478 |
SECT571_R1 (0x000E, "sect571r1", "1.3.132.0.39", true, |
|
479 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
480 |
SECP160_K1 (0x000F, "secp160k1", "1.3.132.0.9", false, |
|
481 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
482 |
SECP160_R1 (0x0010, "secp160r1", "1.3.132.0.8", false, |
|
483 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
484 |
SECP160_R2 (0x0011, "secp160r2", "1.3.132.0.30", false, |
|
485 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
486 |
SECP192_K1 (0x0012, "secp192k1", "1.3.132.0.31", false, |
|
487 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
488 |
||
489 |
// NIST P-192 |
|
490 |
SECP192_R1 (0x0013, "secp192r1", "1.2.840.10045.3.1.1", true, |
|
491 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
492 |
SECP224_K1 (0x0014, "secp224k1", "1.3.132.0.32", false, |
|
493 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
494 |
// NIST P-224 |
|
495 |
SECP224_R1 (0x0015, "secp224r1", "1.3.132.0.33", true, |
|
496 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
497 |
SECP256_K1 (0x0016, "secp256k1", "1.3.132.0.10", false, |
|
498 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
499 |
||
500 |
// NIST P-256 |
|
501 |
SECP256_R1 (0x0017, "secp256r1", "1.2.840.10045.3.1.7", true, |
|
502 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
503 |
||
504 |
// NIST P-384 |
|
505 |
SECP384_R1 (0x0018, "secp384r1", "1.3.132.0.34", true, |
|
506 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
507 |
||
508 |
// NIST P-521 |
|
509 |
SECP521_R1 (0x0019, "secp521r1", "1.3.132.0.35", true, |
|
510 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
511 |
||
512 |
// x25519 and x448 |
|
513 |
X25519 (0x001D, "x25519", true, "x25519", |
|
514 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
515 |
X448 (0x001E, "x448", true, "x448", |
|
516 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
517 |
||
518 |
// Finite Field Diffie-Hellman Ephemeral Parameters (RFC 7919) |
|
519 |
FFDHE_2048 (0x0100, "ffdhe2048", true, |
|
520 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
521 |
FFDHE_3072 (0x0101, "ffdhe3072", true, |
|
522 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
523 |
FFDHE_4096 (0x0102, "ffdhe4096", true, |
|
524 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
525 |
FFDHE_6144 (0x0103, "ffdhe6144", true, |
|
526 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
527 |
FFDHE_8192 (0x0104, "ffdhe8192", true, |
|
528 |
ProtocolVersion.PROTOCOLS_TO_13), |
|
529 |
||
530 |
// Elliptic Curves (RFC 4492) |
|
531 |
// |
|
532 |
// arbitrary prime and characteristic-2 curves |
|
533 |
ARBITRARY_PRIME (0xFF01, "arbitrary_explicit_prime_curves", |
|
534 |
ProtocolVersion.PROTOCOLS_TO_12), |
|
535 |
ARBITRARY_CHAR2 (0xFF02, "arbitrary_explicit_char2_curves", |
|
536 |
ProtocolVersion.PROTOCOLS_TO_12); |
|
537 |
||
538 |
final int id; // hash + signature |
|
539 |
final NamedGroupType type; // group type |
|
540 |
final String name; // literal name |
|
541 |
final String oid; // object identifier of the named group |
|
542 |
final String algorithm; // signature algorithm |
|
543 |
final boolean isFips; // can be used in FIPS mode? |
|
544 |
final ProtocolVersion[] supportedProtocols; |
|
56858 | 545 |
private final NamedGroupFunctions functions; // may be null |
50768 | 546 |
|
547 |
// Constructor used for Elliptic Curve Groups (ECDHE) |
|
548 |
private NamedGroup(int id, String name, String oid, boolean isFips, |
|
549 |
ProtocolVersion[] supportedProtocols) { |
|
550 |
this.id = id; |
|
551 |
this.type = NamedGroupType.NAMED_GROUP_ECDHE; |
|
56858 | 552 |
this.functions = new ECDHFunctions(this); |
50768 | 553 |
this.name = name; |
554 |
this.oid = oid; |
|
555 |
this.algorithm = "EC"; |
|
556 |
this.isFips = isFips; |
|
557 |
this.supportedProtocols = supportedProtocols; |
|
558 |
} |
|
559 |
||
560 |
// Constructor used for Elliptic Curve Groups (XDH) |
|
561 |
private NamedGroup(int id, String name, |
|
562 |
boolean isFips, String algorithm, |
|
563 |
ProtocolVersion[] supportedProtocols) { |
|
564 |
this.id = id; |
|
565 |
this.type = NamedGroupType.NAMED_GROUP_XDH; |
|
56858 | 566 |
this.functions = new XDHFunctions(this); |
50768 | 567 |
this.name = name; |
568 |
this.oid = null; |
|
569 |
this.algorithm = algorithm; |
|
570 |
this.isFips = isFips; |
|
571 |
this.supportedProtocols = supportedProtocols; |
|
572 |
} |
|
573 |
||
574 |
// Constructor used for Finite Field Diffie-Hellman Groups (FFDHE) |
|
575 |
private NamedGroup(int id, String name, boolean isFips, |
|
576 |
ProtocolVersion[] supportedProtocols) { |
|
577 |
this.id = id; |
|
578 |
this.type = NamedGroupType.NAMED_GROUP_FFDHE; |
|
56858 | 579 |
this.functions = new FFDHFunctions(this); |
50768 | 580 |
this.name = name; |
581 |
this.oid = null; |
|
582 |
this.algorithm = "DiffieHellman"; |
|
583 |
this.isFips = isFips; |
|
584 |
this.supportedProtocols = supportedProtocols; |
|
585 |
} |
|
586 |
||
587 |
// Constructor used for arbitrary prime and curves (ECDHE) |
|
588 |
private NamedGroup(int id, String name, |
|
589 |
ProtocolVersion[] supportedProtocols) { |
|
590 |
this.id = id; |
|
591 |
this.type = NamedGroupType.NAMED_GROUP_ARBITRARY; |
|
56858 | 592 |
this.functions = null; |
50768 | 593 |
this.name = name; |
594 |
this.oid = null; |
|
595 |
this.algorithm = "EC"; |
|
596 |
this.isFips = false; |
|
597 |
this.supportedProtocols = supportedProtocols; |
|
598 |
} |
|
599 |
||
56858 | 600 |
Optional<NamedGroupFunctions> getFunctions() { |
601 |
return Optional.ofNullable(functions); |
|
602 |
} |
|
603 |
||
50768 | 604 |
static NamedGroup valueOf(int id) { |
605 |
for (NamedGroup group : NamedGroup.values()) { |
|
606 |
if (group.id == id) { |
|
607 |
return group; |
|
608 |
} |
|
609 |
} |
|
610 |
||
611 |
return null; |
|
612 |
} |
|
613 |
||
614 |
static NamedGroup valueOf(ECParameterSpec params) { |
|
615 |
String oid = JsseJce.getNamedCurveOid(params); |
|
616 |
if ((oid != null) && (!oid.isEmpty())) { |
|
617 |
for (NamedGroup group : NamedGroup.values()) { |
|
618 |
if ((group.type == NamedGroupType.NAMED_GROUP_ECDHE) && |
|
619 |
oid.equals(group.oid)) { |
|
620 |
return group; |
|
621 |
} |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
622 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
623 |
} |
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
624 |
|
50768 | 625 |
return null; |
626 |
} |
|
627 |
||
628 |
static NamedGroup valueOf(DHParameterSpec params) { |
|
56862 | 629 |
for (NamedGroup ng : NamedGroup.values()) { |
50768 | 630 |
if (ng.type != NamedGroupType.NAMED_GROUP_FFDHE) { |
631 |
continue; |
|
632 |
} |
|
633 |
||
634 |
DHParameterSpec ngParams = null; |
|
56862 | 635 |
// functions is non-null for FFDHE type |
636 |
AlgorithmParameters aps = ng.functions.getParameters(); |
|
50768 | 637 |
try { |
638 |
ngParams = aps.getParameterSpec(DHParameterSpec.class); |
|
639 |
} catch (InvalidParameterSpecException ipse) { |
|
640 |
// should be unlikely |
|
641 |
} |
|
642 |
||
643 |
if (ngParams == null) { |
|
644 |
continue; |
|
645 |
} |
|
646 |
||
647 |
if (ngParams.getP().equals(params.getP()) && |
|
648 |
ngParams.getG().equals(params.getG())) { |
|
649 |
return ng; |
|
650 |
} |
|
43693
e340c8d10cbb
8173783: IllegalArgumentException: jdk.tls.namedGroups
coffeys
parents:
41473
diff
changeset
|
651 |
} |
50768 | 652 |
|
653 |
return null; |
|
654 |
} |
|
655 |
||
656 |
static NamedGroup nameOf(String name) { |
|
657 |
for (NamedGroup group : NamedGroup.values()) { |
|
658 |
if (group.name.equals(name)) { |
|
659 |
return group; |
|
660 |
} |
|
661 |
} |
|
662 |
||
663 |
return null; |
|
664 |
} |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
665 |
|
50768 | 666 |
static String nameOf(int id) { |
667 |
for (NamedGroup group : NamedGroup.values()) { |
|
668 |
if (group.id == id) { |
|
669 |
return group.name; |
|
670 |
} |
|
671 |
} |
|
672 |
||
673 |
return "UNDEFINED-NAMED-GROUP(" + id + ")"; |
|
674 |
} |
|
675 |
||
676 |
boolean isAvailable(List<ProtocolVersion> protocolVersions) { |
|
677 |
for (ProtocolVersion pv : supportedProtocols) { |
|
678 |
if (protocolVersions.contains(pv)) { |
|
679 |
return true; |
|
680 |
} |
|
681 |
} |
|
682 |
return false; |
|
683 |
} |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
684 |
|
50768 | 685 |
boolean isAvailable(ProtocolVersion protocolVersion) { |
686 |
for (ProtocolVersion pv : supportedProtocols) { |
|
687 |
if (protocolVersion == pv) { |
|
688 |
return true; |
|
689 |
} |
|
690 |
} |
|
691 |
return false; |
|
692 |
} |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
693 |
|
50768 | 694 |
boolean isSupported(List<CipherSuite> cipherSuites) { |
695 |
for (CipherSuite cs : cipherSuites) { |
|
696 |
boolean isMatch = isAvailable(cs.supportedProtocols); |
|
697 |
if (isMatch && (cs.keyExchange == null || |
|
698 |
cs.keyExchange.groupType == type)) { |
|
699 |
return true; |
|
700 |
} |
|
701 |
} |
|
702 |
return false; |
|
703 |
} |
|
704 |
||
705 |
// lazy loading of parameters |
|
706 |
AlgorithmParameters getParameters() { |
|
56862 | 707 |
if (functions == null) { |
708 |
return null; |
|
709 |
} |
|
710 |
return functions.getParameters(); |
|
50768 | 711 |
} |
712 |
||
713 |
AlgorithmParameterSpec getParameterSpec() { |
|
56858 | 714 |
Optional<NamedGroupFunctions> ngf = getFunctions(); |
715 |
if (ngf.isEmpty()) { |
|
716 |
return null; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
717 |
} |
56858 | 718 |
return ngf.get().getParameterSpec(); |
50768 | 719 |
} |
720 |
} |
|
721 |
||
722 |
static class SupportedGroups { |
|
723 |
// To switch off the supported_groups extension for DHE cipher suite. |
|
724 |
static final boolean enableFFDHE = |
|
725 |
Utilities.getBooleanProperty("jsse.enableFFDHE", true); |
|
726 |
||
727 |
// the supported named groups |
|
728 |
static final NamedGroup[] supportedNamedGroups; |
|
729 |
||
730 |
static { |
|
731 |
boolean requireFips = SunJSSE.isFIPS(); |
|
732 |
||
733 |
// The value of the System Property defines a list of enabled named |
|
734 |
// groups in preference order, separated with comma. For example: |
|
735 |
// |
|
736 |
// jdk.tls.namedGroups="secp521r1, secp256r1, ffdhe2048" |
|
737 |
// |
|
738 |
// If the System Property is not defined or the value is empty, the |
|
739 |
// default groups and preferences will be used. |
|
51398
3c389a284345
8209416: Refactoring GetPropertyAction calls in security libs
weijun
parents:
50768
diff
changeset
|
740 |
String property = GetPropertyAction |
3c389a284345
8209416: Refactoring GetPropertyAction calls in security libs
weijun
parents:
50768
diff
changeset
|
741 |
.privilegedGetProperty("jdk.tls.namedGroups"); |
50768 | 742 |
if (property != null && property.length() != 0) { |
743 |
// remove double quote marks from beginning/end of the property |
|
744 |
if (property.length() > 1 && property.charAt(0) == '"' && |
|
745 |
property.charAt(property.length() - 1) == '"') { |
|
746 |
property = property.substring(1, property.length() - 1); |
|
747 |
} |
|
748 |
} |
|
749 |
||
750 |
ArrayList<NamedGroup> groupList; |
|
751 |
if (property != null && property.length() != 0) { |
|
752 |
String[] groups = property.split(","); |
|
753 |
groupList = new ArrayList<>(groups.length); |
|
754 |
for (String group : groups) { |
|
755 |
group = group.trim(); |
|
756 |
if (!group.isEmpty()) { |
|
757 |
NamedGroup namedGroup = NamedGroup.nameOf(group); |
|
758 |
if (namedGroup != null && |
|
759 |
(!requireFips || namedGroup.isFips)) { |
|
760 |
if (isAvailableGroup(namedGroup)) { |
|
761 |
groupList.add(namedGroup); |
|
762 |
} |
|
763 |
} // ignore unknown groups |
|
764 |
} |
|
765 |
} |
|
766 |
||
767 |
if (groupList.isEmpty()) { |
|
768 |
throw new IllegalArgumentException( |
|
769 |
"System property jdk.tls.namedGroups(" + |
|
770 |
property + ") contains no supported named groups"); |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
771 |
} |
50768 | 772 |
} else { // default groups |
773 |
NamedGroup[] groups; |
|
774 |
if (requireFips) { |
|
775 |
groups = new NamedGroup[] { |
|
776 |
// only NIST curves in FIPS mode |
|
777 |
NamedGroup.SECP256_R1, |
|
778 |
NamedGroup.SECP384_R1, |
|
779 |
NamedGroup.SECP521_R1, |
|
780 |
NamedGroup.SECT283_K1, |
|
781 |
NamedGroup.SECT283_R1, |
|
782 |
NamedGroup.SECT409_K1, |
|
783 |
NamedGroup.SECT409_R1, |
|
784 |
NamedGroup.SECT571_K1, |
|
785 |
NamedGroup.SECT571_R1, |
|
786 |
||
787 |
// FFDHE 2048 |
|
788 |
NamedGroup.FFDHE_2048, |
|
789 |
NamedGroup.FFDHE_3072, |
|
790 |
NamedGroup.FFDHE_4096, |
|
791 |
NamedGroup.FFDHE_6144, |
|
792 |
NamedGroup.FFDHE_8192, |
|
793 |
}; |
|
794 |
} else { |
|
795 |
groups = new NamedGroup[] { |
|
796 |
// NIST curves first |
|
797 |
NamedGroup.SECP256_R1, |
|
798 |
NamedGroup.SECP384_R1, |
|
799 |
NamedGroup.SECP521_R1, |
|
800 |
NamedGroup.SECT283_K1, |
|
801 |
NamedGroup.SECT283_R1, |
|
802 |
NamedGroup.SECT409_K1, |
|
803 |
NamedGroup.SECT409_R1, |
|
804 |
NamedGroup.SECT571_K1, |
|
805 |
NamedGroup.SECT571_R1, |
|
806 |
||
807 |
// non-NIST curves |
|
808 |
NamedGroup.SECP256_K1, |
|
809 |
||
56858 | 810 |
// XDH |
811 |
NamedGroup.X25519, |
|
812 |
NamedGroup.X448, |
|
813 |
||
50768 | 814 |
// FFDHE 2048 |
815 |
NamedGroup.FFDHE_2048, |
|
816 |
NamedGroup.FFDHE_3072, |
|
817 |
NamedGroup.FFDHE_4096, |
|
818 |
NamedGroup.FFDHE_6144, |
|
819 |
NamedGroup.FFDHE_8192, |
|
820 |
}; |
|
821 |
} |
|
822 |
||
823 |
groupList = new ArrayList<>(groups.length); |
|
824 |
for (NamedGroup group : groups) { |
|
825 |
if (isAvailableGroup(group)) { |
|
826 |
groupList.add(group); |
|
827 |
} |
|
828 |
} |
|
829 |
||
830 |
if (groupList.isEmpty() && |
|
831 |
SSLLogger.isOn && SSLLogger.isOn("ssl")) { |
|
832 |
SSLLogger.warning("No default named groups"); |
|
833 |
} |
|
834 |
} |
|
835 |
||
836 |
supportedNamedGroups = new NamedGroup[groupList.size()]; |
|
837 |
int i = 0; |
|
838 |
for (NamedGroup namedGroup : groupList) { |
|
839 |
supportedNamedGroups[i++] = namedGroup; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
840 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
841 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
842 |
|
50768 | 843 |
// check whether the group is supported by the underlying providers |
56871 | 844 |
private static boolean isAvailableGroup(NamedGroup namedGroup) { |
50768 | 845 |
|
56864 | 846 |
Optional<NamedGroupFunctions> ngfOpt = namedGroup.getFunctions(); |
847 |
if (ngfOpt.isEmpty()) { |
|
56858 | 848 |
return false; |
849 |
} |
|
56864 | 850 |
NamedGroupFunctions ngf = ngfOpt.get(); |
851 |
return ngf.isAvailable(); |
|
43693
e340c8d10cbb
8173783: IllegalArgumentException: jdk.tls.namedGroups
coffeys
parents:
41473
diff
changeset
|
852 |
} |
e340c8d10cbb
8173783: IllegalArgumentException: jdk.tls.namedGroups
coffeys
parents:
41473
diff
changeset
|
853 |
|
50768 | 854 |
static ECGenParameterSpec getECGenParamSpec(NamedGroup namedGroup) { |
855 |
if (namedGroup.type != NamedGroupType.NAMED_GROUP_ECDHE) { |
|
856 |
throw new RuntimeException( |
|
857 |
"Not a named EC group: " + namedGroup); |
|
858 |
} |
|
859 |
||
56862 | 860 |
// functions is non-null for ECDHE type |
861 |
AlgorithmParameters params = namedGroup.functions.getParameters(); |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
862 |
try { |
50768 | 863 |
return params.getParameterSpec(ECGenParameterSpec.class); |
864 |
} catch (InvalidParameterSpecException ipse) { |
|
865 |
// should be unlikely |
|
866 |
return new ECGenParameterSpec(namedGroup.oid); |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
867 |
} |
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
868 |
} |
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
869 |
|
56862 | 870 |
static AlgorithmParameters getParameters(NamedGroup ng) { |
871 |
AlgorithmParameters params = null; |
|
872 |
if (ng.functions != null) { |
|
873 |
params = ng.functions.getParameters(); |
|
874 |
} |
|
875 |
return params; |
|
876 |
} |
|
877 |
||
50768 | 878 |
// Is there any supported group permitted by the constraints? |
879 |
static boolean isActivatable( |
|
880 |
AlgorithmConstraints constraints, NamedGroupType type) { |
|
881 |
||
882 |
boolean hasFFDHEGroups = false; |
|
883 |
for (NamedGroup namedGroup : supportedNamedGroups) { |
|
884 |
if (namedGroup.type == type) { |
|
885 |
if (constraints.permits( |
|
886 |
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), |
|
887 |
namedGroup.algorithm, |
|
56862 | 888 |
getParameters(namedGroup))) { |
50768 | 889 |
|
890 |
return true; |
|
891 |
} |
|
892 |
||
893 |
if (!hasFFDHEGroups && |
|
894 |
(type == NamedGroupType.NAMED_GROUP_FFDHE)) { |
|
895 |
hasFFDHEGroups = true; |
|
896 |
} |
|
897 |
} |
|
898 |
} |
|
899 |
||
900 |
// For compatibility, if no FFDHE groups are defined, the non-FFDHE |
|
901 |
// compatible mode (using DHE cipher suite without FFDHE extension) |
|
902 |
// is allowed. |
|
903 |
// |
|
904 |
// Note that the constraints checking on DHE parameters will be |
|
905 |
// performed during key exchanging in a handshake. |
|
906 |
return !hasFFDHEGroups && type == NamedGroupType.NAMED_GROUP_FFDHE; |
|
907 |
} |
|
908 |
||
909 |
// Is the named group permitted by the constraints? |
|
910 |
static boolean isActivatable( |
|
911 |
AlgorithmConstraints constraints, NamedGroup namedGroup) { |
|
912 |
if (!isSupported(namedGroup)) { |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
913 |
return false; |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
914 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
915 |
|
50768 | 916 |
return constraints.permits( |
917 |
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), |
|
918 |
namedGroup.algorithm, |
|
56862 | 919 |
getParameters(namedGroup)); |
50768 | 920 |
} |
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
921 |
|
50768 | 922 |
// Is there any supported group permitted by the constraints? |
923 |
static boolean isSupported(NamedGroup namedGroup) { |
|
924 |
for (NamedGroup group : supportedNamedGroups) { |
|
925 |
if (namedGroup.id == group.id) { |
|
926 |
return true; |
|
927 |
} |
|
928 |
} |
|
929 |
||
930 |
return false; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
931 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
932 |
|
50768 | 933 |
static NamedGroup getPreferredGroup( |
934 |
ProtocolVersion negotiatedProtocol, |
|
935 |
AlgorithmConstraints constraints, NamedGroupType type, |
|
936 |
List<NamedGroup> requestedNamedGroups) { |
|
937 |
for (NamedGroup namedGroup : requestedNamedGroups) { |
|
938 |
if ((namedGroup.type == type) && |
|
939 |
namedGroup.isAvailable(negotiatedProtocol) && |
|
940 |
constraints.permits( |
|
941 |
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), |
|
942 |
namedGroup.algorithm, |
|
56862 | 943 |
getParameters(namedGroup))) { |
50768 | 944 |
return namedGroup; |
945 |
} |
|
946 |
} |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
947 |
|
50768 | 948 |
return null; |
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
949 |
} |
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
950 |
|
50768 | 951 |
static NamedGroup getPreferredGroup( |
952 |
ProtocolVersion negotiatedProtocol, |
|
953 |
AlgorithmConstraints constraints, NamedGroupType type) { |
|
954 |
for (NamedGroup namedGroup : supportedNamedGroups) { |
|
955 |
if ((namedGroup.type == type) && |
|
956 |
namedGroup.isAvailable(negotiatedProtocol) && |
|
957 |
constraints.permits( |
|
958 |
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), |
|
959 |
namedGroup.algorithm, |
|
56862 | 960 |
getParameters(namedGroup))) { |
50768 | 961 |
return namedGroup; |
962 |
} |
|
963 |
} |
|
964 |
||
965 |
return null; |
|
966 |
} |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
967 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
968 |
|
50768 | 969 |
/** |
970 |
* Network data producer of a "supported_groups" extension in |
|
971 |
* the ClientHello handshake message. |
|
972 |
*/ |
|
973 |
private static final class CHSupportedGroupsProducer |
|
974 |
extends SupportedGroups implements HandshakeProducer { |
|
975 |
// Prevent instantiation of this class. |
|
976 |
private CHSupportedGroupsProducer() { |
|
977 |
// blank |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
978 |
} |
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
979 |
|
50768 | 980 |
@Override |
981 |
public byte[] produce(ConnectionContext context, |
|
982 |
HandshakeMessage message) throws IOException { |
|
983 |
// The producing happens in client side only. |
|
984 |
ClientHandshakeContext chc = (ClientHandshakeContext)context; |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
985 |
|
50768 | 986 |
// Is it a supported and enabled extension? |
987 |
if (!chc.sslConfig.isAvailable(CH_SUPPORTED_GROUPS)) { |
|
988 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
989 |
SSLLogger.fine( |
|
990 |
"Ignore unavailable supported_groups extension"); |
|
991 |
} |
|
992 |
return null; |
|
993 |
} |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
994 |
|
50768 | 995 |
// Produce the extension. |
996 |
ArrayList<NamedGroup> namedGroups = |
|
997 |
new ArrayList<>(SupportedGroups.supportedNamedGroups.length); |
|
998 |
for (NamedGroup ng : SupportedGroups.supportedNamedGroups) { |
|
999 |
if ((!SupportedGroups.enableFFDHE) && |
|
1000 |
(ng.type == NamedGroupType.NAMED_GROUP_FFDHE)) { |
|
1001 |
continue; |
|
1002 |
} |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1003 |
|
50768 | 1004 |
if (ng.isAvailable(chc.activeProtocols) && |
1005 |
ng.isSupported(chc.activeCipherSuites) && |
|
1006 |
chc.algorithmConstraints.permits( |
|
1007 |
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), |
|
56862 | 1008 |
ng.algorithm, getParameters(ng))) { |
50768 | 1009 |
namedGroups.add(ng); |
1010 |
} else if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1011 |
SSLLogger.fine( |
|
1012 |
"Ignore inactive or disabled named group: " + ng.name); |
|
1013 |
} |
|
1014 |
} |
|
1015 |
||
1016 |
if (namedGroups.isEmpty()) { |
|
1017 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1018 |
SSLLogger.warning("no available named group"); |
|
1019 |
} |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1020 |
|
50768 | 1021 |
return null; |
1022 |
} |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1023 |
|
50768 | 1024 |
int vectorLen = namedGroups.size() << 1; |
1025 |
byte[] extData = new byte[vectorLen + 2]; |
|
1026 |
ByteBuffer m = ByteBuffer.wrap(extData); |
|
1027 |
Record.putInt16(m, vectorLen); |
|
1028 |
for (NamedGroup namedGroup : namedGroups) { |
|
1029 |
Record.putInt16(m, namedGroup.id); |
|
1030 |
} |
|
1031 |
||
1032 |
// Update the context. |
|
1033 |
chc.clientRequestedNamedGroups = |
|
1034 |
Collections.<NamedGroup>unmodifiableList(namedGroups); |
|
1035 |
chc.handshakeExtensions.put(CH_SUPPORTED_GROUPS, |
|
1036 |
new SupportedGroupsSpec(namedGroups)); |
|
1037 |
||
1038 |
return extData; |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1039 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1040 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1041 |
|
50768 | 1042 |
/** |
1043 |
* Network data producer of a "supported_groups" extension in |
|
1044 |
* the ClientHello handshake message. |
|
1045 |
*/ |
|
1046 |
private static final |
|
1047 |
class CHSupportedGroupsConsumer implements ExtensionConsumer { |
|
1048 |
// Prevent instantiation of this class. |
|
1049 |
private CHSupportedGroupsConsumer() { |
|
1050 |
// blank |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1051 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1052 |
|
50768 | 1053 |
@Override |
1054 |
public void consume(ConnectionContext context, |
|
1055 |
HandshakeMessage message, ByteBuffer buffer) throws IOException { |
|
1056 |
// The consuming happens in server side only. |
|
1057 |
ServerHandshakeContext shc = (ServerHandshakeContext)context; |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1058 |
|
50768 | 1059 |
// Is it a supported and enabled extension? |
1060 |
if (!shc.sslConfig.isAvailable(CH_SUPPORTED_GROUPS)) { |
|
1061 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1062 |
SSLLogger.fine( |
|
1063 |
"Ignore unavailable supported_groups extension"); |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1064 |
} |
50768 | 1065 |
return; // ignore the extension |
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1066 |
} |
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1067 |
|
50768 | 1068 |
// Parse the extension. |
1069 |
SupportedGroupsSpec spec; |
|
1070 |
try { |
|
1071 |
spec = new SupportedGroupsSpec(buffer); |
|
1072 |
} catch (IOException ioe) { |
|
1073 |
shc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe); |
|
1074 |
return; // fatal() always throws, make the compiler happy. |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1075 |
} |
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1076 |
|
50768 | 1077 |
// Update the context. |
1078 |
List<NamedGroup> knownNamedGroups = new LinkedList<>(); |
|
1079 |
for (int id : spec.namedGroupsIds) { |
|
1080 |
NamedGroup ng = NamedGroup.valueOf(id); |
|
1081 |
if (ng != null) { |
|
1082 |
knownNamedGroups.add(ng); |
|
1083 |
} |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1084 |
} |
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1085 |
|
50768 | 1086 |
shc.clientRequestedNamedGroups = knownNamedGroups; |
1087 |
shc.handshakeExtensions.put(CH_SUPPORTED_GROUPS, spec); |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1088 |
|
50768 | 1089 |
// No impact on session resumption. |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1090 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1091 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1092 |
|
50768 | 1093 |
/** |
1094 |
* Network data producer of a "supported_groups" extension in |
|
1095 |
* the EncryptedExtensions handshake message. |
|
1096 |
*/ |
|
1097 |
private static final class EESupportedGroupsProducer |
|
1098 |
extends SupportedGroups implements HandshakeProducer { |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1099 |
|
50768 | 1100 |
// Prevent instantiation of this class. |
1101 |
private EESupportedGroupsProducer() { |
|
1102 |
// blank |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1103 |
} |
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1104 |
|
50768 | 1105 |
@Override |
1106 |
public byte[] produce(ConnectionContext context, |
|
1107 |
HandshakeMessage message) throws IOException { |
|
1108 |
// The producing happens in server side only. |
|
1109 |
ServerHandshakeContext shc = (ServerHandshakeContext)context; |
|
1110 |
||
1111 |
// Is it a supported and enabled extension? |
|
1112 |
if (!shc.sslConfig.isAvailable(EE_SUPPORTED_GROUPS)) { |
|
1113 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1114 |
SSLLogger.fine( |
|
1115 |
"Ignore unavailable supported_groups extension"); |
|
1116 |
} |
|
1117 |
return null; |
|
1118 |
} |
|
1119 |
||
1120 |
// Produce the extension. |
|
1121 |
// |
|
1122 |
// Contains all groups the server supports, regardless of whether |
|
1123 |
// they are currently supported by the client. |
|
1124 |
ArrayList<NamedGroup> namedGroups = new ArrayList<>( |
|
1125 |
SupportedGroups.supportedNamedGroups.length); |
|
1126 |
for (NamedGroup ng : SupportedGroups.supportedNamedGroups) { |
|
1127 |
if ((!SupportedGroups.enableFFDHE) && |
|
1128 |
(ng.type == NamedGroupType.NAMED_GROUP_FFDHE)) { |
|
1129 |
continue; |
|
1130 |
} |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1131 |
|
50768 | 1132 |
if (ng.isAvailable(shc.activeProtocols) && |
1133 |
ng.isSupported(shc.activeCipherSuites) && |
|
1134 |
shc.algorithmConstraints.permits( |
|
1135 |
EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), |
|
56862 | 1136 |
ng.algorithm, getParameters(ng))) { |
50768 | 1137 |
namedGroups.add(ng); |
1138 |
} else if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1139 |
SSLLogger.fine( |
|
1140 |
"Ignore inactive or disabled named group: " + ng.name); |
|
1141 |
} |
|
1142 |
} |
|
1143 |
||
1144 |
if (namedGroups.isEmpty()) { |
|
1145 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1146 |
SSLLogger.warning("no available named group"); |
|
1147 |
} |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1148 |
|
50768 | 1149 |
return null; |
1150 |
} |
|
1151 |
||
1152 |
int vectorLen = namedGroups.size() << 1; |
|
1153 |
byte[] extData = new byte[vectorLen + 2]; |
|
1154 |
ByteBuffer m = ByteBuffer.wrap(extData); |
|
1155 |
Record.putInt16(m, vectorLen); |
|
1156 |
for (NamedGroup namedGroup : namedGroups) { |
|
1157 |
Record.putInt16(m, namedGroup.id); |
|
1158 |
} |
|
1159 |
||
1160 |
// Update the context. |
|
1161 |
shc.conContext.serverRequestedNamedGroups = |
|
1162 |
Collections.<NamedGroup>unmodifiableList(namedGroups); |
|
1163 |
SupportedGroupsSpec spec = new SupportedGroupsSpec(namedGroups); |
|
1164 |
shc.handshakeExtensions.put(EE_SUPPORTED_GROUPS, spec); |
|
1165 |
||
1166 |
return extData; |
|
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1167 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1168 |
} |
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1169 |
|
50768 | 1170 |
private static final |
1171 |
class EESupportedGroupsConsumer implements ExtensionConsumer { |
|
1172 |
// Prevent instantiation of this class. |
|
1173 |
private EESupportedGroupsConsumer() { |
|
1174 |
// blank |
|
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1175 |
} |
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1176 |
|
50768 | 1177 |
@Override |
1178 |
public void consume(ConnectionContext context, |
|
1179 |
HandshakeMessage message, ByteBuffer buffer) throws IOException { |
|
1180 |
// The consuming happens in client side only. |
|
1181 |
ClientHandshakeContext chc = (ClientHandshakeContext)context; |
|
1182 |
||
1183 |
// Is it a supported and enabled extension? |
|
1184 |
if (!chc.sslConfig.isAvailable(EE_SUPPORTED_GROUPS)) { |
|
1185 |
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { |
|
1186 |
SSLLogger.fine( |
|
1187 |
"Ignore unavailable supported_groups extension"); |
|
1188 |
} |
|
1189 |
return; // ignore the extension |
|
1190 |
} |
|
1191 |
||
1192 |
// Parse the extension. |
|
1193 |
SupportedGroupsSpec spec; |
|
1194 |
try { |
|
1195 |
spec = new SupportedGroupsSpec(buffer); |
|
1196 |
} catch (IOException ioe) { |
|
1197 |
chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, ioe); |
|
1198 |
return; // fatal() always throws, make the compiler happy. |
|
1199 |
} |
|
1200 |
||
1201 |
// Update the context. |
|
1202 |
List<NamedGroup> knownNamedGroups = |
|
1203 |
new ArrayList<>(spec.namedGroupsIds.length); |
|
1204 |
for (int id : spec.namedGroupsIds) { |
|
1205 |
NamedGroup ng = NamedGroup.valueOf(id); |
|
1206 |
if (ng != null) { |
|
1207 |
knownNamedGroups.add(ng); |
|
1208 |
} |
|
1209 |
} |
|
1210 |
||
1211 |
chc.conContext.serverRequestedNamedGroups = knownNamedGroups; |
|
1212 |
chc.handshakeExtensions.put(EE_SUPPORTED_GROUPS, spec); |
|
1213 |
||
1214 |
// No impact on session resumption. |
|
45064
b1b45177051b
8140436: Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for TLS
xuelei
parents:
43693
diff
changeset
|
1215 |
} |
39563
1449ed425710
8148516: Improve the default strength of EC in JDK
xuelei
parents:
37814
diff
changeset
|
1216 |
} |
14330
e4cb78065603
8000970: break out auxiliary classes that will prevent multi-core compilation of the JDK
ohrstrom
parents:
diff
changeset
|
1217 |
} |