@@ -291,29 +291,27 @@ protected ServerHello generate13ServerHello(ClientHello clientHello, HandshakeMe
291291 TlsUtils .negotiatedCipherSuite (securityParameters , cipherSuite );
292292 }
293293
294- int [] clientSupportedGroups = securityParameters .getClientSupportedGroups ();
295- int [] serverSupportedGroups = securityParameters .getServerSupportedGroups ();
296- boolean useServerOrder = tlsServer .preferLocalSupportedGroups ();
297-
298- int selectedGroup = TlsUtils .selectKeyShareGroup (crypto , serverVersion , clientSupportedGroups ,
299- serverSupportedGroups , useServerOrder );
300- if (selectedGroup < 0 )
301- {
302- throw new TlsFatalAlert (AlertDescription .handshake_failure );
303- }
304-
305- securityParameters .negotiatedGroup = selectedGroup ;
306-
307- clientShare = TlsUtils .findEarlyKeyShare (clientShares , selectedGroup );
308-
309- if (null == clientShare )
310- {
311- this .retryGroup = selectedGroup ;
312-
313- this .retryCookie = tlsServerContext .getNonceGenerator ().generateNonce (16 );
314-
315- return generate13HelloRetryRequest (clientHello );
316- }
294+ // int[] clientSupportedGroups = securityParameters.getClientSupportedGroups();
295+ // int[] serverSupportedGroups = securityParameters.getServerSupportedGroups();
296+ // boolean useServerOrder = tlsServer.preferLocalSupportedGroups();
297+ //
298+ // int selectedGroup = TlsUtils.selectKeyShareGroup(crypto, serverVersion, clientSupportedGroups,
299+ // serverSupportedGroups, useServerOrder);
300+ // if (selectedGroup < 0)
301+ // {
302+ // throw new TlsFatalAlert(AlertDescription.handshake_failure);
303+ // }
304+ //
305+ // clientShare = TlsUtils.findEarlyKeyShare(clientShares, selectedGroup);
306+ //
307+ // if (null == clientShare)
308+ // {
309+ // this.retryGroup = selectedGroup;
310+ //
311+ // this.retryCookie = tlsServerContext.getNonceGenerator().generateNonce(16);
312+ //
313+ // return generate13HelloRetryRequest(clientHello);
314+ // }
317315 }
318316
319317
@@ -329,17 +327,17 @@ protected ServerHello generate13ServerHello(ClientHello clientHello, HandshakeMe
329327 * client's view of its preferences; this extension SHOULD contain all groups the server supports,
330328 * regardless of whether they are currently supported by the client.
331329 */
332- if (!afterHelloRetryRequest )
333- {
334- int [] serverSupportedGroups = securityParameters .getServerSupportedGroups ();
335-
336- if (!TlsUtils .isNullOrEmpty (serverSupportedGroups ) &&
337- serverSupportedGroups [0 ] != securityParameters .getNegotiatedGroup () &&
338- !serverEncryptedExtensions .containsKey (TlsExtensionsUtils .EXT_supported_groups ))
339- {
340- TlsExtensionsUtils .addSupportedGroupsExtension (serverEncryptedExtensions , serverSupportedGroups );
341- }
342- }
330+ // if (!afterHelloRetryRequest)
331+ // {
332+ // int[] serverSupportedGroups = securityParameters.getServerSupportedGroups();
333+ //
334+ // if (!TlsUtils.isNullOrEmpty(serverSupportedGroups) &&
335+ // serverSupportedGroups[0] != securityParameters.getNegotiatedGroup() &&
336+ // !serverEncryptedExtensions.containsKey(TlsExtensionsUtils.EXT_supported_groups))
337+ // {
338+ // TlsExtensionsUtils.addSupportedGroupsExtension(serverEncryptedExtensions, serverSupportedGroups);
339+ // }
340+ // }
343341
344342 ProtocolVersion serverLegacyVersion = ProtocolVersion .TLSv12 ;
345343 TlsExtensionsUtils .addSupportedVersionsExtensionServer (serverHelloExtensions , serverVersion );
@@ -397,29 +395,29 @@ protected ServerHello generate13ServerHello(ClientHello clientHello, HandshakeMe
397395 TlsExtensionsUtils .addPreSharedKeyServerHello (serverHelloExtensions , selectedPSK .index );
398396 }
399397
400- TlsSecret sharedSecret ;
401- {
402- int negotiatedGroup = securityParameters .getNegotiatedGroup ();
403-
404- if (clientShare .getNamedGroup () != negotiatedGroup )
405- {
406- throw new TlsFatalAlert (AlertDescription .illegal_parameter );
407- }
408-
409- TlsAgreement agreement = TlsUtils .createKeyShare (crypto , negotiatedGroup , true );
410- if (agreement == null )
411- {
412- throw new TlsFatalAlert (AlertDescription .internal_error );
413- }
414-
415- agreement .receivePeerValue (clientShare .getKeyExchange ());
416-
417- byte [] key_exchange = agreement .generateEphemeral ();
418- KeyShareEntry serverShare = new KeyShareEntry (negotiatedGroup , key_exchange );
419- TlsExtensionsUtils .addKeyShareServerHello (serverHelloExtensions , serverShare );
420-
421- sharedSecret = agreement .calculateSecret ();
422- }
398+ TlsSecret sharedSecret = null ;
399+ // {
400+ // int negotiatedGroup = securityParameters.getNegotiatedGroup();
401+ //
402+ // if (clientShare.getNamedGroup() != negotiatedGroup)
403+ // {
404+ // throw new TlsFatalAlert(AlertDescription.illegal_parameter);
405+ // }
406+ //
407+ // TlsAgreement agreement = TlsUtils.createKeyShare(crypto, negotiatedGroup, true);
408+ // if (agreement == null)
409+ // {
410+ // throw new TlsFatalAlert(AlertDescription.internal_error);
411+ // }
412+ //
413+ // agreement.receivePeerValue(clientShare.getKeyExchange());
414+ //
415+ // byte[] key_exchange = agreement.generateEphemeral();
416+ // KeyShareEntry serverShare = new KeyShareEntry(negotiatedGroup, key_exchange);
417+ // TlsExtensionsUtils.addKeyShareServerHello(serverHelloExtensions, serverShare);
418+ //
419+ // sharedSecret = agreement.calculateSecret();
420+ // }
423421
424422 TlsUtils .establish13PhaseSecrets (tlsServerContext , pskEarlySecret , sharedSecret );
425423
0 commit comments