diff options
Diffstat (limited to 'libjava')
66 files changed, 612 insertions, 249 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3cb487a..4eab8c2 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,45 @@ +2009-02-13 Andrew John Hughes <ahughes@redhat.com> + + Import GNU Classpath (classpath-0_98-release). + + * Makefile.am: Add natVMSecureRandom.cc. + * Makefile.in: Regenerated. + * classpath/ChangeLog, + * classpath/Makefile.am: Merged. + * classpath/Makefile.in: Regenerated. + * classpath/NEWS: Merged. + * classpath/config.guess, + * classpath/config.sub, + * classpath/configure: Regenerated. + * classpath/configure.ac: Merged. + * classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java, + * classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java, + * classpath/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java, + * classpath/gnu/javax/crypto/jce/prng/CSPRNGSpi.java, + * classpath/gnu/javax/crypto/jce/prng/FortunaImpl.java, + * classpath/gnu/javax/crypto/jce/prng/ICMRandomSpi.java, + * classpath/gnu/javax/crypto/jce/prng/UMacRandomSpi.java, + * classpath/gnu/javax/crypto/prng/ICMGenerator.java, + * classpath/gnu/xml/stream/XMLParser.java, + * classpath/java/security/SecureRandom.java, + * classpath/native/jni/native-lib/cpproc.c, + * classpath/native/plugin/gcjwebplugin.cc, + * classpath/tools/gnu/classpath/tools/gjdoc/Main.java: Merged. + * configure: Regenerated. + * configure.ac: Add symlink for natVMSecureRandomPosix.cc to natVMSecureRandom.cc + * gnu/classpath/Configuration.java: Change version to 0.98. + * gnu/java/security/jce/prng/SecureRandomAdapter.h: Regenerated. + * gnu/java/security/jce/prng/VMSecureRandom.h: Generated. + * gnu/java/security/jce/prng/VMSecureRandom.java: Added native implementation. + * gnu/java/security/jce/prng/natVMSecureRandomPosix.cc: Wrapper around /dev/random. + * gnu/javax/crypto/jce/prng/CSPRNGSpi.h, + * gnu/javax/crypto/jce/prng/FortunaImpl.h, + * java/security/SecureRandom.h: Regenerated. + * java/security/VMSecureRandom$Spinner.h, + * java/security/VMSecureRandom.h, + * java/security/VMSecureRandom.java: Removed. + * sources.am: Move VMSecureRandom to gnu.java.security.jce.prng. + 2009-02-10 Mark Mitchell <mark@codesourcery.com> * Makefile.am (AM_MAKEFLAGS): Pass down datadir. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 2078a87..4968589 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -1091,6 +1091,7 @@ gnu/java/nio/natVMSelector.cc \ gnu/java/nio/natNIOServerSocket.cc \ gnu/java/nio/natVMChannel.cc \ gnu/java/nio/channels/natFileChannelImpl.cc \ +gnu/java/security/jce/prng/natVMSecureRandom.cc \ java/io/natFile.cc \ java/io/natVMObjectInputStream.cc \ java/io/natVMObjectStreamClass.cc \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index cea890f..c7b2272 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -117,7 +117,8 @@ CONFIG_CLEAN_FILES = libgcj.pc libgcj.spec libgcj-test.spec \ gnu/java/net/natPlainSocketImpl.cc \ gnu/java/net/natPlainDatagramSocketImpl.cc \ gnu/java/nio/natVMPipe.cc gnu/java/nio/natVMSelector.cc \ - gnu/java/nio/channels/natFileChannelImpl.cc sysdep/locks.h \ + gnu/java/nio/channels/natFileChannelImpl.cc \ + gnu/java/security/jce/prng/natVMSecureRandom.cc sysdep/locks.h \ sysdep/backtrace.h sysdep/descriptor.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -342,8 +343,9 @@ am__libgcj_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ gnu/java/nio/natVMPipe.cc gnu/java/nio/natVMSelector.cc \ gnu/java/nio/natNIOServerSocket.cc \ gnu/java/nio/natVMChannel.cc \ - gnu/java/nio/channels/natFileChannelImpl.cc java/io/natFile.cc \ - java/io/natVMObjectInputStream.cc \ + gnu/java/nio/channels/natFileChannelImpl.cc \ + gnu/java/security/jce/prng/natVMSecureRandom.cc \ + java/io/natFile.cc java/io/natVMObjectInputStream.cc \ java/io/natVMObjectStreamClass.cc java/lang/natCharacter.cc \ java/lang/natClass.cc java/lang/natClassLoader.cc \ java/lang/natConcreteProcess.cc java/lang/natVMDouble.cc \ @@ -406,8 +408,9 @@ am__objects_5 = $(am__objects_3) gnu/classpath/natConfiguration.lo \ gnu/java/nio/natVMPipe.lo gnu/java/nio/natVMSelector.lo \ gnu/java/nio/natNIOServerSocket.lo \ gnu/java/nio/natVMChannel.lo \ - gnu/java/nio/channels/natFileChannelImpl.lo java/io/natFile.lo \ - java/io/natVMObjectInputStream.lo \ + gnu/java/nio/channels/natFileChannelImpl.lo \ + gnu/java/security/jce/prng/natVMSecureRandom.lo \ + java/io/natFile.lo java/io/natVMObjectInputStream.lo \ java/io/natVMObjectStreamClass.lo java/lang/natCharacter.lo \ java/lang/natClass.lo java/lang/natClassLoader.lo \ java/lang/natConcreteProcess.lo java/lang/natVMDouble.lo \ @@ -2267,6 +2270,7 @@ classpath/gnu/java/security/jce/prng/Sha256RandomSpi.java \ classpath/gnu/java/security/jce/prng/Sha384RandomSpi.java \ classpath/gnu/java/security/jce/prng/Sha512RandomSpi.java \ classpath/gnu/java/security/jce/prng/TigerRandomSpi.java \ +gnu/java/security/jce/prng/VMSecureRandom.java \ classpath/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java gnu_java_security_jce_prng_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_security_jce_prng_source_files))) @@ -4748,8 +4752,7 @@ classpath/java/security/Signer.java \ classpath/java/security/UnrecoverableKeyException.java \ classpath/java/security/UnresolvedPermission.java \ java/security/VMAccessControlState.java \ -java/security/VMAccessController.java \ -java/security/VMSecureRandom.java +java/security/VMAccessController.java java_security_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_security_source_files))) java_security_acl_source_files = \ @@ -8513,6 +8516,7 @@ gnu/java/nio/natVMSelector.cc \ gnu/java/nio/natNIOServerSocket.cc \ gnu/java/nio/natVMChannel.cc \ gnu/java/nio/channels/natFileChannelImpl.cc \ +gnu/java/security/jce/prng/natVMSecureRandom.cc \ java/io/natFile.cc \ java/io/natVMObjectInputStream.cc \ java/io/natVMObjectStreamClass.cc \ @@ -9006,6 +9010,15 @@ gnu/java/nio/channels/$(DEPDIR)/$(am__dirstamp): gnu/java/nio/channels/natFileChannelImpl.lo: \ gnu/java/nio/channels/$(am__dirstamp) \ gnu/java/nio/channels/$(DEPDIR)/$(am__dirstamp) +gnu/java/security/jce/prng/$(am__dirstamp): + @$(mkdir_p) gnu/java/security/jce/prng + @: > gnu/java/security/jce/prng/$(am__dirstamp) +gnu/java/security/jce/prng/$(DEPDIR)/$(am__dirstamp): + @$(mkdir_p) gnu/java/security/jce/prng/$(DEPDIR) + @: > gnu/java/security/jce/prng/$(DEPDIR)/$(am__dirstamp) +gnu/java/security/jce/prng/natVMSecureRandom.lo: \ + gnu/java/security/jce/prng/$(am__dirstamp) \ + gnu/java/security/jce/prng/$(DEPDIR)/$(am__dirstamp) java/io/$(am__dirstamp): @$(mkdir_p) java/io @: > java/io/$(am__dirstamp) @@ -9471,6 +9484,8 @@ mostlyclean-compile: -rm -f gnu/java/nio/natVMPipe.lo -rm -f gnu/java/nio/natVMSelector.$(OBJEXT) -rm -f gnu/java/nio/natVMSelector.lo + -rm -f gnu/java/security/jce/prng/natVMSecureRandom.$(OBJEXT) + -rm -f gnu/java/security/jce/prng/natVMSecureRandom.lo -rm -f java/io/natFile.$(OBJEXT) -rm -f java/io/natFile.lo -rm -f java/io/natVMObjectInputStream.$(OBJEXT) @@ -9645,6 +9660,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/natVMPipe.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/$(DEPDIR)/natVMSelector.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/nio/channels/$(DEPDIR)/natFileChannelImpl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/security/jce/prng/$(DEPDIR)/natVMSecureRandom.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/io/$(DEPDIR)/natFile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/io/$(DEPDIR)/natVMObjectInputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/io/$(DEPDIR)/natVMObjectStreamClass.Plo@am__quote@ @@ -9951,6 +9967,7 @@ clean-libtool: -rm -rf gnu/java/net/protocol/core/.libs gnu/java/net/protocol/core/_libs -rm -rf gnu/java/nio/.libs gnu/java/nio/_libs -rm -rf gnu/java/nio/channels/.libs gnu/java/nio/channels/_libs + -rm -rf gnu/java/security/jce/prng/.libs gnu/java/security/jce/prng/_libs -rm -rf java/io/.libs java/io/_libs -rm -rf java/lang/.libs java/lang/_libs -rm -rf java/lang/ref/.libs java/lang/ref/_libs @@ -10359,6 +10376,8 @@ distclean-generic: -rm -f gnu/java/nio/$(am__dirstamp) -rm -f gnu/java/nio/channels/$(DEPDIR)/$(am__dirstamp) -rm -f gnu/java/nio/channels/$(am__dirstamp) + -rm -f gnu/java/security/jce/prng/$(DEPDIR)/$(am__dirstamp) + -rm -f gnu/java/security/jce/prng/$(am__dirstamp) -rm -f java/io/$(DEPDIR)/$(am__dirstamp) -rm -f java/io/$(am__dirstamp) -rm -f java/lang/$(DEPDIR)/$(am__dirstamp) @@ -10400,7 +10419,7 @@ clean-am: clean-binPROGRAMS clean-dbexecLTLIBRARIES clean-generic \ distclean: distclean-multi distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) classpath/tools/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/classpath/jdwp/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/jvmti/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/management/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/security/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/concurrent/atomic/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/zip/$(DEPDIR) sun/misc/$(DEPDIR) + -rm -rf ./$(DEPDIR) classpath/tools/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/classpath/jdwp/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/jvmti/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/management/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/security/jce/prng/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/security/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/concurrent/atomic/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/zip/$(DEPDIR) sun/misc/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-local distclean-tags @@ -10433,7 +10452,7 @@ installcheck-am: maintainer-clean: maintainer-clean-multi maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) classpath/tools/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/classpath/jdwp/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/jvmti/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/management/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/security/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/concurrent/atomic/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/zip/$(DEPDIR) sun/misc/$(DEPDIR) + -rm -rf ./$(DEPDIR) classpath/tools/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/classpath/jdwp/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/jvmti/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/management/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/security/jce/prng/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/security/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/concurrent/atomic/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/zip/$(DEPDIR) sun/misc/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic 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/java/security/VMSecureRandom.java b/libjava/classpath/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java index 5eeb158..28a0210 100644 --- a/libjava/java/security/VMSecureRandom.java +++ b/libjava/classpath/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java @@ -36,7 +36,7 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package java.security; +package gnu.java.security.jce.prng; /** * VM-specific methods for generating real (or almost real) random diff --git a/libjava/configure b/libjava/configure index 9b8f52f..7d1baad 100755 --- a/libjava/configure +++ b/libjava/configure @@ -19140,6 +19140,11 @@ test -d gnu/java/nio/channels || mkdir gnu/java/nio/channels ac_config_links="$ac_config_links gnu/java/nio/channels/natFileChannelImpl.cc:gnu/java/nio/channels/natFileChannel${FILE-${PLATFORM}}.cc" +# Likewise for natVMSecureRandom.cc +test -d gnu/java/security/jce/prng || mkdir gnu/java/security/jce/prng + ac_config_links="$ac_config_links gnu/java/security/jce/prng/natVMSecureRandom.cc:gnu/java/security/jce/prng/natVMSecureRandom${FILE-${PLATFORM}}.cc" + + case "${host}" in *mingw*) SYSTEMSPEC="-lgdi32 -lws2_32" @@ -29568,6 +29573,7 @@ do "gnu/java/nio/natVMPipe.cc" ) CONFIG_LINKS="$CONFIG_LINKS gnu/java/nio/natVMPipe.cc:gnu/java/nio/natVMPipe${PLATFORM}.cc" ;; "gnu/java/nio/natVMSelector.cc" ) CONFIG_LINKS="$CONFIG_LINKS gnu/java/nio/natVMSelector.cc:gnu/java/nio/natVMSelector${PLATFORM}.cc" ;; "gnu/java/nio/channels/natFileChannelImpl.cc" ) CONFIG_LINKS="$CONFIG_LINKS gnu/java/nio/channels/natFileChannelImpl.cc:gnu/java/nio/channels/natFileChannel${FILE-${PLATFORM}}.cc" ;; + "gnu/java/security/jce/prng/natVMSecureRandom.cc" ) CONFIG_LINKS="$CONFIG_LINKS gnu/java/security/jce/prng/natVMSecureRandom.cc:gnu/java/security/jce/prng/natVMSecureRandom${FILE-${PLATFORM}}.cc" ;; "include/java-gc.h" ) CONFIG_LINKS="$CONFIG_LINKS include/java-gc.h:include/$GCHDR" ;; "include/java-threads.h" ) CONFIG_LINKS="$CONFIG_LINKS include/java-threads.h:include/$THREADH" ;; "sysdep/locks.h" ) CONFIG_LINKS="$CONFIG_LINKS sysdep/locks.h:sysdep/$sysdeps_dir/locks.h" ;; diff --git a/libjava/configure.ac b/libjava/configure.ac index 8719431..5d9fd1e 100644 --- a/libjava/configure.ac +++ b/libjava/configure.ac @@ -833,6 +833,10 @@ AC_CONFIG_LINKS(gnu/java/nio/natVMSelector.cc:gnu/java/nio/natVMSelector${PLATFO test -d gnu/java/nio/channels || mkdir gnu/java/nio/channels AC_CONFIG_LINKS(gnu/java/nio/channels/natFileChannelImpl.cc:gnu/java/nio/channels/natFileChannel${FILE-${PLATFORM}}.cc) +# Likewise for natVMSecureRandom.cc +test -d gnu/java/security/jce/prng || mkdir gnu/java/security/jce/prng +AC_CONFIG_LINKS(gnu/java/security/jce/prng/natVMSecureRandom.cc:gnu/java/security/jce/prng/natVMSecureRandom${FILE-${PLATFORM}}.cc) + case "${host}" in *mingw*) SYSTEMSPEC="-lgdi32 -lws2_32" diff --git a/libjava/gnu/classpath/Configuration.java b/libjava/gnu/classpath/Configuration.java index 2420878..b0c5733 100644 --- a/libjava/gnu/classpath/Configuration.java +++ b/libjava/gnu/classpath/Configuration.java @@ -66,7 +66,7 @@ public final class Configuration * It is set according to the value of 'version' in the configure[.in] file * and used to set the System property gnu.classpath.version. */ - public static final String CLASSPATH_VERSION = "0.98-pre"; + public static final String CLASSPATH_VERSION = "0.98"; /** * The value of DEBUG is substituted according to whether the diff --git a/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h b/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h index 71b29f7..7495038 100644 --- a/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h +++ b/libjava/gnu/java/security/jce/prng/SecureRandomAdapter.h @@ -39,12 +39,17 @@ class gnu::java::security::jce::prng::SecureRandomAdapter : public ::java::secur public: // actually protected SecureRandomAdapter(::java::lang::String *); public: + static JArray< jbyte > * getSeed(jint); virtual JArray< jbyte > * engineGenerateSeed(jint); virtual void engineNextBytes(JArray< jbyte > *); virtual void engineSetSeed(JArray< jbyte > *); private: - ::gnu::java::security::prng::MDGenerator * __attribute__((aligned(__alignof__( ::java::security::SecureRandomSpi)))) adaptee; + jboolean __attribute__((aligned(__alignof__( ::java::security::SecureRandomSpi)))) isSeeded; + ::gnu::java::security::prng::MDGenerator * adaptee; ::java::lang::String * mdName; + static ::java::util::logging::Logger * logger; + static ::java::lang::String * SECURERANDOM_SOURCE; + static ::java::lang::String * JAVA_SECURITY_EGD; public: static ::java::lang::Class class$; }; diff --git a/libjava/gnu/java/security/jce/prng/VMSecureRandom.h b/libjava/gnu/java/security/jce/prng/VMSecureRandom.h new file mode 100644 index 0000000..b24c805 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/VMSecureRandom.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_security_jce_prng_VMSecureRandom__ +#define __gnu_java_security_jce_prng_VMSecureRandom__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace security + { + namespace jce + { + namespace prng + { + class VMSecureRandom; + } + } + } + } + } +} + +class gnu::java::security::jce::prng::VMSecureRandom : public ::java::lang::Object +{ + +public: // actually package-private + VMSecureRandom(); + static jint generateSeed(JArray< jbyte > *, jint, jint); + static jint natGenerateSeed(JArray< jbyte > *, jint, jint); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_security_jce_prng_VMSecureRandom__ diff --git a/libjava/gnu/java/security/jce/prng/VMSecureRandom.java b/libjava/gnu/java/security/jce/prng/VMSecureRandom.java new file mode 100644 index 0000000..62ff8b7 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/VMSecureRandom.java @@ -0,0 +1,78 @@ +/* VMSecureRandom.java -- random seed generator. + Copyright (C) 2006, 2009 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. + */ +final class VMSecureRandom +{ + + /** + * <p> + * 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. + * </p> + * <p> + * The GCJ implementation uses a native method to read bytes from + * a system random source (e.g. /dev/random). + * </p> + * + * @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. + * @return the number of bytes generated. + */ + 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(); + + return natGenerateSeed(buffer, offset, length); + } + + static native int natGenerateSeed(byte[] buffer, int offset, int length); + +}
\ No newline at end of file diff --git a/libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc b/libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc new file mode 100644 index 0000000..a44f3f4 --- /dev/null +++ b/libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc @@ -0,0 +1,54 @@ +// natVMSecureRandomPosix.cc - Native part of VMSecureRandom class for POSIX. + +/* Copyright (C) 2009 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> + +#include <gcj/cni.h> +#include <java/lang/InternalError.h> +#include <gnu/java/security/jce/prng/VMSecureRandom.h> + +jint +gnu::java::security::jce::prng::VMSecureRandom::natGenerateSeed(jbyteArray byte_array, jint offset, jint length) +{ + int a, fd; + jbyte *bytes = elements (byte_array); + ssize_t count; + + for (a = 0; a < offset; ++a) + bytes++; + fd = open ("/dev/random", O_RDONLY); + + if (fd == -1) + { + jstring oserr = JvNewStringLatin1 (strerror (errno)); + throw new ::java::lang::InternalError + (JvNewStringLatin1 ("Error opening /dev/random: ")->concat(oserr)); + } + + count = read (fd, bytes, length); + close (fd); + + if (count == -1) + { + jstring oserr = JvNewStringLatin1 (strerror (errno)); + throw new ::java::lang::InternalError + (JvNewStringLatin1 ("Error reading /dev/random: ")->concat(oserr)); + } + + return count; +} + diff --git a/libjava/gnu/javax/crypto/jce/prng/CSPRNGSpi.h b/libjava/gnu/javax/crypto/jce/prng/CSPRNGSpi.h index c499fa8..6abf9be 100644 --- a/libjava/gnu/javax/crypto/jce/prng/CSPRNGSpi.h +++ b/libjava/gnu/javax/crypto/jce/prng/CSPRNGSpi.h @@ -50,6 +50,7 @@ public: // actually protected virtual void engineSetSeed(JArray< jbyte > *); private: ::gnu::java::security::prng::IRandom * __attribute__((aligned(__alignof__( ::java::security::SecureRandomSpi)))) adaptee; + jboolean virgin; public: static ::java::lang::Class class$; }; diff --git a/libjava/gnu/javax/crypto/jce/prng/FortunaImpl.h b/libjava/gnu/javax/crypto/jce/prng/FortunaImpl.h index fefea28..d684e36 100644 --- a/libjava/gnu/javax/crypto/jce/prng/FortunaImpl.h +++ b/libjava/gnu/javax/crypto/jce/prng/FortunaImpl.h @@ -43,7 +43,8 @@ public: // actually protected void engineNextBytes(JArray< jbyte > *); JArray< jbyte > * engineGenerateSeed(jint); private: - ::gnu::javax::crypto::prng::Fortuna * __attribute__((aligned(__alignof__( ::java::security::SecureRandomSpi)))) adaptee; + jboolean __attribute__((aligned(__alignof__( ::java::security::SecureRandomSpi)))) virgin; + ::gnu::javax::crypto::prng::Fortuna * adaptee; public: static ::java::lang::Class class$; }; diff --git a/libjava/java/security/SecureRandom.h b/libjava/java/security/SecureRandom.h index 58561ab..b54318c 100644 --- a/libjava/java/security/SecureRandom.h +++ b/libjava/java/security/SecureRandom.h @@ -47,8 +47,6 @@ public: static JArray< jbyte > * getSeed(jint); virtual JArray< jbyte > * generateSeed(jint); private: - static jint generateSeed(JArray< jbyte > *); - static jint generateSeed(JArray< jbyte > *, jint, jint); static ::java::lang::String * SECURE_RANDOM; static const jlong serialVersionUID = 4940670005562187LL; public: // actually package-private @@ -61,9 +59,6 @@ public: // actually package-private private: ::java::lang::String * algorithm; jboolean isSeeded; - static ::java::lang::String * SECURERANDOM_SOURCE; - static ::java::lang::String * JAVA_SECURITY_EGD; - static ::java::util::logging::Logger * logger; public: static ::java::lang::Class class$; }; diff --git a/libjava/java/security/VMSecureRandom$Spinner.h b/libjava/java/security/VMSecureRandom$Spinner.h deleted file mode 100644 index 0013a3f..0000000 --- a/libjava/java/security/VMSecureRandom$Spinner.h +++ /dev/null @@ -1,38 +0,0 @@ - -// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- - -#ifndef __java_security_VMSecureRandom$Spinner__ -#define __java_security_VMSecureRandom$Spinner__ - -#pragma interface - -#include <java/lang/Object.h> -extern "Java" -{ - namespace java - { - namespace security - { - class VMSecureRandom$Spinner; - } - } -} - -class java::security::VMSecureRandom$Spinner : public ::java::lang::Object -{ - -public: // actually package-private - VMSecureRandom$Spinner(jbyte); -public: - virtual void run(); -private: - void stop(); -public: // actually package-private - static void access$0(::java::security::VMSecureRandom$Spinner *); - jbyte volatile __attribute__((aligned(__alignof__( ::java::lang::Object)))) value; - jboolean volatile running; -public: - static ::java::lang::Class class$; -}; - -#endif // __java_security_VMSecureRandom$Spinner__ diff --git a/libjava/java/security/VMSecureRandom.h b/libjava/java/security/VMSecureRandom.h deleted file mode 100644 index 982bc0f..0000000 --- a/libjava/java/security/VMSecureRandom.h +++ /dev/null @@ -1,33 +0,0 @@ - -// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- - -#ifndef __java_security_VMSecureRandom__ -#define __java_security_VMSecureRandom__ - -#pragma interface - -#include <java/lang/Object.h> -#include <gcj/array.h> - -extern "Java" -{ - namespace java - { - namespace security - { - class VMSecureRandom; - } - } -} - -class java::security::VMSecureRandom : public ::java::lang::Object -{ - -public: // actually package-private - VMSecureRandom(); - static jint generateSeed(JArray< jbyte > *, jint, jint); -public: - static ::java::lang::Class class$; -}; - -#endif // __java_security_VMSecureRandom__ diff --git a/libjava/sources.am b/libjava/sources.am index b108484..3f33a90 100644 --- a/libjava/sources.am +++ b/libjava/sources.am @@ -1748,6 +1748,7 @@ classpath/gnu/java/security/jce/prng/Sha256RandomSpi.java \ classpath/gnu/java/security/jce/prng/Sha384RandomSpi.java \ classpath/gnu/java/security/jce/prng/Sha512RandomSpi.java \ classpath/gnu/java/security/jce/prng/TigerRandomSpi.java \ +gnu/java/security/jce/prng/VMSecureRandom.java \ classpath/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java gnu_java_security_jce_prng_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(gnu_java_security_jce_prng_source_files))) @@ -5246,8 +5247,7 @@ classpath/java/security/Signer.java \ classpath/java/security/UnrecoverableKeyException.java \ classpath/java/security/UnresolvedPermission.java \ java/security/VMAccessControlState.java \ -java/security/VMAccessController.java \ -java/security/VMSecureRandom.java +java/security/VMAccessController.java java_security_header_files = $(patsubst classpath/%,%,$(patsubst %.java,%.h,$(java_security_source_files))) |