Blame SOURCES/rh1163501.patch

5338de
--- jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java	Tue Mar 17 00:09:12 2015 +0300
5338de
+++ jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java	Wed Apr 08 14:25:54 2015 +0100
5338de
@@ -1,5 +1,6 @@ 
c2cb23
 /*
c2cb23
  * Copyright (c) 1997, 2013, 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
5338de
@@ -80,10 +81,10 @@ 
c2cb23
      * @param random the source of randomness
c2cb23
      */
c2cb23
     public void initialize(int keysize, SecureRandom random) {
c2cb23
-        if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) {
c2cb23
+        if ((keysize < 512) || (keysize > 4096) || (keysize % 64 != 0)) {
c2cb23
             throw new InvalidParameterException("Keysize must be multiple "
c2cb23
                                                 + "of 64, and can only range "
c2cb23
-                                                + "from 512 to 2048 "
c2cb23
+                                                + "from 512 to 4096 "
c2cb23
                                                 + "(inclusive)");
c2cb23
         }
c2cb23
         this.pSize = keysize;
5338de
@@ -115,11 +116,11 @@ 
c2cb23
 
c2cb23
         params = (DHParameterSpec)algParams;
c2cb23
         pSize = params.getP().bitLength();
c2cb23
-        if ((pSize < 512) || (pSize > 2048) ||
c2cb23
+        if ((pSize < 512) || (pSize > 4096) ||
c2cb23
             (pSize % 64 != 0)) {
c2cb23
             throw new InvalidAlgorithmParameterException
c2cb23
                 ("Prime size must be multiple of 64, and can only range "
c2cb23
-                 + "from 512 to 2048 (inclusive)");
c2cb23
+                 + "from 512 to 4096 (inclusive)");
c2cb23
         }
c2cb23
 
c2cb23
         // exponent size is optional, could be 0
5338de
--- jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Tue Mar 17 00:09:12 2015 +0300
5338de
+++ jdk8/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java	Wed Apr 08 14:25:54 2015 +0100
5338de
@@ -1,5 +1,6 @@ 
c2cb23
 /*
c2cb23
  * Copyright (c) 1997, 2013, 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
5338de
@@ -60,11 +61,11 @@ 
c2cb23
 
c2cb23
     private static void checkKeySize(int keysize)
c2cb23
         throws InvalidAlgorithmParameterException {
c2cb23
-        if ((keysize != 2048) &&
c2cb23
+        if ((keysize != 2048) && (keysize != 4096) &&
c2cb23
             ((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) {
c2cb23
             throw new InvalidAlgorithmParameterException(
c2cb23
                 "Keysize must be multiple of 64 ranging from "
c2cb23
-                + "512 to 1024 (inclusive), or 2048");
c2cb23
+                + "512 to 1024 (inclusive), or 2048, or 4096");
c2cb23
         }
c2cb23
     }
c2cb23
 
5338de
--- jdk8/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java	Tue Mar 17 00:09:12 2015 +0300
5338de
+++ jdk8/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java	Wed Apr 08 14:25:54 2015 +0100
5338de
@@ -278,11 +278,11 @@ 
c2cb23
                     // this restriction is in the spec for DSA
c2cb23
                     // since we currently use DSA parameters for DH as well,
c2cb23
                     // it also applies to DH if no parameters are specified
c2cb23
-                    if ((keySize != 2048) &&
c2cb23
+                    if ((keySize != 2048) && (keySize != 4096) &&
c2cb23
                         ((keySize > 1024) || ((keySize & 0x3f) != 0))) {
c2cb23
                         throw new InvalidAlgorithmParameterException(algorithm +
c2cb23
                             " key must be multiples of 64 if less than 1024 bits" +
c2cb23
-                            ", or 2048 bits");
c2cb23
+                            ", or 2048 bits, or 4096 bits");
c2cb23
                     }
c2cb23
                 }
c2cb23
             }
5338de
--- jdk8/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java	Tue Mar 17 00:09:12 2015 +0300
5338de
+++ jdk8/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java	Wed Apr 08 14:25:54 2015 +0100
5338de
@@ -1,5 +1,6 @@ 
c2cb23
 /*
c2cb23
  * Copyright (c) 2005, 2012, 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
5338de
@@ -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;
5338de
@@ -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
 
5338de