Blame SOURCES/rh1163501.patch

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