/hg/release/icedtea7-forest-2.3/jdk: 13 new changesets
andrew at icedtea.classpath.org
andrew at icedtea.classpath.org
Mon Oct 7 15:18:48 PDT 2013
changeset ba476cfdd27c in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=ba476cfdd27c
author: andrew
date: Fri Oct 04 16:36:56 2013 +0100
Add tests missing form 8014618 backport
changeset 5438973623f2 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=5438973623f2
author: jgodinez
date: Wed Feb 06 14:45:02 2013 -0800
8005194: [parfait] #353 sun/awt/image/jpeg/imageioJPEG.c Memory leak of pointer 'scale' allocated with calloc()
Reviewed-by: prr, vadim
Contributed-by: jia-hong.chen at oracle.com
changeset 375646138f2e in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=375646138f2e
author: andrew
date: Fri Oct 04 16:38:52 2013 +0100
Fix Kerberos cache support to check for null, fallback on old path support and not hardcode the krb5 library.
changeset 6200515176fa in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=6200515176fa
author: andrew
date: Tue Sep 03 15:19:59 2013 +0100
Only define _GNU_SOURCE if not already defined.
changeset 8e4c462b3a10 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=8e4c462b3a10
author: andrew
date: Fri Oct 04 16:40:15 2013 +0100
PR1551: Add build support for Zero AArch64
changeset b37ac011ed13 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=b37ac011ed13
author: andrew
date: Fri Oct 04 16:41:37 2013 +0100
Add -D_LITTLE_ENDIAN for AArch64.
changeset b3846cc85e15 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=b3846cc85e15
author: andrew
date: Wed Sep 04 17:53:23 2013 +0100
PR1553: Add Debian AArch64 support
changeset 3297163636bf in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=3297163636bf
author: andrew
date: Wed Sep 04 18:20:38 2013 +0100
PR1554: Fix build on Mac OS X
Contributed-by: Alex Kasko <alex.kasko.lists at gmail.com>
changeset 5bbb4c34cc3a in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=5bbb4c34cc3a
author: andrew
date: Fri Sep 06 12:44:40 2013 +0100
RH661505: JPEGs with sRGB IEC61966-2.1 color profiles have wrong colors
changeset 5dc47fef62d0 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=5dc47fef62d0
author: andrew
date: Fri Sep 06 12:45:39 2013 +0100
RH995488: Java thinks that the default timezone is Busingen instead of Zurich
changeset 424d6404dab6 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=424d6404dab6
author: andrew
date: Fri Sep 06 21:36:31 2013 +0100
Correct error resulting from IcedTea 1.x hack.
changeset 1076012c37f5 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=1076012c37f5
author: andrew
date: Mon Sep 09 20:18:12 2013 +0100
Cleanup file resources properly in TimeZone_md.
changeset 6e44e8962a31 in /hg/release/icedtea7-forest-2.3/jdk
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/jdk?cmd=changeset;node=6e44e8962a31
author: omajid
date: Mon Sep 16 15:43:06 2013 -0400
8024863: X11: Support GNOME Shell as mutter
Reviewed-by: anthony
diffstat:
make/common/shared/Defs-java.gmk | 2 +-
make/common/shared/Platform.gmk | 2 +-
make/java/nio/Makefile | 10 +-
make/javax/sound/SoundDefs.gmk | 4 +
make/jdk_generic_profile.sh | 17 +-
make/sun/lwawt/FILES_c_macosx.gmk | 6 +
make/sun/lwawt/Makefile | 7 +-
make/sun/security/Makefile | 4 +-
make/sun/security/krb5/internal/ccache/Makefile | 3 +-
src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java | 34 +-
src/share/native/com/sun/media/sound/SoundDefs.h | 1 +
src/share/native/sun/awt/image/jpeg/imageioJPEG.c | 10 +-
src/solaris/classes/sun/awt/X11/XWM.java | 2 +-
src/solaris/native/java/util/TimeZone_md.c | 64 +
src/solaris/native/sun/security/krb5/internal/ccache/krb5ccache.c | 2 +
test/com/sun/crypto/provider/TLS/TestLeadingZeroes.java | 420 ++++++++++
test/sun/security/pkcs11/tls/TestLeadingZeroesP11.java | 410 +++++++++
17 files changed, 974 insertions(+), 24 deletions(-)
diffs (truncated from 1268 to 500 lines):
diff -r ba0446e8ac19 -r 6e44e8962a31 make/common/shared/Defs-java.gmk
--- a/make/common/shared/Defs-java.gmk Fri Sep 27 20:53:43 2013 +0100
+++ b/make/common/shared/Defs-java.gmk Mon Sep 16 15:43:06 2013 -0400
@@ -90,7 +90,7 @@
ifeq ($(ARCH_DATA_MODEL), 32)
JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=768
else
- JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1536
+ JAVAC_JVM_FLAGS += -J-XX:ThreadStackSize=1664
endif
JAVAC_JVM_FLAGS += $(JAVA_TOOLS_FLAGS:%=-J%)
diff -r ba0446e8ac19 -r 6e44e8962a31 make/common/shared/Platform.gmk
--- a/make/common/shared/Platform.gmk Fri Sep 27 20:53:43 2013 +0100
+++ b/make/common/shared/Platform.gmk Mon Sep 16 15:43:06 2013 -0400
@@ -161,7 +161,7 @@
mach := $(shell uname -m)
endif
ifneq (,$(wildcard /usr/bin/dpkg-architecture))
- mach := $(shell (dpkg-architecture -qDEB_BUILD_ARCH_CPU 2>/dev/null || echo $(mach)) | sed 's/powerpc$$/ppc/;s/hppa/parisc/')
+ mach := $(shell (dpkg-architecture -qDEB_HOST_ARCH_CPU 2>/dev/null || echo $(mach)) | sed 's/arm64/aarch64/;s/powerpc$$/ppc/;s/hppa/parisc/')
endif
archExpr = case "$(mach)" in \
i[3-9]86) \
diff -r ba0446e8ac19 -r 6e44e8962a31 make/java/nio/Makefile
--- a/make/java/nio/Makefile Fri Sep 27 20:53:43 2013 +0100
+++ b/make/java/nio/Makefile Mon Sep 16 15:43:06 2013 -0400
@@ -167,6 +167,11 @@
FILES_gen += \
sun/nio/fs/UnixConstants.java
+ifndef COMPILE_AGAINST_SYSCALLS
+FILES_c += \
+ syscalls_fp.c
+endif
+
endif
ifeq ($(PLATFORM), solaris)
@@ -234,11 +239,6 @@
gio_fp.c
endif
-ifndef COMPILE_AGAINST_SYSCALLS
-FILES_c += \
- syscalls_fp.c
-endif
-
endif # PLATFORM = linux
ifeq ($(PLATFORM), macosx)
diff -r ba0446e8ac19 -r 6e44e8962a31 make/javax/sound/SoundDefs.gmk
--- a/make/javax/sound/SoundDefs.gmk Fri Sep 27 20:53:43 2013 +0100
+++ b/make/javax/sound/SoundDefs.gmk Mon Sep 16 15:43:06 2013 -0400
@@ -118,6 +118,10 @@
CPPFLAGS += -DX_ARCH=X_SPARCV9
endif # ARCH sparcv9
+ ifeq ($(ARCH), aarch64)
+ CPPFLAGS += -DX_ARCH=X_AARCH64
+ endif # ARCH aarch64
+
ifeq ($(ARCH), amd64)
CPPFLAGS += -DX_ARCH=X_AMD64
endif # ARCH amd64
diff -r ba0446e8ac19 -r 6e44e8962a31 make/jdk_generic_profile.sh
--- a/make/jdk_generic_profile.sh Fri Sep 27 20:53:43 2013 +0100
+++ b/make/jdk_generic_profile.sh Mon Sep 16 15:43:06 2013 -0400
@@ -266,10 +266,10 @@
# ARCH_DATA_MODEL is the number of bits in a pointer
case "${ZERO_LIBARCH}" in
- i386|ppc|s390|sparc|arm|sh)
+ arm|i386|ppc|s390|sh|sparc)
ARCH_DATA_MODEL=32
;;
- amd64|ppc64|s390x|sparcv9|ia64|alpha)
+ aarch64|alpha|amd64|ia64|ppc64|s390x|sparcv9)
ARCH_DATA_MODEL=64
;;
*)
@@ -280,7 +280,7 @@
# ZERO_ENDIANNESS is the endianness of the processor
case "${ZERO_LIBARCH}" in
- i386|amd64|ia64|arm)
+ arm|aarch64|amd64|i386|ia64|mipsel)
ZERO_ENDIANNESS=little
;;
ppc*|s390*|sparc*|alpha)
@@ -307,7 +307,7 @@
s390)
ZERO_ARCHFLAG="-m31"
;;
- arm)
+ arm|aarch64)
ZERO_ARCHFLAG="-D_LITTLE_ENDIAN"
;;
*)
@@ -454,9 +454,18 @@
fi
export GIF_LIBS
+# Export variables for system krb5
+# KRB5_CFLAGS and KRB5_LIBS tell the compiler how to compile and
+# link against Kerberos
+if [ "${KRB5_LIBS}" = "" ] ; then
+ KRB5_LIBS="-lkrb5"
+fi
+export KRB5_LIBS
+
# IcedTea defaults; use system libraries
export USE_SYSTEM_LCMS=true
export USE_SYSTEM_ZLIB=true
export USE_SYSTEM_JPEG=true
export USE_SYSTEM_PNG=true
export USE_SYSTEM_GIF=true
+export SYSTEM_KRB5=true
diff -r ba0446e8ac19 -r 6e44e8962a31 make/sun/lwawt/FILES_c_macosx.gmk
--- a/make/sun/lwawt/FILES_c_macosx.gmk Fri Sep 27 20:53:43 2013 +0100
+++ b/make/sun/lwawt/FILES_c_macosx.gmk Mon Sep 16 15:43:06 2013 -0400
@@ -98,3 +98,9 @@
AccelGlyphCache.c \
CUPSfuncs.c
+
+ifndef USE_SYSTEM_CUPS
+FILES_c += \
+ cups_fp.c
+endif
+
diff -r ba0446e8ac19 -r 6e44e8962a31 make/sun/lwawt/Makefile
--- a/make/sun/lwawt/Makefile Fri Sep 27 20:53:43 2013 +0100
+++ b/make/sun/lwawt/Makefile Mon Sep 16 15:43:06 2013 -0400
@@ -63,6 +63,10 @@
vpath %.c $(SHARE_SRC)/native/sun/font
vpath %.c $(call NativeSrcDirList,,native/sun/awt)
+ifndef USE_SYSTEM_CUPS
+vpath %.c $(PLATFORM_SRC)/native/common/deps
+endif
+
vpath %.cpp $(SHARE_SRC)/native/sun/image
vpath %.m $(call NativeSrcDirList,,native/sun/awt)
@@ -103,7 +107,8 @@
$(call NativeSrcDirList,-I,/native/sun/osxapp) \
$(call NativeSrcDirList,-I,/native/sun/font) \
$(call NativeSrcDirList,-I,/native/sun/java2d) \
- $(call NativeSrcDirList,-I,/native/sun/java2d/opengl)
+ $(call NativeSrcDirList,-I,/native/sun/java2d/opengl) \
+ $(call NativeSrcDirList,-I,/native/common/deps)
ifeq ($(MILESTONE), internal)
CPPFLAGS += -DINTERNAL_BUILD
diff -r ba0446e8ac19 -r 6e44e8962a31 make/sun/security/Makefile
--- a/make/sun/security/Makefile Fri Sep 27 20:53:43 2013 +0100
+++ b/make/sun/security/Makefile Mon Sep 16 15:43:06 2013 -0400
@@ -56,7 +56,9 @@
# Build krb5/internal/ccache only on Linux and Solaris platforms.
KRB5_CCACHE =
ifeq ($(PLATFORM), $(filter $(PLATFORM),linux solaris))
- KRB5_CCACHE = krb5/internal/ccache
+ ifeq ($(SYSTEM_KRB5),true)
+ KRB5_CCACHE = krb5/internal/ccache
+ endif
endif
# Build Microsoft CryptoAPI provider only on Windows platform.
diff -r ba0446e8ac19 -r 6e44e8962a31 make/sun/security/krb5/internal/ccache/Makefile
--- a/make/sun/security/krb5/internal/ccache/Makefile Fri Sep 27 20:53:43 2013 +0100
+++ b/make/sun/security/krb5/internal/ccache/Makefile Mon Sep 16 15:43:06 2013 -0400
@@ -44,5 +44,6 @@
include $(BUILDDIR)/common/Library.gmk
-OTHER_LDLIBS = $(LIBDL) $(JVMLIB) -lkrb5
+OTHER_CFLAGS += $(KRB5_CFLAGS)
+OTHER_LDLIBS = $(LIBDL) $(JVMLIB) $(KRB5_LIBS)
endif # PLATFORM
diff -r ba0446e8ac19 -r 6e44e8962a31 src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java
--- a/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Fri Sep 27 20:53:43 2013 +0100
+++ b/src/share/classes/sun/security/krb5/internal/ccache/FileCredentialsCache.java Mon Sep 16 15:43:06 2013 -0400
@@ -45,6 +45,9 @@
import java.io.BufferedReader;
import java.io.InputStreamReader;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
/**
* CredentialsCache stores credentials(tickets, session keys, etc) in a
* semi-permanent store
@@ -360,8 +363,9 @@
*
* 1. KRB5CCNAME
* 2. location specified by Kerberos API on unix systems
- * 3. <user.home>/krb5cc_<user.name>
- * 4. <user.home>/krb5cc (if can't get <user.name>)
+ * 3. /tmp/krb5cc_<uid> on unix systems
+ * 4. <user.home>/krb5cc_<user.name>
+ * 5. <user.home>/krb5cc (if can't get <user.name>)
*/
public static String getDefaultCacheName() {
@@ -429,16 +433,32 @@
* We require the default cache location to be a file name.
* DIR: can point to a cache collection, while DIR:: points
* to a specific cache file.
- *
+ *
* http://k5wiki.kerberos.org/wiki?title=Projects/Client_principal_selection&oldid=4118
*/
- if (name.startsWith("FILE:") || name.startsWith("DIR::")) {
+ if (name != null && (name.startsWith("FILE:") || name.startsWith("DIR::"))) {
name = name.substring(5);
if (DEBUG) {
System.out.println(">>>KinitOptions cache name is " +
name);
}
return name;
+ } else {
+ long uid = 0;
+
+ Class<?> c = Class.forName
+ ("com.sun.security.auth.module.UnixSystem");
+ Constructor<?> constructor = c.getConstructor();
+ Object obj = constructor.newInstance();
+ Method method = c.getMethod("getUid");
+ uid = ((Long)method.invoke(obj)).longValue();
+ name = File.separator + "tmp" +
+ File.separator + stdCacheNameComponent + "_" + uid;
+ if (DEBUG) {
+ System.out.println(">>>KinitOptions cache name is " +
+ name);
+ }
+ return name;
}
} catch (Exception e) {
if (DEBUG) {
@@ -483,7 +503,7 @@
return name;
}
-
+
private native static String nativeGetDefaultCacheName() throws Exception;
public static String checkValidation(String name) {
@@ -566,7 +586,7 @@
}
return null;
}
-
+
private static void ensureLoaded() {
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void> () {
@@ -577,5 +597,5 @@
});
alreadyLoaded = true;
}
-
+
}
diff -r ba0446e8ac19 -r 6e44e8962a31 src/share/native/com/sun/media/sound/SoundDefs.h
--- a/src/share/native/com/sun/media/sound/SoundDefs.h Fri Sep 27 20:53:43 2013 +0100
+++ b/src/share/native/com/sun/media/sound/SoundDefs.h Mon Sep 16 15:43:06 2013 -0400
@@ -51,6 +51,7 @@
#define X_S390 14
#define X_S390X 15
#define X_SH 16
+#define X_AARCH64 17
// **********************************
// Make sure you set X_PLATFORM and X_ARCH defines correctly.
diff -r ba0446e8ac19 -r 6e44e8962a31 src/share/native/sun/awt/image/jpeg/imageioJPEG.c
--- a/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Fri Sep 27 20:53:43 2013 +0100
+++ b/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Mon Sep 16 15:43:06 2013 -0400
@@ -1435,6 +1435,8 @@
"[S");
}
+#define JPEG_APP1 (JPEG_APP0 + 1) /* EXIF APP1 marker code */
+
JNIEXPORT jlong JNICALL
Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader
(JNIEnv *env,
@@ -1488,6 +1490,7 @@
// Set up to keep any APP2 markers, as these might contain ICC profile
// data
+ jpeg_save_markers(cinfo, JPEG_APP1, 0xFFFF);
jpeg_save_markers(cinfo, ICC_MARKER, 0xFFFF);
/*
@@ -1550,8 +1553,6 @@
imageio_init_source((j_decompress_ptr) cinfo);
}
-#define JPEG_APP1 (JPEG_APP0 + 1) /* EXIF APP1 marker code */
-
/*
* For EXIF images, the APP1 will appear immediately after the SOI,
* so it's safe to only look at the first marker in the list.
@@ -2691,6 +2692,11 @@
scale[i] = (UINT8*) malloc((maxBandValue + 1) * sizeof(UINT8));
if (scale[i] == NULL) {
+ // Cleanup before throwing an out of memory exception
+ for (j = 0; j < i; j++) {
+ free(scale[j]);
+ }
+ free(scale);
JNU_ThrowByName( env, "java/lang/OutOfMemoryError",
"Writing JPEG Stream");
return JNI_FALSE;
diff -r ba0446e8ac19 -r 6e44e8962a31 src/solaris/classes/sun/awt/X11/XWM.java
--- a/src/solaris/classes/sun/awt/X11/XWM.java Fri Sep 27 20:53:43 2013 +0100
+++ b/src/solaris/classes/sun/awt/X11/XWM.java Mon Sep 16 15:43:06 2013 -0400
@@ -578,7 +578,7 @@
}
static boolean isMutter() {
- return isNetWMName("Mutter");
+ return isNetWMName("Mutter") || isNetWMName("GNOME Shell");
}
// TODO: according to wikipedia, compiz is now reparenting. This should
diff -r ba0446e8ac19 -r 6e44e8962a31 src/solaris/native/java/util/TimeZone_md.c
--- a/src/solaris/native/java/util/TimeZone_md.c Fri Sep 27 20:53:43 2013 +0100
+++ b/src/solaris/native/java/util/TimeZone_md.c Mon Sep 16 15:43:06 2013 -0400
@@ -53,6 +53,8 @@
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
+static const char *REDHAT_RELEASE_FILE = "/etc/redhat-release";
+static const char *SYSCONFIG_CLOCK_FILE = "/etc/sysconfig/clock";
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
#else
@@ -248,6 +250,7 @@
}
}
(void) fclose(fp);
+ fp = NULL;
if (tz != NULL) {
return tz;
}
@@ -255,6 +258,67 @@
#endif /* __linux__ */
/*
+ * Next, try the ZONE entry in /etc/sysconfig/clock.
+ */
+ if ((fp = fopen(REDHAT_RELEASE_FILE, "r")) != NULL) {
+ char id[7];
+
+ /* Avoid this file on Fedora as may be buggy; RH489586 */
+ if (fgets(id, sizeof (id), fp) != NULL &&
+ strncmp(id, "Fedora", 6) != 0) {
+ (void) fclose(fp);
+ if ((fp = fopen(SYSCONFIG_CLOCK_FILE, "r")) != NULL) {
+ char line[256];
+
+ while (fgets(line, sizeof(line), fp) != NULL) {
+ char *p = line;
+ char *s;
+
+ SKIP_SPACE(p);
+ if (*p != 'Z') {
+ continue;
+ }
+ if (strncmp(p, "ZONE=\"", 6) == 0) {
+ p += 6;
+ } else {
+ /*
+ * In case we need to parse it token by token.
+ */
+ if (strncmp(p, "ZONE", 4) != 0) {
+ continue;
+ }
+ p += 4;
+ SKIP_SPACE(p);
+ if (*p++ != '=') {
+ break;
+ }
+ SKIP_SPACE(p);
+ if (*p++ != '"') {
+ break;
+ }
+ }
+ for (s = p; *s && *s != '"'; s++)
+ ;
+ if (*s != '"') {
+ /* this ZONE entry is broken. */
+ break;
+ }
+ *s = '\0';
+ tz = strdup(p);
+ break;
+ }
+ }
+ }
+ if (fp != NULL) {
+ (void) fclose(fp);
+ fp = NULL;
+ }
+ if (tz != NULL) {
+ return tz;
+ }
+ }
+
+ /*
* Next, try /etc/localtime to find the zone ID.
*/
if (lstat(DEFAULT_ZONEINFO_FILE, &statbuf) == -1) {
diff -r ba0446e8ac19 -r 6e44e8962a31 src/solaris/native/sun/security/krb5/internal/ccache/krb5ccache.c
--- a/src/solaris/native/sun/security/krb5/internal/ccache/krb5ccache.c Fri Sep 27 20:53:43 2013 +0100
+++ b/src/solaris/native/sun/security/krb5/internal/ccache/krb5ccache.c Mon Sep 16 15:43:06 2013 -0400
@@ -23,7 +23,9 @@
* questions.
*/
+#ifndef _GNU_SOURCE
#define _GNU_SOURCE
+#endif
#include <krb5.h>
#include <stdlib.h>
diff -r ba0446e8ac19 -r 6e44e8962a31 test/com/sun/crypto/provider/TLS/TestLeadingZeroes.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/crypto/provider/TLS/TestLeadingZeroes.java Mon Sep 16 15:43:06 2013 -0400
@@ -0,0 +1,420 @@
+/*
+ * Copyright (c) 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
+ * 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 8014618
+ * @summary Need to strip leading zeros in TlsPremasterSecret of DHKeyAgreement
+ * @author Pasi Eronen
+ */
+
+import java.io.*;
+import java.security.*;
+import java.security.spec.*;
+import java.security.interfaces.*;
+import javax.crypto.*;
+import javax.crypto.spec.*;
+import javax.crypto.interfaces.*;
+import com.sun.crypto.provider.SunJCE;
+
+/**
+ * Test that leading zeroes are stripped in TlsPremasterSecret case,
+ * but are left as-is in other cases.
+ *
+ * We use pre-generated keypairs, since with randomly generated keypairs,
+ * a leading zero happens only (roughly) 1 out of 256 cases.
+ */
+
+public class TestLeadingZeroes {
+
+ private static final String SUNJCE = "SunJCE";
+
+ private TestLeadingZeroes() {}
+
+ public static void main(String argv[]) throws Exception {
+ // Add JCE to the list of providers
+ SunJCE jce = new SunJCE();
+ Security.addProvider(jce);
+
+ TestLeadingZeroes keyAgree = new TestLeadingZeroes();
+ keyAgree.run();
+ System.out.println("Test Passed");
+ }
+
+ private void run() throws Exception {
+
+ // decode pre-generated keypairs
More information about the distro-pkg-dev
mailing list