diff options
Diffstat (limited to 'libjava/classpath')
50 files changed, 472 insertions, 158 deletions
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index b76807c..169c2f6 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,10 +1,96 @@ +2009-02-05 Andrew John Hughes <ahughes@redhat.com> + + * NEWS: Add VM updates. + +2009-02-05 Andrew John Hughes <ahughes@redhat.com> + + * NEWS: Updated. + * configure.ac: + Bump to 0.98 proper. + 2009-02-05 Andrew Haley <aph@redhat.com> + PR libgcj/38861 * native/plugin/gcjwebplugin.cc: Cope with the changed header file format. https://bugzilla.mozilla.org/show_bug.cgi?id=455458 (GCJ_GetJavaClass): Likewise. (NP_Initialize): Likewise. +2009-02-05 Mark Wielaard <mark@klomp.org> + + PR classpath/38912: + * gnu/xml/stream/XMLParser.java: + (getLocalName()): Respect stringInterning. + (getName()): Likewise. + (getPrefix()): Likewise. + +2009-02-04 Andrew John Hughes <ahughes@redhat.com> + + * native/jni/native-lib/cpproc.c: + (cpproc_forkAndExec): Don't return on a -1 + result from chdir as this may be valid in + some cases. A better fix is needed. + +2009-02-03 Andrew John Hughes <ahughes@redhat.com> + + * native/jni/native-lib/cpproc.c: + (cpproc_forkAndExec): Handle return of + chdir. + +2009-02-03 Andrew John Hughes <ahughes@redhat.com> + + PR classpath/38417: + * gnu/java/security/jce/prng/SecureRandomAdapter.java: + Remove unneeded import. + * gnu/javax/crypto/jce/prng/FortunaImpl.java: + Fix typo. + * java/security/SecureRandom.java: + Remove duplicate use of VMSecureRandom, + call SecureRandomAdapter instead. + * vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java: + Moved from java/security so SecureRandomAdapter can + access it. + +2009-01-22 Mario Torre <neugens@aicas.com> + + PR classpath/38417: + * gnu/java/security/jce/prng/SecureRandomAdapter.java: + (getSeed(int)): New; retrieve seed from source specified + by securerandom.source property or failing that, use + VMSecureRandom. + * gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java: + (engineGenerateSeed(int)): Use SecureRandomAdapter. + (engineNextBytes(byte[])): Initialise using new seed. + * gnu/javax/crypto/jce/prng/CSPRNGSpi.java: + (engineGenerateSeed(int)): Use SecureRandomAdapter. + (engineNextBytes(byte[])): Initialise using new seed. + * gnu/javax/crypto/jce/prng/FortunaImpl.java: + (engineSetSeed(byte[])): Initialise with new seed if unused. + (engineGenerateSeed(int)): Use SecureRandomAdapter. + * gnu/javax/crypto/jce/prng/ICMRandomSpi.java: + (engineGenerateSeed(int)): Use SecureRandomAdapter. + (engineNextBytes(byte[])): Initialise using new seed. + * gnu/javax/crypto/jce/prng/UMacRandomSpi.java: + (engineGenerateSeed(int)): Use SecureRandomAdapter. + (engineNextBytes(byte[])): Initialise using new seed. + * gnu/javax/crypto/prng/ICMGenerator.java: + (setup(Map)): Call fillBlock(). + +2009-01-22 Mark Wielaard <mark@klomp.org> + + * tools/gnu/classpath/tools/gjdoc/Main.java (getGjdocVersion): + Read version.properties from package. + +2009-01-05 Robert Schuster <robertschuster@fsfe.org> + + * gnu/java/awt/peer/gtk/CairoGraphics2D.java: + (drawPolyline): Rewritten. + +2009-01-05 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * Makefile.am: + Add ChangeLog-2008 to EXTRA_DIST. + 2009-01-02 Andrew John Hughes <gnu_andrew@member.fsf.org> * ChangeLog-2008: New file. diff --git a/libjava/classpath/Makefile.am b/libjava/classpath/Makefile.am index af47684..454b2e9 100644 --- a/libjava/classpath/Makefile.am +++ b/libjava/classpath/Makefile.am @@ -14,7 +14,7 @@ native: lib EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE ChangeLog-2007 \ ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \ - autogen.sh + autogen.sh ChangeLog-2008 DISTCHECK_CONFIGURE_FLAGS = --with-gjdoc --enable-gstreamer-peer \ --enable-xmlj --enable-qt-peer diff --git a/libjava/classpath/Makefile.in b/libjava/classpath/Makefile.in index dcc346b..35f1dd7 100644 --- a/libjava/classpath/Makefile.in +++ b/libjava/classpath/Makefile.in @@ -395,7 +395,7 @@ ACLOCAL_AMFLAGS = -I m4 -I ../.. -I ../../config ${LOCAL_AUTORECONF_FLAGS} EXTRA_DIST = HACKING BUGS THANKYOU mauve-classpath LICENSE ChangeLog-2007 \ ChangeLog-2003 ChangeLog-2004 ChangeLog-2005 ChangeLog-2006 \ ChangeLog.gnujaxp.1 ChangeLog.gnujaxp.2 ChangeLog.libxmlj \ - autogen.sh + autogen.sh ChangeLog-2008 DISTCHECK_CONFIGURE_FLAGS = --with-gjdoc --enable-gstreamer-peer \ --enable-xmlj --enable-qt-peer diff --git a/libjava/classpath/NEWS b/libjava/classpath/NEWS index 4be4d60..4ae10d71 100644 --- a/libjava/classpath/NEWS +++ b/libjava/classpath/NEWS @@ -1,4 +1,4 @@ -New in release 0.98 +New in release 0.98 (Feb 05, 2009) * Native support for BigInteger is now provided using the GMP library. A new option, --enable/disable-gmp is provided, and @@ -11,8 +11,41 @@ always retain their own array, which is only altered during resizing, CPStringBuilder gives away its array when the result is generated by toString()/substring() and starts afresh. The default capacity of CPStringBuilder can also be configured using the -gnu.classpath.cpstringbuilder.capacity property. +gnu.classpath.cpstringbuilder.capacity property. (PR21869) * gjdoc is now built as part of tools.zip. +* Import of the Java Activation Framework from ClasspathX to provide +javax.activation (part of 1.6). +* Preliminary version of java.util.Scanner (PR30436) +* Reduce cost of ThreadLocal(s) to improve Jython performance (PR33690) +* Updated to use CLDR 1.5.1 (PR35237) +* Many bug fixes including: + - PR22851: zoneStrings in gnu/java/locale/LocaleInformation* + - PR31895: setCurrency(Currency) does not actually change the currency. + - PR32028: Make fails at gjdoc + - PR34840: Mismatch between Sun and Classpath's java.lang.Appendable + - PR35487: gcj causes ConcurrentModificationException during tomcat5 + - PR35690: javax.tools.FileObject.toUri is in wrong case + - PR36085: java.util.regex escape-sequence handling + - PR36147: Apache Tomcat fails to read descriptors using GNU XML + - PR36219: gnu.xml.transform.SortKey isn't subclass + - PR36220: NPEs in gnu.xml.transform.* clone methods + - PR36221: DomDOMException running SPEC jvm 2008 xml.transform + - PR36477: OOME in CPStringBuilder when running Eclipse + - PR36522: Policy file is not read at all + - PR36636: gjar -u doesn't work + - PR36637: --without-fastjar doesn't wor + - PR36677: Omission bug in JDWP VirtualMachineCommandSet + - PR38417: gnu.java.security.util.PRNG produces easily predictable values + - PR38473: Segmentation fault in retrieving font outline decomposition + - PR38861: Support XULRunner 1.9.1. + - PR38912: XMLParser not interning element names + +Runtime interface changes: + + * VMSecureRandom has moved to gnu.java.security.jce.prng.VMSecureRandom + as part of the fix for PR38417. + * gnu.java.lang.VMCPStringBuilder has been added and should be added to + avoid the inefficency of reflection when creating non-copied String objects. Bug fixes in release 0.97.2 (Jun 06, 2007) diff --git a/libjava/classpath/config.guess b/libjava/classpath/config.guess index c7607c7..aeb5323 100755 --- a/libjava/classpath/config.guess +++ b/libjava/classpath/config.guess @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. -timestamp='2008-04-14' +timestamp='2008-12-18' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -331,7 +331,20 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize @@ -796,7 +809,7 @@ EOF x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; - EM64T | authenticamd) + EM64T | authenticamd | genuineintel) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) @@ -935,6 +948,9 @@ EOF if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in diff --git a/libjava/classpath/config.sub b/libjava/classpath/config.sub index 63bfff0..9489dc7 100755 --- a/libjava/classpath/config.sub +++ b/libjava/classpath/config.sub @@ -4,7 +4,7 @@ # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 # Free Software Foundation, Inc. -timestamp='2008-04-14' +timestamp='2008-12-11' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -249,6 +249,7 @@ case $basic_machine in | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ + | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ @@ -279,7 +280,7 @@ case $basic_machine in | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | score \ - | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -288,7 +289,7 @@ case $basic_machine in | v850 | v850e \ | we32k \ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ - | z8k) + | z8k | z80) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -331,6 +332,7 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ + | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ @@ -362,7 +364,7 @@ case $basic_machine in | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ @@ -375,7 +377,7 @@ case $basic_machine in | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ - | z8k-*) + | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) @@ -463,6 +465,10 @@ case $basic_machine in basic_machine=c90-cray os=-unicos ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; convex-c1) basic_machine=c1-convex os=-bsd @@ -1136,6 +1142,10 @@ case $basic_machine in basic_machine=z8k-unknown os=-sim ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1174,7 +1184,7 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) @@ -1256,7 +1266,7 @@ case $os in | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ diff --git a/libjava/classpath/configure b/libjava/classpath/configure index 8a4c6b1..8f520cd 100755 --- a/libjava/classpath/configure +++ b/libjava/classpath/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for GNU Classpath 0.98-pre. +# Generated by GNU Autoconf 2.59 for GNU Classpath 0.98. # # Report bugs to <classpath@gnu.org>. # @@ -418,8 +418,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='GNU Classpath' PACKAGE_TARNAME='classpath' -PACKAGE_VERSION='0.98-pre' -PACKAGE_STRING='GNU Classpath 0.98-pre' +PACKAGE_VERSION='0.98' +PACKAGE_STRING='GNU Classpath 0.98' PACKAGE_BUGREPORT='classpath@gnu.org' ac_unique_file="java/lang/System.java" @@ -943,7 +943,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU Classpath 0.98-pre to adapt to many kinds of systems. +\`configure' configures GNU Classpath 0.98 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1014,7 +1014,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU Classpath 0.98-pre:";; + short | recursive ) echo "Configuration of GNU Classpath 0.98:";; esac cat <<\_ACEOF @@ -1231,7 +1231,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -GNU Classpath configure 0.98-pre +GNU Classpath configure 0.98 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1245,7 +1245,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU Classpath $as_me 0.98-pre, which was +It was created by GNU Classpath $as_me 0.98, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -2117,7 +2117,7 @@ fi # Define the identity of the package. PACKAGE='classpath' - VERSION='0.98-pre' + VERSION='0.98' cat >>confdefs.h <<_ACEOF @@ -30773,7 +30773,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by GNU Classpath $as_me 0.98-pre, which was +This file was extended by GNU Classpath $as_me 0.98, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -30839,7 +30839,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -GNU Classpath config.status 0.98-pre +GNU Classpath config.status 0.98 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/libjava/classpath/configure.ac b/libjava/classpath/configure.ac index b3187cc..faf3ab7 100644 --- a/libjava/classpath/configure.ac +++ b/libjava/classpath/configure.ac @@ -6,7 +6,7 @@ dnl ----------------------------------------------------------- dnl define([AC_CACHE_LOAD], )dnl dnl define([AC_CACHE_SAVE], )dnl -AC_INIT([GNU Classpath],[0.98-pre],[classpath@gnu.org],[classpath]) +AC_INIT([GNU Classpath],[0.98],[classpath@gnu.org],[classpath]) AC_CONFIG_SRCDIR(java/lang/System.java) dnl GCJ LOCAL diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java index bc8c91a..8f8d7ea 100644 --- a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java +++ b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java @@ -1246,7 +1246,9 @@ public abstract class CairoGraphics2D extends Graphics2D public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) { - draw(new Polygon(xPoints, yPoints, nPoints)); + for (int i = 1; i < nPoints; i++) + draw(new Line2D.Double(xPoints[i - 1], yPoints[i - 1], + xPoints[i], yPoints[i])); } public void drawOval(int x, int y, int width, int height) diff --git a/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java b/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java index 5be402f..5877e3e 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java +++ b/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java @@ -38,35 +38,57 @@ exception statement from your version. */ package gnu.java.security.jce.prng; +import gnu.java.security.action.GetSecurityPropertyAction; +import gnu.classpath.SystemProperties; import gnu.java.security.prng.LimitReachedException; import gnu.java.security.prng.MDGenerator; +import java.security.AccessController; +import java.security.SecureRandom; import java.security.SecureRandomSpi; + import java.util.Collections; +import java.util.logging.Level; +import java.util.logging.Logger; + +import java.io.InputStream; +import java.io.IOException; + +import java.net.MalformedURLException; +import java.net.URL; /** - * The implementation of a generic {@link java.security.SecureRandom} adapter - * class to wrap GNU PRNG instances based on Message Digest algorithms. - * <p> - * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for + * <p>The implementation of a generic {@link java.security.SecureRandom} adapter + * class to wrap gnu.crypto prng instances based on Message Digest algorithms.</p> + * + * <p>This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for * the {@link java.security.SecureRandom} class, which provides the - * functionality of a cryptographically strong pseudo-random number generator. - * <p> - * All the abstract methods in the {@link SecureRandomSpi} class are implemented - * by this class and all its sub-classes. + * functionality of a cryptographically strong pseudo-random number generator.</p> + * + * <p>All the abstract methods in the {@link SecureRandomSpi} class are + * implemented by this class and all its sub-classes.</p> */ -abstract class SecureRandomAdapter - extends SecureRandomSpi +public abstract class SecureRandomAdapter + extends SecureRandomSpi { + + private boolean isSeeded = false; + /** Our underlying prng instance. */ private MDGenerator adaptee = new MDGenerator(); /** The name of the message digest algorithm used by the adaptee. */ private String mdName; + private static final Logger logger = + Logger.getLogger(SecureRandom.class.getName()); + + private static final String SECURERANDOM_SOURCE = "securerandom.source"; + private static final String JAVA_SECURITY_EGD = "java.security.egd"; + /** - * Trivial protected constructor. - * + * <p>Trivial protected constructor.</p> + * * @param mdName the canonical name of the underlying hash algorithm. */ protected SecureRandomAdapter(String mdName) @@ -74,23 +96,77 @@ abstract class SecureRandomAdapter super(); this.mdName = mdName; - adaptee.init(Collections.singletonMap(MDGenerator.MD_NAME, mdName)); + adaptee.init (Collections.singletonMap (MDGenerator.MD_NAME, mdName)); + } + + public static final byte[] getSeed(int numBytes) + { + URL sourceUrl = null; + String urlStr = null; + + byte[] buffer = new byte[numBytes]; + + GetSecurityPropertyAction action = + new GetSecurityPropertyAction(SECURERANDOM_SOURCE); + try + { + urlStr = (String) AccessController.doPrivileged(action); + if (urlStr != null) + sourceUrl = new URL(urlStr); + } + catch (MalformedURLException ignored) + { + logger.log(Level.WARNING, + SECURERANDOM_SOURCE + " property is malformed: {0}", + urlStr); + } + + if (sourceUrl == null) + { + try + { + urlStr = SystemProperties.getProperty(JAVA_SECURITY_EGD); + if (urlStr != null) + sourceUrl = new URL(urlStr); + } + catch (MalformedURLException mue) + { + logger.log(Level.WARNING, + JAVA_SECURITY_EGD + " property is malformed: {0}", + urlStr); + } + } + + if (sourceUrl != null) + { + try + { + InputStream in = sourceUrl.openStream(); + in.read(buffer); + return buffer; + } + catch (IOException ioe) + { + logger.log(Level.FINE, "error reading random bytes", ioe); + } + } + + // If we get here, we did not get any seed from a property URL. + VMSecureRandom.generateSeed(buffer, 0, buffer.length); + return buffer; } public byte[] engineGenerateSeed(int numBytes) { - if (numBytes < 1) - return new byte[0]; - - byte[] result = new byte[numBytes]; - this.engineNextBytes(result); - return result; + return getSeed(numBytes); } public void engineNextBytes(byte[] bytes) { - if (! adaptee.isInitialised()) - this.engineSetSeed(new byte[0]); + if (!isSeeded) + { + engineSetSeed(engineGenerateSeed(32)); + } try { adaptee.nextBytes(bytes, 0, bytes.length); @@ -102,6 +178,7 @@ abstract class SecureRandomAdapter public void engineSetSeed(byte[] seed) { - adaptee.addRandomBytes(seed); + adaptee.addRandomBytes (seed); + isSeeded = true; } } diff --git a/libjava/classpath/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java b/libjava/classpath/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java index 652793b..1129d5d 100644 --- a/libjava/classpath/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java +++ b/libjava/classpath/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java @@ -39,12 +39,17 @@ exception statement from your version. */ package gnu.javax.crypto.jce.prng; import gnu.java.security.Registry; -import gnu.javax.crypto.prng.ARCFour; + +import gnu.java.security.jce.prng.SecureRandomAdapter; + import gnu.java.security.prng.IRandom; import gnu.java.security.prng.LimitReachedException; + +import gnu.javax.crypto.prng.ARCFour; import gnu.javax.crypto.prng.PRNGFactory; import java.security.SecureRandomSpi; + import java.util.HashMap; /** @@ -71,17 +76,13 @@ public class ARCFourRandomSpi public byte[] engineGenerateSeed(int numBytes) { - if (numBytes < 1) - return new byte[0]; - byte[] result = new byte[numBytes]; - this.engineNextBytes(result); - return result; + return SecureRandomAdapter.getSeed(numBytes); } public void engineNextBytes(byte[] bytes) { if (virgin) - this.engineSetSeed(new byte[0]); + this.engineSetSeed(engineGenerateSeed(32)); try { adaptee.nextBytes(bytes, 0, bytes.length); diff --git a/libjava/classpath/gnu/javax/crypto/jce/prng/CSPRNGSpi.java b/libjava/classpath/gnu/javax/crypto/jce/prng/CSPRNGSpi.java index 6ded636..96d66f0 100644 --- a/libjava/classpath/gnu/javax/crypto/jce/prng/CSPRNGSpi.java +++ b/libjava/classpath/gnu/javax/crypto/jce/prng/CSPRNGSpi.java @@ -40,6 +40,7 @@ package gnu.javax.crypto.jce.prng; import gnu.java.security.prng.IRandom; import gnu.java.security.prng.LimitReachedException; +import gnu.java.security.jce.prng.SecureRandomAdapter; import gnu.javax.crypto.prng.CSPRNG; import java.net.MalformedURLException; @@ -53,6 +54,7 @@ public class CSPRNGSpi extends SecureRandomSpi { private final IRandom adaptee; + private boolean virgin = true; public CSPRNGSpi() throws ClassNotFoundException, MalformedURLException, NumberFormatException @@ -62,21 +64,19 @@ public class CSPRNGSpi adaptee = CSPRNG.getSystemInstance(); } - protected byte[] engineGenerateSeed(final int count) + protected byte[] engineGenerateSeed(final int numBytes) { - if (count < 0) - throw new IllegalArgumentException("count must be nonnegative"); - byte[] buf = new byte[count]; - if (count == 0) - return buf; - engineNextBytes(buf); - return buf; + return SecureRandomAdapter.getSeed(numBytes); } protected void engineNextBytes(final byte[] buffer) { if (buffer == null) throw new NullPointerException(); + if (virgin) + { + engineSetSeed(engineGenerateSeed(32)); + } try { adaptee.nextBytes(buffer, 0, buffer.length); @@ -92,5 +92,6 @@ public class CSPRNGSpi if (seed == null) throw new NullPointerException(); adaptee.addRandomBytes(seed, 0, seed.length); + virgin = false; } } diff --git a/libjava/classpath/gnu/javax/crypto/jce/prng/FortunaImpl.java b/libjava/classpath/gnu/javax/crypto/jce/prng/FortunaImpl.java index 8e3782e..b18410c 100644 --- a/libjava/classpath/gnu/javax/crypto/jce/prng/FortunaImpl.java +++ b/libjava/classpath/gnu/javax/crypto/jce/prng/FortunaImpl.java @@ -39,6 +39,9 @@ exception statement from your version. */ package gnu.javax.crypto.jce.prng; import gnu.java.security.prng.LimitReachedException; + +import gnu.java.security.jce.prng.SecureRandomAdapter; + import gnu.javax.crypto.prng.Fortuna; import java.security.SecureRandomSpi; @@ -47,19 +50,27 @@ import java.util.Collections; public final class FortunaImpl extends SecureRandomSpi { + private boolean virgin = true; private final Fortuna adaptee; public FortunaImpl() { adaptee = new Fortuna(); - adaptee.init(Collections.singletonMap(Fortuna.SEED, new byte[0])); } protected void engineSetSeed(byte[] seed) { synchronized (adaptee) { - adaptee.addRandomBytes(seed); + if (virgin) + { + adaptee.init (Collections.singletonMap (Fortuna.SEED, seed)); + virgin = false; + } + else + { + adaptee.addRandomBytes (seed); + } } } @@ -67,6 +78,10 @@ public final class FortunaImpl { synchronized (adaptee) { + if (virgin) + { + this.engineSetSeed(engineGenerateSeed(32)); + } try { adaptee.nextBytes(buffer); @@ -78,10 +93,8 @@ public final class FortunaImpl } } - protected byte[] engineGenerateSeed(int numbytes) + protected byte[] engineGenerateSeed(int numBytes) { - byte[] seed = new byte[numbytes]; - engineNextBytes(seed); - return seed; + return SecureRandomAdapter.getSeed(numBytes); } } diff --git a/libjava/classpath/gnu/javax/crypto/jce/prng/ICMRandomSpi.java b/libjava/classpath/gnu/javax/crypto/jce/prng/ICMRandomSpi.java index 9855f95..a02fd14 100644 --- a/libjava/classpath/gnu/javax/crypto/jce/prng/ICMRandomSpi.java +++ b/libjava/classpath/gnu/javax/crypto/jce/prng/ICMRandomSpi.java @@ -40,6 +40,7 @@ package gnu.javax.crypto.jce.prng; import gnu.java.security.Configuration; import gnu.java.security.Registry; +import gnu.java.security.jce.prng.SecureRandomAdapter; import gnu.java.security.prng.LimitReachedException; import gnu.javax.crypto.cipher.IBlockCipher; import gnu.javax.crypto.prng.ICMGenerator; @@ -107,19 +108,7 @@ public class ICMRandomSpi public byte[] engineGenerateSeed(int numBytes) { - if (Configuration.DEBUG) - log.entering(this.getClass().getName(), "engineGenerateSeed"); - if (numBytes < 1) - { - if (Configuration.DEBUG) - log.exiting(this.getClass().getName(), "engineGenerateSeed"); - return new byte[0]; - } - byte[] result = new byte[numBytes]; - this.engineNextBytes(result); - if (Configuration.DEBUG) - log.exiting(this.getClass().getName(), "engineGenerateSeed"); - return result; + return SecureRandomAdapter.getSeed(numBytes); } public void engineNextBytes(byte[] bytes) @@ -127,7 +116,7 @@ public class ICMRandomSpi if (Configuration.DEBUG) log.entering(this.getClass().getName(), "engineNextBytes"); if (! adaptee.isInitialised()) - this.engineSetSeed(new byte[0]); + this.engineSetSeed(engineGenerateSeed(32)); while (true) { try @@ -207,8 +196,8 @@ public class ICMRandomSpi System.arraycopy(material, 16, offset, 0, 16); attributes.put(ICMGenerator.OFFSET, offset); // specify the index - byte[] index = new byte[8]; - System.arraycopy(material, 32, index, 0, 8); + byte[] index = new byte[4]; + System.arraycopy(material, 32, index, 0, 4); attributes.put(ICMGenerator.SEGMENT_INDEX, new BigInteger(1, index)); adaptee.init(attributes); if (Configuration.DEBUG) diff --git a/libjava/classpath/gnu/javax/crypto/jce/prng/UMacRandomSpi.java b/libjava/classpath/gnu/javax/crypto/jce/prng/UMacRandomSpi.java index f6949dd..2faebe8 100644 --- a/libjava/classpath/gnu/javax/crypto/jce/prng/UMacRandomSpi.java +++ b/libjava/classpath/gnu/javax/crypto/jce/prng/UMacRandomSpi.java @@ -41,6 +41,7 @@ package gnu.javax.crypto.jce.prng; import gnu.java.security.Configuration; import gnu.java.security.Registry; import gnu.java.security.prng.LimitReachedException; +import gnu.java.security.jce.prng.SecureRandomAdapter; import gnu.javax.crypto.cipher.IBlockCipher; import gnu.javax.crypto.prng.UMacGenerator; @@ -57,6 +58,7 @@ public class UMacRandomSpi extends SecureRandomSpi { private static final Logger log = Logger.getLogger(UMacRandomSpi.class.getName()); + /** Class-wide prng to generate random material for the underlying prng. */ private static final UMacGenerator prng; // blank final static @@ -88,17 +90,13 @@ public class UMacRandomSpi public byte[] engineGenerateSeed(int numBytes) { - if (numBytes < 1) - return new byte[0]; - byte[] result = new byte[numBytes]; - this.engineNextBytes(result); - return result; + return SecureRandomAdapter.getSeed(numBytes); } public void engineNextBytes(byte[] bytes) { if (! adaptee.isInitialised()) - this.engineSetSeed(new byte[0]); + engineSetSeed(engineGenerateSeed(32)); while (true) { try diff --git a/libjava/classpath/gnu/javax/crypto/prng/ICMGenerator.java b/libjava/classpath/gnu/javax/crypto/prng/ICMGenerator.java index 5b0bd4f..d8205cf 100644 --- a/libjava/classpath/gnu/javax/crypto/prng/ICMGenerator.java +++ b/libjava/classpath/gnu/javax/crypto/prng/ICMGenerator.java @@ -263,6 +263,15 @@ public class ICMGenerator // C[0] = (s * (256^BLOCK_INDEX_LENGTH) + r) modulo (256^BLOCK_LENGTH) C0 = segmentNdx.multiply(TWO_FIFTY_SIX.pow(blockNdxLength)) .add(r).modPow(BigInteger.ONE, counterRange); + try + { + fillBlock(); + } + catch (LimitReachedException impossible) + { + throw (InternalError) + new InternalError().initCause(impossible); + } } public void fillBlock() throws LimitReachedException diff --git a/libjava/classpath/gnu/xml/stream/XMLParser.java b/libjava/classpath/gnu/xml/stream/XMLParser.java index 27aaa73..6072a9c 100644 --- a/libjava/classpath/gnu/xml/stream/XMLParser.java +++ b/libjava/classpath/gnu/xml/stream/XMLParser.java @@ -725,7 +725,10 @@ public class XMLParser case XMLStreamConstants.END_ELEMENT: String qName = buf.toString(); int ci = qName.indexOf(':'); - return (ci == -1) ? qName : qName.substring(ci + 1); + String localName = (ci == -1) ? qName : qName.substring(ci + 1); + if (stringInterning) + localName = localName.intern(); + return localName; default: return null; } @@ -745,9 +748,13 @@ public class XMLParser String qName = buf.toString(); int ci = qName.indexOf(':'); String localName = (ci == -1) ? qName : qName.substring(ci + 1); + if (stringInterning) + localName = localName.intern(); String prefix = (ci == -1) ? (namespaceAware ? XMLConstants.DEFAULT_NS_PREFIX : null) : qName.substring(0, ci); + if (stringInterning && prefix != null) + prefix = prefix.intern(); String namespaceURI = getNamespaceURI(prefix); return new QName(namespaceURI, localName, prefix); default: @@ -831,9 +838,12 @@ public class XMLParser case XMLStreamConstants.END_ELEMENT: String qName = buf.toString(); int ci = qName.indexOf(':'); - return (ci == -1) ? + String prefix = (ci == -1) ? (namespaceAware ? XMLConstants.DEFAULT_NS_PREFIX : null) : qName.substring(0, ci); + if (stringInterning && prefix != null) + prefix = prefix.intern(); + return prefix; default: return null; } diff --git a/libjava/classpath/java/security/SecureRandom.java b/libjava/classpath/java/security/SecureRandom.java index f965782..0c71838 100644 --- a/libjava/classpath/java/security/SecureRandom.java +++ b/libjava/classpath/java/security/SecureRandom.java @@ -42,6 +42,7 @@ import gnu.classpath.SystemProperties; import gnu.java.lang.CPStringBuilder; import gnu.java.security.Engine; import gnu.java.security.action.GetSecurityPropertyAction; +import gnu.java.security.jce.prng.SecureRandomAdapter; import gnu.java.security.jce.prng.Sha160RandomSpi; import java.io.IOException; @@ -401,9 +402,7 @@ public class SecureRandom extends Random */ public static byte[] getSeed(int numBytes) { - byte[] tmp = new byte[numBytes]; - generateSeed(tmp); - return tmp; + return SecureRandomAdapter.getSeed(numBytes); } /** @@ -418,64 +417,4 @@ public class SecureRandom extends Random return secureRandomSpi.engineGenerateSeed(numBytes); } - // Seed methods. - - private static final String SECURERANDOM_SOURCE = "securerandom.source"; - private static final String JAVA_SECURITY_EGD = "java.security.egd"; - private static final Logger logger = Logger.getLogger(SecureRandom.class.getName()); - - private static int generateSeed(byte[] buffer) - { - return generateSeed(buffer, 0, buffer.length); - } - - private static int generateSeed(byte[] buffer, int offset, int length) - { - URL sourceUrl = null; - String urlStr = null; - - GetSecurityPropertyAction action = new GetSecurityPropertyAction(SECURERANDOM_SOURCE); - try - { - urlStr = (String) AccessController.doPrivileged(action); - if (urlStr != null) - sourceUrl = new URL(urlStr); - } - catch (MalformedURLException ignored) - { - logger.log(Level.WARNING, SECURERANDOM_SOURCE + " property is malformed: {0}", - urlStr); - } - - if (sourceUrl == null) - { - try - { - urlStr = SystemProperties.getProperty(JAVA_SECURITY_EGD); - if (urlStr != null) - sourceUrl = new URL(urlStr); - } - catch (MalformedURLException mue) - { - logger.log(Level.WARNING, JAVA_SECURITY_EGD + " property is malformed: {0}", - urlStr); - } - } - - if (sourceUrl != null) - { - try - { - InputStream in = sourceUrl.openStream(); - return in.read(buffer, offset, length); - } - catch (IOException ioe) - { - logger.log(Level.FINE, "error reading random bytes", ioe); - } - } - - // If we get here, we did not get any seed from a property URL. - return VMSecureRandom.generateSeed(buffer, offset, length); - } } diff --git a/libjava/classpath/lib/gnu/classpath/Configuration.class b/libjava/classpath/lib/gnu/classpath/Configuration.class Binary files differindex 1b3fe05..27c31f2 100644 --- a/libjava/classpath/lib/gnu/classpath/Configuration.class +++ b/libjava/classpath/lib/gnu/classpath/Configuration.class diff --git a/libjava/classpath/lib/gnu/classpath/SystemProperties.class b/libjava/classpath/lib/gnu/classpath/SystemProperties.class Binary files differindex b430d07..b035930 100644 --- a/libjava/classpath/lib/gnu/classpath/SystemProperties.class +++ b/libjava/classpath/lib/gnu/classpath/SystemProperties.class diff --git a/libjava/classpath/lib/gnu/gcj/convert/Convert.class b/libjava/classpath/lib/gnu/gcj/convert/Convert.class Binary files differindex 89dc455..15917db 100644 --- a/libjava/classpath/lib/gnu/gcj/convert/Convert.class +++ b/libjava/classpath/lib/gnu/gcj/convert/Convert.class diff --git a/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class b/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class Binary files differindex 10f6cb3..a11c8f9 100644 --- a/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class +++ b/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class diff --git a/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class b/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class Binary files differindex 6e09628..017314c 100644 --- a/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class +++ b/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class diff --git a/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class b/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class Binary files differindex 95e7210..d8b3cae 100644 --- a/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class +++ b/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class diff --git a/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class b/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class Binary files differindex 7bacedb..c781278 100644 --- a/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class +++ b/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class Binary files differindex 1adddb1..6993b3a 100644 --- a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class +++ b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class Binary files differindex c10db7a..b73add5 100644 --- a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class +++ b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class Binary files differindex 817c972..bf61fb4 100644 --- a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class +++ b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class Binary files differindex 747f0032..5fca78e 100644 --- a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class +++ b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class Binary files differindex 2147731..9c760ea 100644 --- a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class +++ b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class diff --git a/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class b/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class Binary files differindex 9c38cdf..53776d6 100644 --- a/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class +++ b/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class Binary files differindex 7e64954..31381bd 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class Binary files differindex 45f6ab8..bc9f56c 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class Binary files differindex f0ca4f0..7c578d4 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class Binary files differindex 86cba0f..5d2f991 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class Binary files differindex cd7acfe..4ced061 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class Binary files differindex 3c17511..f05bfca 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class Binary files differindex 5eeed5a..5ee2d8c 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class Binary files differindex 0275f80..64ba557 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class Binary files differindex e2d9b96..97ac508 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class Binary files differindex 0a37ec3..2e283ae 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class Binary files differindex 28888f6..f5309b0 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser.class Binary files differindex f9f823a..84113a5 100644 --- a/libjava/classpath/lib/gnu/xml/stream/XMLParser.class +++ b/libjava/classpath/lib/gnu/xml/stream/XMLParser.class diff --git a/libjava/classpath/lib/java/security/SecureRandom.class b/libjava/classpath/lib/java/security/SecureRandom.class Binary files differindex e99049b..ef74e5a 100644 --- a/libjava/classpath/lib/java/security/SecureRandom.class +++ b/libjava/classpath/lib/java/security/SecureRandom.class diff --git a/libjava/classpath/native/jni/native-lib/cpproc.c b/libjava/classpath/native/jni/native-lib/cpproc.c index bb34f6d..0c80703 100644 --- a/libjava/classpath/native/jni/native-lib/cpproc.c +++ b/libjava/classpath/native/jni/native-lib/cpproc.c @@ -86,7 +86,8 @@ int cpproc_forkAndExec (char * const *commandLine, char * const * newEnviron, close_all_fds(local_fds, pipe_count * 2); - chdir(wd); + i = chdir(wd); + /* FIXME: Handle the return value */ if (newEnviron == NULL) execvp(commandLine[0], commandLine); else diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/common/ClasspathToolParser.class b/libjava/classpath/tools/classes/gnu/classpath/tools/common/ClasspathToolParser.class Binary files differindex 2c8a74d..67c1578 100644 --- a/libjava/classpath/tools/classes/gnu/classpath/tools/common/ClasspathToolParser.class +++ b/libjava/classpath/tools/classes/gnu/classpath/tools/common/ClasspathToolParser.class diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class b/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class Binary files differindex 48b5bc8..1ce24d1 100644 --- a/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class +++ b/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class b/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class Binary files differindex f7c264b..6608af7 100644 --- a/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class +++ b/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java index 6c2c77e..d1316b3 100644 --- a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java +++ b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java @@ -1827,7 +1827,7 @@ public final class Main if (null == gjdocVersion) { try { Properties versionProperties = new Properties(); - versionProperties.load(getClass().getResourceAsStream("/version.properties")); + versionProperties.load(getClass().getResourceAsStream("version.properties")); gjdocVersion = versionProperties.getProperty("gjdoc.version"); } catch (IOException ignore) { diff --git a/libjava/classpath/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java b/libjava/classpath/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java new file mode 100644 index 0000000..28a0210 --- /dev/null +++ b/libjava/classpath/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java @@ -0,0 +1,129 @@ +/* VMSecureRandom.java -- random seed generator. + Copyright (C) 2006 Free Software Foundation, Inc. + +This file is a part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or (at +your option) any later version. + +GNU Classpath 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 for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 +USA + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.security.jce.prng; + +/** + * VM-specific methods for generating real (or almost real) random + * seeds. VM implementors should write a version of this class that + * reads random bytes from some system source. + * + * <p>The default implementation of this class runs eight threads that + * increment counters in a tight loop, and XORs each counter to + * produce one byte of seed data. This is not very efficient, and is + * not guaranteed to be random (the thread scheduler is probably + * deterministic, after all). If possible, VM implementors should + * reimplement this class so it obtains a random seed from a system + * facility, such as a system entropy gathering device or hardware + * random number generator. + */ +final class VMSecureRandom +{ + + /** + * Generate a random seed. Implementations are free to generate + * fewer random bytes than are requested, and leave the remaining + * bytes of the destination buffer as zeros. Implementations SHOULD, + * however, make a best-effort attempt to satisfy the request. + * + * @param buffer The destination buffer. + * @param offset The offset in the buffer to start putting bytes. + * @param length The number of random bytes to generate. + */ + static int generateSeed(byte[] buffer, int offset, int length) + { + if (length < 0) + throw new IllegalArgumentException("length must be nonnegative"); + if (offset < 0 || offset + length > buffer.length) + throw new IndexOutOfBoundsException(); + + Spinner[] spinners = new Spinner[8]; + int n = 0x1; + for (int i = 0; i < spinners.length; i++) + { + spinners[i] = new Spinner((byte) n); + Thread t = new Thread(spinners[i]); + t.start(); + n <<= 1; + } + + // Wait until at least one spinner has started. + while (!(spinners[0].running || spinners[1].running || spinners[2].running + || spinners[3].running || spinners[4].running || spinners[5].running + || spinners[6].running || spinners[7].running)) + { + Thread.yield(); + } + + for (int i = offset; i < length; i++) + { + buffer[i] = (byte) (spinners[0].value ^ spinners[1].value ^ spinners[2].value + ^ spinners[3].value ^ spinners[4].value ^ spinners[5].value + ^ spinners[6].value ^ spinners[7].value); + Thread.yield(); + } + + for (int i = 0; i < spinners.length; i++) + spinners[i].stop(); + + return length; + } + + static class Spinner implements Runnable + { + volatile byte value; + volatile boolean running; + + Spinner(final byte initial) + { + value = initial; + } + + public void run() + { + running = true; + while (running) + value++; + } + + private void stop() + { + running = false; + } + } +}
\ No newline at end of file |