Blame SOURCES/rh1163501.patch

c4ba7e
diff --git a/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java b/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
c4ba7e
--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
c4ba7e
+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java
c4ba7e
@@ -1,5 +1,6 @@
c2cb23
 /*
a42b25
  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
c2cb23
+ * Copyright (c) 2014 Red Hat Inc.
c2cb23
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c2cb23
  *
c2cb23
  * This code is free software; you can redistribute it and/or modify it
9a353b
@@ -61,13 +62,13 @@
c2cb23
 
c2cb23
     private static void checkKeySize(int keysize)
c4ba7e
             throws InvalidParameterException {
9a353b
-        boolean supported = ((keysize == 2048) || (keysize == 3072) ||
9a353b
+        boolean supported = ((keysize == 2048) || (keysize == 3072) || (keysize == 4096) ||
9a353b
             ((keysize >= 512) && (keysize <= 1024) && ((keysize & 0x3F) == 0)));
9a353b
 
9a353b
         if (!supported) {
c4ba7e
             throw new InvalidParameterException(
c4ba7e
                     "DH key size must be multiple of 64 and range " +
9a353b
-                    "from 512 to 1024 (inclusive), or 2048, 3072. " +
9a353b
+                    "from 512 to 1024 (inclusive), or 2048, 3072, 4096. " +
c4ba7e
                     "The specific key size " + keysize + " is not supported");
c2cb23
         }
c2cb23
     }
c4ba7e
diff --git a/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java b/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java
c4ba7e
--- openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java
c4ba7e
+++ openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java
c4ba7e
@@ -1,5 +1,6 @@
c2cb23
 /*
9a353b
  * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
c2cb23
+ * Copyright (c) 2014 Red Hat Inc.
c2cb23
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c2cb23
  *
c2cb23
  * This code is free software; you can redistribute it and/or modify it
c4ba7e
@@ -58,7 +59,7 @@
c2cb23
      */
c2cb23
     private enum Sizes {
c2cb23
         two56(256), three84(384), five12(512), seven68(768), ten24(1024),
c2cb23
-        twenty48(2048);
c2cb23
+        twenty48(2048), forty96(4096);
c2cb23
 
c2cb23
         private final int intSize;
c2cb23
         private final BigInteger bigIntValue;
c4ba7e
@@ -130,6 +131,19 @@
c2cb23
         kp = kpg.generateKeyPair();
c2cb23
         checkKeyPair(kp, Sizes.twenty48, Sizes.five12);
c2cb23
 
c2cb23
+        kpg.initialize(Sizes.forty96.getIntSize());
c2cb23
+        kp = kpg.generateKeyPair();
c2cb23
+        checkKeyPair(kp, Sizes.forty96, Sizes.twenty48);
c2cb23
+
c2cb23
+        publicKey = (DHPublicKey)kp.getPublic();
c2cb23
+        p = publicKey.getParams().getP();
c2cb23
+        g = publicKey.getParams().getG();
c2cb23
+
c2cb23
+        // test w/ all values specified
c2cb23
+        kpg.initialize(new DHParameterSpec(p, g, Sizes.ten24.getIntSize()));
c2cb23
+        kp = kpg.generateKeyPair();
c2cb23
+        checkKeyPair(kp, Sizes.forty96, Sizes.ten24);
c2cb23
+
c2cb23
         System.out.println("OK");
c2cb23
     }
c2cb23
 
9a353b