minor code cleanup JDK-8171279-XDH-TLS-branch-2
authorapetcher
Fri, 17 Aug 2018 11:40:29 -0400
branchJDK-8171279-XDH-TLS-branch-2
changeset 56861 3c83db004067
parent 56860 9ce739c1ae20
child 56862 b9f6f8606065
minor code cleanup
src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java
src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java
src/java.base/share/classes/sun/security/ssl/SSLCredentials.java
src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java
src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java
--- a/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Fri Aug 17 10:44:25 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Fri Aug 17 11:40:29 2018 -0400
@@ -215,8 +215,9 @@
             try {
                 KeyFactory factory = JsseJce.getKeyFactory("DiffieHellman");
                 return factory.getKeySpec(key, DHPublicKeySpec.class);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
+            } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
+                // unlikely
+                throw new RuntimeException("Unable to get DHPublicKeySpec", e);
             }
         }
 
--- a/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java	Fri Aug 17 10:44:25 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/KeyShareExtension.java	Fri Aug 17 11:40:29 2018 -0400
@@ -779,8 +779,6 @@
                                 ng.name);
                     }
 
-                    // TODO: is the named group supported by the underlying
-                    // crypto provider?
                     selectedGroup = ng;
                     break;
                 }
@@ -904,10 +902,6 @@
                 return;     // fatal() always throws, make the compiler happy.
             }
 
-            // TODO: the selected group does not correspond to a group which
-            // was provided in the "key_share" extension in the original
-            // ClientHello.
-
             // update the context
 
             // When sending the new ClientHello, the client MUST replace the
--- a/src/java.base/share/classes/sun/security/ssl/SSLCredentials.java	Fri Aug 17 10:44:25 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/SSLCredentials.java	Fri Aug 17 11:40:29 2018 -0400
@@ -26,5 +26,4 @@
 package sun.security.ssl;
 
 interface SSLCredentials {
-
 }
--- a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java	Fri Aug 17 10:44:25 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java	Fri Aug 17 11:40:29 2018 -0400
@@ -31,11 +31,7 @@
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Optional;
-import sun.security.ssl.DHKeyExchange.DHEPossession;
-import sun.security.ssl.ECDHKeyExchange.ECDHEPossession;
-import sun.security.ssl.XDHKeyExchange.XDHEPossession;
 import sun.security.ssl.SupportedGroupsExtension.NamedGroup;
-import sun.security.ssl.SupportedGroupsExtension.NamedGroupType;
 import sun.security.ssl.SupportedGroupsExtension.NamedGroupFunctions;
 import sun.security.ssl.SupportedGroupsExtension.SupportedGroups;
 import sun.security.ssl.X509Authentication.X509Possession;
--- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Fri Aug 17 10:44:25 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Fri Aug 17 11:40:29 2018 -0400
@@ -241,7 +241,8 @@
         }
 
         private static DHParameterSpec getFFDHEDHParameterSpec(
-        NamedGroup namedGroup) {
+            NamedGroup namedGroup) {
+
             DHParameterSpec spec = null;
             switch (namedGroup) {
                 case FFDHE_2048:
@@ -264,7 +265,8 @@
         }
 
         private static DHParameterSpec getPredefinedDHParameterSpec(
-        NamedGroup namedGroup) {
+            NamedGroup namedGroup) {
+
             DHParameterSpec spec = null;
             switch (namedGroup) {
                 case FFDHE_2048: