Mercurial > hg > icedtea6
changeset 3175:102b1e9b36a3
Backport recent fixes from IcedTea 2.x.
PR2070: Type-punning warnings still evident on RHEL 5
PR2082: Cast should use same type as GCDrainStackTargetSize (uintx).
PR2096, RH1163501: 2048-bit DH upper bound too small for Fedora infrastructure
S8000897, PR2173, RH1155012: VM crash in CompileBroker
S8020190, PR2174, RH1176718: Fatal: Bug in native code: jfieldID must match object
S8028623, PR2177, RH1168693: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters.
S8061785, PR2177: [TEST_BUG] serviceability/sa/jmap-hashcode/Test8028623.java has utf8 character corrupted by earlier merge
2015-01-19 Andrew John Hughes <gnu.andrew@member.fsf.org>
* patches/openjdk/8000897-use_corresponding_digest_length.patch:
Moved to...
* Makefile.am:
(ICEDTEA_PATCHES): Add new patches.
* NEWS: Updated.
* patches/openjdk/8000897-pr2173-vm_crash_in_compilebroker.patch:
...here.
* patches/openjdk/8020190-pr2174-jfieldid_must_match_object.patch,
* patches/openjdk/8028623-pr2177-hash_code_mismatch_for_extended_characters.patch,
* patches/openjdk/8061785-pr2177-test_bug-corrupted_utf8_character.patch,
* patches/pr2070-type_punning_warnings.patch,
* patches/pr2082-s390_type_fixes.patch,
* patches/pr2096-4096-bit_dh.patch:
New backports from IcedTea 2.x.
author | Andrew John Hughes <gnu.andrew@redhat.com> |
---|---|
date | Tue, 20 Jan 2015 05:50:58 +0000 |
parents | ee1714db3b97 |
children | 8c50620ad9c0 |
files | ChangeLog Makefile.am NEWS patches/openjdk/8000897-pr2173-vm_crash_in_compilebroker.patch patches/openjdk/8000897-use_corresponding_digest_length.patch patches/openjdk/8020190-pr2174-jfieldid_must_match_object.patch patches/openjdk/8028623-pr2177-hash_code_mismatch_for_extended_characters.patch patches/openjdk/8061785-pr2177-test_bug-corrupted_utf8_character.patch patches/pr2070-type_punning_warnings.patch patches/pr2082-s390_type_fixes.patch patches/pr2096-4096-bit_dh.patch |
diffstat | 11 files changed, 459 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jan 20 04:38:55 2015 +0000 +++ b/ChangeLog Tue Jan 20 05:50:58 2015 +0000 @@ -1,3 +1,20 @@ +2015-01-19 Andrew John Hughes <gnu.andrew@member.fsf.org> + + * patches/openjdk/8000897-use_corresponding_digest_length.patch: + Moved to... + * Makefile.am: + (ICEDTEA_PATCHES): Add new patches. + * NEWS: Updated. + * patches/openjdk/8000897-pr2173-vm_crash_in_compilebroker.patch: + ...here. + * patches/openjdk/8020190-pr2174-jfieldid_must_match_object.patch, + * patches/openjdk/8028623-pr2177-hash_code_mismatch_for_extended_characters.patch, + * patches/openjdk/8061785-pr2177-test_bug-corrupted_utf8_character.patch, + * patches/pr2070-type_punning_warnings.patch, + * patches/pr2082-s390_type_fixes.patch, + * patches/pr2096-4096-bit_dh.patch: + New backports from IcedTea 2.x. + 2015-01-19 Andrew John Hughes <gnu.andrew@member.fsf.org> * patches/openjdk/6541350-tz_display_names_l10n.patch,
--- a/Makefile.am Tue Jan 20 04:38:55 2015 +0000 +++ b/Makefile.am Tue Jan 20 05:50:58 2015 +0000 @@ -601,8 +601,14 @@ patches/openjdk/7106773-512_bits_rsa.patch \ patches/pr1904-icedtea_and_distro_versioning.patch \ patches/openjdk/8017173-xml_cipher_rsa_oaep_cant_be_instantiated.patch \ - patches/openjdk/8000897-use_corresponding_digest_length.patch \ - patches/pr2083-aarch64_zero.patch + patches/openjdk/8000897-pr2173-vm_crash_in_compilebroker.patch \ + patches/pr2083-aarch64_zero.patch \ + patches/openjdk/8020190-pr2174-jfieldid_must_match_object.patch \ + patches/openjdk/8028623-pr2177-hash_code_mismatch_for_extended_characters.patch \ + patches/openjdk/8061785-pr2177-test_bug-corrupted_utf8_character.patch \ + patches/pr2070-type_punning_warnings.patch \ + patches/pr2082-s390_type_fixes.patch \ + patches/pr2096-4096-bit_dh.patch if WITH_RHINO ICEDTEA_PATCHES += \
--- a/NEWS Tue Jan 20 04:38:55 2015 +0000 +++ b/NEWS Tue Jan 20 05:50:58 2015 +0000 @@ -167,13 +167,19 @@ - S6745225: Memory leak while drawing Attributed String - S6904962: GlyphVector.getVisualBounds should not be affected by leading or trailing white space. - S7151089: PS NUMA: NUMA allocator should not attempt to free pages when using SHM large pages - - S8000897, RH1155012: VM crash in CompileBroker + - S8000897, PR2173, RH1155012: VM crash in CompileBroker - S8013057: Detect mmap() commit failures in Linux and Solaris os::commit_memory() impls and call vm_exit_out_of_memory() + - S8020190, PR2174, RH1176718: Fatal: Bug in native code: jfieldID must match object - S8026887: Make issues due to failed large pages allocations easier to debug + - S8028623, PR2177, RH1168693: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters. + - S8061785, PR2177: [TEST_BUG] serviceability/sa/jmap-hashcode/Test8028623.java has utf8 character corrupted by earlier merge * Bug fixes - PR1886: IcedTea does not checksum supplied tarballs - PR2033: patches/ecj/jaxws-getdtdtype.patch no longer applies since removal of JAXWS drop + - PR2070: Type-punning warnings still evident on RHEL 5 + - PR2082: Cast should use same type as GCDrainStackTargetSize (uintx). - PR2083: Add support for building Zero on AArch64 + - PR2096, RH1163501: 2048-bit DH upper bound too small for Fedora infrastructure New in release 1.13.5 (2014-10-14):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8000897-pr2173-vm_crash_in_compilebroker.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,29 @@ +# HG changeset patch +# User valeriep +# Date 1361905960 28800 +# Tue Feb 26 11:12:40 2013 -0800 +# Node ID 0af95754ffc5d63e2eeb472e3e87e8d8b7ed3048 +# Parent f94c09f6a10e9ba492b8ad2fc6fe0900bca4374f +8000897, PR2173, RH1155012: VM crash in CompileBroker +Summary: Fixed to use the corresponding digest length when generating output. +Reviewed-by: mullan + +diff -r f94c09f6a10e -r 0af95754ffc5 src/share/classes/sun/security/provider/SHA2.java +--- openjdk/jdk/src/share/classes/sun/security/provider/SHA2.java Thu Oct 16 17:30:05 2014 +0100 ++++ openjdk/jdk/src/share/classes/sun/security/provider/SHA2.java Tue Feb 26 11:12:40 2013 -0800 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -101,7 +101,7 @@ + i2bBig4((int)bitsProcessed, buffer, 60); + implCompress(buffer, 0); + +- i2bBig(state, 0, out, ofs, 32); ++ i2bBig(state, 0, out, ofs, engineGetDigestLength()); + } + + /**
--- a/patches/openjdk/8000897-use_corresponding_digest_length.patch Tue Jan 20 04:38:55 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -# HG changeset patch -# User valeriep -# Date 1361905960 28800 -# Tue Feb 26 11:12:40 2013 -0800 -# Node ID 5ffba58b541fb00dfd38a5ad5bc3ac7d8156f03f -# Parent 210fb90ee33ad4785f949fdbae4b0e75f73f576c -8000897: VM crash in CompileBroker -Summary: Fixed to use the corresponding digest length when generating output. -Reviewed-by: mullan - -diff -r 210fb90ee33a -r 5ffba58b541f src/share/classes/sun/security/provider/SHA2.java ---- openjdk/jdk/src/share/classes/sun/security/provider/SHA2.java Wed Feb 13 10:40:31 2013 +0000 -+++ openjdk/jdk/src/share/classes/sun/security/provider/SHA2.java Tue Feb 26 11:12:40 2013 -0800 -@@ -1,5 +1,5 @@ - /* -- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. -+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it -@@ -101,7 +101,7 @@ - i2bBig4((int)bitsProcessed, buffer, 60); - implCompress(buffer, 0); - -- i2bBig(state, 0, out, ofs, 32); -+ i2bBig(state, 0, out, ofs, engineGetDigestLength()); - } - - /**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8020190-pr2174-jfieldid_must_match_object.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,80 @@ +# HG changeset patch +# User prr +# Date 1380312407 25200 +# Fri Sep 27 13:06:47 2013 -0700 +# Node ID 993c08c0fcc7c6f404f708728679e6e707a95f8c +# Parent 6a11347bf5dcf44fc72ed83b451b89bbc16aea03 +8020190, PR2174, RH1176718: Fatal: Bug in native code: jfieldID must match object +Reviewed-by: jgodinez, vadim + +diff -r 7fc691671bf0 src/share/classes/sun/font/FreetypeFontScaler.java +--- openjdk/jdk/src/share/classes/sun/font/FreetypeFontScaler.java Tue Jan 20 03:06:20 2015 +0000 ++++ openjdk/jdk/src/share/classes/sun/font/FreetypeFontScaler.java Tue Jan 20 05:06:26 2015 +0000 +@@ -164,7 +164,7 @@ + + public synchronized void dispose() { + if (nativeScaler != 0L) { +- disposeNativeScaler(nativeScaler); ++ disposeNativeScaler(font.get(), nativeScaler); + nativeScaler = 0L; + } + } +@@ -185,7 +185,7 @@ + + synchronized int getGlyphCode(char charCode) throws FontScalerException { + if (nativeScaler != 0L) { +- return getGlyphCodeNative(nativeScaler, charCode); ++ return getGlyphCodeNative(font.get(), nativeScaler, charCode); + } + return FontManager.getNullScaler().getGlyphCode(charCode); + } +@@ -239,9 +239,9 @@ + + private native long getLayoutTableCacheNative(long pScaler); + +- private native void disposeNativeScaler(long pScaler); ++ private native void disposeNativeScaler(Font2D font2D, long pScaler); + +- private native int getGlyphCodeNative(long pScaler, char charCode); ++ private native int getGlyphCodeNative(Font2D font, long pScaler, char charCode); + private native int getNumGlyphsNative(long pScaler); + private native int getMissingGlyphCodeNative(long pScaler); + +diff -r 7fc691671bf0 src/share/native/sun/font/freetypeScaler.c +--- openjdk/jdk/src/share/native/sun/font/freetypeScaler.c Tue Jan 20 03:06:20 2015 +0000 ++++ openjdk/jdk/src/share/native/sun/font/freetypeScaler.c Tue Jan 20 05:06:26 2015 +0000 +@@ -884,13 +884,13 @@ + */ + JNIEXPORT void JNICALL + Java_sun_font_FreetypeFontScaler_disposeNativeScaler( +- JNIEnv *env, jobject scaler, jlong pScaler) { ++ JNIEnv *env, jobject scaler, jobject font2D, jlong pScaler) { + FTScalerInfo* scalerInfo = (FTScalerInfo *) jlong_to_ptr(pScaler); + + /* Freetype functions *may* cause callback to java + that can use cached values. Make sure our cache is up to date. + NB: scaler context is not important at this point, can use NULL. */ +- int errCode = setupFTContext(env, scaler, scalerInfo, NULL); ++ int errCode = setupFTContext(env, font2D, scalerInfo, NULL); + if (errCode) { + return; + } +@@ -939,7 +939,8 @@ + */ + JNIEXPORT jint JNICALL + Java_sun_font_FreetypeFontScaler_getGlyphCodeNative( +- JNIEnv *env, jobject scaler, jlong pScaler, jchar charCode) { ++ JNIEnv *env, jobject scaler, ++ jobject font2D, jlong pScaler, jchar charCode) { + + FTScalerInfo* scalerInfo = (FTScalerInfo *) jlong_to_ptr(pScaler); + int errCode; +@@ -952,7 +953,7 @@ + /* Freetype functions *may* cause callback to java + that can use cached values. Make sure our cache is up to date. + Scaler context is not important here, can use NULL. */ +- errCode = setupFTContext(env, scaler, scalerInfo, NULL); ++ errCode = setupFTContext(env, font2D, scalerInfo, NULL); + if (errCode) { + return 0; + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8028623-pr2177-hash_code_mismatch_for_extended_characters.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,106 @@ +# HG changeset patch +# User kevinw +# Date 1393238800 0 +# Mon Feb 24 10:46:40 2014 +0000 +# Node ID 7a4b0596c5395b5836faee96923b83444cc8a266 +# Parent cdd84db3f8331071237232f532705ed8e2de4048 +8028623, PR2177, RH1168693: SA: hash codes in SymbolTable mismatching java_lang_String::hash_code for extended characters. +Reviewed-by: sla, dsamersoff + +diff -r cdd84db3f833 -r 7a4b0596c539 agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java +--- openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java Wed Nov 05 02:26:35 2014 +0000 ++++ openjdk/hotspot/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java Mon Feb 24 10:46:40 2014 +0000 +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -61,8 +61,9 @@ + long h = 0; + int s = 0; + int len = buf.length; ++ // Emulate the unsigned int in java_lang_String::hash_code + while (len-- > 0) { +- h = 31*h + (0xFFL & buf[s]); ++ h = 31*h + (0xFFFFFFFFL & buf[s]); + s++; + } + return h & 0xFFFFFFFFL; +diff -r cdd84db3f833 -r 7a4b0596c539 test/serviceability/sa/jmap-hashcode/Test8028623.java +--- /dev/null Thu Jan 01 00:00:00 1970 +0000 ++++ openjdk/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java Mon Feb 24 10:46:40 2014 +0000 +@@ -0,0 +1,72 @@ ++/* ++ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++/* ++ * @test ++ * @bug 8028623 ++ * @summary Test hashing of extended characters in Serviceability Agent. ++ * @library /testlibrary ++ */ ++ ++import com.oracle.java.testlibrary.JDKToolLauncher; ++import com.oracle.java.testlibrary.OutputBuffer; ++import com.oracle.java.testlibrary.ProcessTools; ++ ++import java.io.File; ++ ++public class Test8028623 { ++ ++ public static int à = 1; ++ public static String dumpFile = "heap.out"; ++ ++ public static void main (String[] args) { ++ ++ System.out.println(Ã); ++ ++ try { ++ int pid = ProcessTools.getProcessId(); ++ JDKToolLauncher jmap = JDKToolLauncher.create("jmap") ++ .addToolArg("-F") ++ .addToolArg("-dump:live,format=b,file=" + dumpFile) ++ .addToolArg(Integer.toString(pid)); ++ ProcessBuilder pb = new ProcessBuilder(jmap.getCommand()); ++ OutputBuffer output = ProcessTools.getOutput(pb); ++ Process p = pb.start(); ++ int e = p.waitFor(); ++ System.out.println("stdout:"); ++ System.out.println(output.getStdout()); ++ System.out.println("stderr:"); ++ System.out.println(output.getStderr()); ++ ++ if (e != 0) { ++ throw new RuntimeException("jmap returns: " + e); ++ } ++ if (! new File(dumpFile).exists()) { ++ throw new RuntimeException("dump file NOT created: '" + dumpFile + "'"); ++ } ++ } catch (Throwable t) { ++ t.printStackTrace(); ++ throw new RuntimeException("Test failed with: " + t); ++ } ++ } ++}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/openjdk/8061785-pr2177-test_bug-corrupted_utf8_character.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,36 @@ +# HG changeset patch +# User kevinw +# Date 1416851563 28800 +# Mon Nov 24 09:52:43 2014 -0800 +# Node ID 2b280bce222a48a7e1b961f6eeb9a9375b50483d +# Parent 94b076895e5dcb781379b85d7fbe522cd3347dfa +8061785, PR2177: [TEST_BUG] serviceability/sa/jmap-hashcode/Test8028623.java has utf8 character corrupted by earlier merge +Reviewed-by: poonam + +diff -r 94b076895e5d -r 2b280bce222a test/serviceability/sa/jmap-hashcode/Test8028623.java +--- openjdk/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java Tue Oct 21 11:39:21 2014 -0700 ++++ openjdk/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java Mon Nov 24 09:52:43 2014 -0800 +@@ -26,6 +26,8 @@ + * @bug 8028623 + * @summary Test hashing of extended characters in Serviceability Agent. + * @library /testlibrary ++ * @compile -encoding utf8 Test8028623.java ++ * @run main Test8028623 + */ + + import com.oracle.java.testlibrary.JDKToolLauncher; +@@ -36,12 +38,12 @@ + + public class Test8028623 { + +- public static int à = 1; ++ public static int \u00CB = 1; + public static String dumpFile = "heap.out"; + + public static void main (String[] args) { + +- System.out.println(Ã); ++ System.out.println(\u00CB); + + try { + int pid = ProcessTools.getProcessId();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2070-type_punning_warnings.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,36 @@ +# HG changeset patch +# User andrew +# Date 1415202016 0 +# Wed Nov 05 15:40:16 2014 +0000 +# Node ID e4aec8a11c8a1ee10edc85d5f0c62119e86aca46 +# Parent 0af95754ffc5d63e2eeb472e3e87e8d8b7ed3048 +PR2070: Type-punning warnings still evident on RHEL 5 +Summary: Add -fno-strict-aliasing to the whole of sun/font and to waiters.cpp + +diff -r 0af95754ffc5 -r e4aec8a11c8a make/mkdemo/jvmti/waiters/Makefile +--- openjdk/jdk/make/mkdemo/jvmti/waiters/Makefile Tue Feb 26 11:12:40 2013 -0800 ++++ openjdk/jdk/make/mkdemo/jvmti/waiters/Makefile Wed Nov 05 15:40:16 2014 +0000 +@@ -41,3 +41,7 @@ + # + include $(BUILDDIR)/common/Demo.gmk + ++# Turn off aliasing with GCC ++ifeq ($(PLATFORM), linux) ++ CXXFLAGS += -fno-strict-aliasing ++endif +diff -r 0af95754ffc5 -r e4aec8a11c8a make/sun/font/Makefile +--- openjdk/jdk/make/sun/font/Makefile Tue Feb 26 11:12:40 2013 -0800 ++++ openjdk/jdk/make/sun/font/Makefile Wed Nov 05 15:40:16 2014 +0000 +@@ -94,10 +94,9 @@ + + endif # PLATFORM + +-# Turn off aliasing with GCC for ExtensionSubtables.cpp ++# Turn off aliasing with GCC + ifeq ($(PLATFORM), linux) +- CXXFLAGS += $(CXXFLAGS_$(@F)) +- CXXFLAGS_ExtensionSubtables.o = -fno-strict-aliasing ++ CXXFLAGS += -fno-strict-aliasing + endif + + # Turn on infinality rendering support when requested
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2082-s390_type_fixes.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,20 @@ +# HG changeset patch +# User andrew +# Date 1379536490 -3600 +# Wed Sep 18 21:34:50 2013 +0100 +# Node ID 034276a67ecac35b850d90f0746de1bee471a255 +# Parent 1bb9fd504ded29203baab49faf18b0d16f87dba9 +Cast should use same type as GCDrainStackTargetSize (uintx). + +diff -r 1bb9fd504ded -r 034276a67eca src/share/vm/gc_implementation/g1/concurrentMark.cpp +--- openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Sep 11 16:55:12 2013 +0100 ++++ openjdk/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Sep 18 21:34:50 2013 +0100 +@@ -3632,7 +3632,7 @@ + // of things to do) or totally (at the very end). + size_t target_size; + if (partially) { +- target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize); ++ target_size = MIN2((uintx)_task_queue->max_elems()/3, GCDrainStackTargetSize); + } else { + target_size = 0; + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/patches/pr2096-4096-bit_dh.patch Tue Jan 20 05:50:58 2015 +0000 @@ -0,0 +1,120 @@ +# HG changeset patch +# User andrew +# Date 1416871718 0 +# Mon Nov 24 23:28:38 2014 +0000 +# Node ID d909950c3f6dfcad956d7eb90c8339eeea23d65c +# Parent e4aec8a11c8a1ee10edc85d5f0c62119e86aca46 +PR2096, RH1163501: 2048-bit DH upper bound too small for Fedora infrastructure + +diff -r e4aec8a11c8a -r d909950c3f6d src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java +--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Wed Nov 05 15:40:16 2014 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java Mon Nov 24 23:28:38 2014 +0000 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2014 Red Hat Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -80,10 +81,10 @@ + * @param random the source of randomness + */ + public void initialize(int keysize, SecureRandom random) { +- if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) { ++ if ((keysize < 512) || (keysize > 4096) || (keysize % 64 != 0)) { + throw new InvalidParameterException("Keysize must be multiple " + + "of 64, and can only range " +- + "from 512 to 2048 " ++ + "from 512 to 4096 " + + "(inclusive)"); + } + this.pSize = keysize; +@@ -115,11 +116,11 @@ + + params = (DHParameterSpec)algParams; + pSize = params.getP().bitLength(); +- if ((pSize < 512) || (pSize > 2048) || ++ if ((pSize < 512) || (pSize > 4096) || + (pSize % 64 != 0)) { + throw new InvalidAlgorithmParameterException + ("Prime size must be multiple of 64, and can only range " +- + "from 512 to 2048 (inclusive)"); ++ + "from 512 to 4096 (inclusive)"); + } + + // exponent size is optional, could be 0 +diff -r e4aec8a11c8a -r d909950c3f6d src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java +--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Wed Nov 05 15:40:16 2014 +0000 ++++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java Mon Nov 24 23:28:38 2014 +0000 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2014 Red Hat Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -68,10 +69,10 @@ + * @param random the source of randomness + */ + protected void engineInit(int keysize, SecureRandom random) { +- if ((keysize < 512) || (keysize > 2048) || (keysize % 64 != 0)) { ++ if ((keysize < 512) || (keysize > 4096) || (keysize % 64 != 0)) { + throw new InvalidParameterException("Keysize must be multiple " + + "of 64, and can only range " +- + "from 512 to 2048 " ++ + "from 512 to 4096 " + + "(inclusive)"); + } + this.primeSize = keysize; +@@ -100,10 +101,10 @@ + DHGenParameterSpec dhParamSpec = (DHGenParameterSpec)genParamSpec; + + primeSize = dhParamSpec.getPrimeSize(); +- if ((primeSize<512) || (primeSize>2048) || (primeSize%64 != 0)) { ++ if ((primeSize<512) || (primeSize>4096) || (primeSize%64 != 0)) { + throw new InvalidAlgorithmParameterException + ("Modulus size must be multiple of 64, and can only range " +- + "from 512 to 2048 (inclusive)"); ++ + "from 512 to 4096 (inclusive)"); + } + + exponentSize = dhParamSpec.getExponentSize(); +diff -r e4aec8a11c8a -r d909950c3f6d test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java +--- openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java Wed Nov 05 15:40:16 2014 +0000 ++++ openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java Mon Nov 24 23:28:38 2014 +0000 +@@ -1,5 +1,6 @@ + /* + * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2014 Red Hat Inc. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -58,7 +59,7 @@ + */ + private enum Sizes { + two56(256), three84(384), five12(512), seven68(768), ten24(1024), +- twenty48(2048); ++ twenty48(2048), forty96(4096); + + private final int intSize; + private final BigInteger bigIntValue; +@@ -130,6 +131,19 @@ + kp = kpg.generateKeyPair(); + checkKeyPair(kp, Sizes.twenty48, Sizes.five12); + ++ kpg.initialize(Sizes.forty96.getIntSize()); ++ kp = kpg.generateKeyPair(); ++ checkKeyPair(kp, Sizes.forty96, Sizes.twenty48); ++ ++ publicKey = (DHPublicKey)kp.getPublic(); ++ p = publicKey.getParams().getP(); ++ g = publicKey.getParams().getG(); ++ ++ // test w/ all values specified ++ kpg.initialize(new DHParameterSpec(p, g, Sizes.ten24.getIntSize())); ++ kp = kpg.generateKeyPair(); ++ checkKeyPair(kp, Sizes.forty96, Sizes.ten24); ++ + System.out.println("OK"); + } +