From 5d638d78c47512d2e7ea60a5eeaf1450c461de2a Mon Sep 17 00:00:00 2001 From: Andrew John Hughes Date: Wed, 25 Feb 2009 21:40:28 +0000 Subject: Sync libgcj with GNU Classpath 0.98. 2009-02-13 Andrew John Hughes 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@144434 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/ChangeLog | 42 +++++++ libjava/Makefile.am | 1 + libjava/Makefile.in | 37 ++++-- libjava/classpath/ChangeLog | 86 ++++++++++++++ libjava/classpath/Makefile.am | 2 +- libjava/classpath/Makefile.in | 2 +- libjava/classpath/NEWS | 37 +++++- libjava/classpath/config.guess | 22 +++- libjava/classpath/config.sub | 24 ++-- libjava/classpath/configure | 20 ++-- libjava/classpath/configure.ac | 2 +- .../gnu/java/awt/peer/gtk/CairoGraphics2D.java | 4 +- .../security/jce/prng/SecureRandomAdapter.java | 121 +++++++++++++++---- .../javax/crypto/jce/prng/ARCFourRandomSpi.java | 15 +-- .../gnu/javax/crypto/jce/prng/CSPRNGSpi.java | 17 +-- .../gnu/javax/crypto/jce/prng/FortunaImpl.java | 25 +++- .../gnu/javax/crypto/jce/prng/ICMRandomSpi.java | 21 +--- .../gnu/javax/crypto/jce/prng/UMacRandomSpi.java | 10 +- .../gnu/javax/crypto/prng/ICMGenerator.java | 9 ++ libjava/classpath/gnu/xml/stream/XMLParser.java | 14 ++- libjava/classpath/java/security/SecureRandom.java | 65 +---------- .../lib/gnu/classpath/Configuration.class | Bin 908 -> 904 bytes .../lib/gnu/classpath/SystemProperties.class | Bin 2659 -> 2655 bytes .../classpath/lib/gnu/gcj/convert/Convert.class | Bin 4799 -> 4799 bytes .../lib/gnu/gcj/tools/gcj_dbtool/Main.class | Bin 10918 -> 10918 bytes .../gnu/java/awt/peer/gtk/CairoGraphics2D.class | Bin 39058 -> 39120 bytes .../lib/gnu/java/rmi/registry/RegistryImpl.class | Bin 4240 -> 4240 bytes .../security/jce/prng/SecureRandomAdapter.class | Bin 1358 -> 3342 bytes .../javax/crypto/jce/prng/ARCFourRandomSpi.class | Bin 1418 -> 1443 bytes .../lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class | Bin 1499 -> 1516 bytes .../gnu/javax/crypto/jce/prng/FortunaImpl.class | Bin 1354 -> 1498 bytes .../gnu/javax/crypto/jce/prng/ICMRandomSpi.class | Bin 3712 -> 3735 bytes .../gnu/javax/crypto/jce/prng/UMacRandomSpi.class | Bin 3184 -> 3209 bytes .../lib/gnu/javax/crypto/prng/ICMGenerator.class | Bin 4444 -> 4678 bytes .../gnu/xml/stream/XMLParser$AnyContentModel.class | Bin 617 -> 617 bytes .../lib/gnu/xml/stream/XMLParser$Attribute.class | Bin 2442 -> 2442 bytes .../gnu/xml/stream/XMLParser$AttributeDecl.class | Bin 897 -> 897 bytes .../gnu/xml/stream/XMLParser$ContentModel.class | Bin 787 -> 787 bytes .../gnu/xml/stream/XMLParser$ContentParticle.class | Bin 595 -> 595 bytes .../lib/gnu/xml/stream/XMLParser$Doctype.class | Bin 5914 -> 5914 bytes .../xml/stream/XMLParser$ElementContentModel.class | Bin 1059 -> 1059 bytes .../xml/stream/XMLParser$EmptyContentModel.class | Bin 623 -> 623 bytes .../lib/gnu/xml/stream/XMLParser$ExternalIds.class | Bin 556 -> 556 bytes .../lib/gnu/xml/stream/XMLParser$Input.class | Bin 6256 -> 6256 bytes .../xml/stream/XMLParser$MixedContentModel.class | Bin 988 -> 988 bytes .../classpath/lib/gnu/xml/stream/XMLParser.class | Bin 68200 -> 68323 bytes .../classpath/lib/java/security/SecureRandom.class | Bin 7780 -> 5950 bytes libjava/classpath/native/jni/native-lib/cpproc.c | 3 +- .../tools/common/ClasspathToolParser.class | Bin 4032 -> 4028 bytes .../classes/gnu/classpath/tools/gjdoc/Main.class | Bin 29565 -> 29564 bytes .../classes/gnu/classpath/tools/orbd/Main.class | Bin 5476 -> 5476 bytes .../tools/gnu/classpath/tools/gjdoc/Main.java | 2 +- .../gnu/java/security/jce/prng/VMSecureRandom.java | 129 +++++++++++++++++++++ libjava/configure | 6 + libjava/configure.ac | 4 + libjava/gnu/classpath/Configuration.java | 2 +- .../java/security/jce/prng/SecureRandomAdapter.h | 7 +- .../gnu/java/security/jce/prng/VMSecureRandom.h | 43 +++++++ .../gnu/java/security/jce/prng/VMSecureRandom.java | 78 +++++++++++++ .../security/jce/prng/natVMSecureRandomPosix.cc | 54 +++++++++ libjava/gnu/javax/crypto/jce/prng/CSPRNGSpi.h | 1 + libjava/gnu/javax/crypto/jce/prng/FortunaImpl.h | 3 +- libjava/java/security/SecureRandom.h | 5 - libjava/java/security/VMSecureRandom$Spinner.h | 38 ------ libjava/java/security/VMSecureRandom.h | 33 ------ libjava/java/security/VMSecureRandom.java | 129 --------------------- libjava/sources.am | 4 +- 67 files changed, 740 insertions(+), 377 deletions(-) create mode 100644 libjava/classpath/vm/reference/gnu/java/security/jce/prng/VMSecureRandom.java create mode 100644 libjava/gnu/java/security/jce/prng/VMSecureRandom.h create mode 100644 libjava/gnu/java/security/jce/prng/VMSecureRandom.java create mode 100644 libjava/gnu/java/security/jce/prng/natVMSecureRandomPosix.cc delete mode 100644 libjava/java/security/VMSecureRandom$Spinner.h delete mode 100644 libjava/java/security/VMSecureRandom.h delete mode 100644 libjava/java/security/VMSecureRandom.java diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 3cb487a5b09..4eab8c23820 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,45 @@ +2009-02-13 Andrew John Hughes + + 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 * Makefile.am (AM_MAKEFLAGS): Pass down datadir. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 2078a8734df..49685896878 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 cea890f04d5..c7b22721c7f 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 b76807c13c6..169c2f64c7b 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,10 +1,96 @@ +2009-02-05 Andrew John Hughes + + * NEWS: Add VM updates. + +2009-02-05 Andrew John Hughes + + * NEWS: Updated. + * configure.ac: + Bump to 0.98 proper. + 2009-02-05 Andrew Haley + 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 + + PR classpath/38912: + * gnu/xml/stream/XMLParser.java: + (getLocalName()): Respect stringInterning. + (getName()): Likewise. + (getPrefix()): Likewise. + +2009-02-04 Andrew John Hughes + + * 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 + + * native/jni/native-lib/cpproc.c: + (cpproc_forkAndExec): Handle return of + chdir. + +2009-02-03 Andrew John Hughes + + 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 + + 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 + + * tools/gnu/classpath/tools/gjdoc/Main.java (getGjdocVersion): + Read version.properties from package. + +2009-01-05 Robert Schuster + + * gnu/java/awt/peer/gtk/CairoGraphics2D.java: + (drawPolyline): Rewritten. + +2009-01-05 Andrew John Hughes + + * Makefile.am: + Add ChangeLog-2008 to EXTRA_DIST. + 2009-01-02 Andrew John Hughes * ChangeLog-2008: New file. diff --git a/libjava/classpath/Makefile.am b/libjava/classpath/Makefile.am index af47684b185..454b2e96023 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 dcc346b7743..35f1dd788e5 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 4be4d60434c..4ae10d710d9 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 c7607c74f1b..aeb53233ecb 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 63bfff03070..9489dc7867b 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 8a4c6b1ded9..8f520cdcf53 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 . # @@ -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 b3187cca7e7..faf3ab7ce36 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 bc8c91a2b03..8f8d7ea8bbb 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 5be402ff005..5877e3edb6c 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. - *

- * This class defines the Service Provider Interface (SPI) for + *

The implementation of a generic {@link java.security.SecureRandom} adapter + * class to wrap gnu.crypto prng instances based on Message Digest algorithms.

+ * + *

This class defines the Service Provider Interface (SPI) for * the {@link java.security.SecureRandom} class, which provides the - * functionality of a cryptographically strong pseudo-random number generator. - *

- * 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.

+ * + *

All the abstract methods in the {@link SecureRandomSpi} class are + * implemented by this class and all its sub-classes.

*/ -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. - * + *

Trivial protected constructor.

+ * * @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 652793b04ff..1129d5dfb1b 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 6ded636aaf3..96d66f05200 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 8e3782ef055..b18410c09f0 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 9855f95bd98..a02fd147e89 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 f6949dd8d71..2faebe8eb04 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 5b0bd4f8b1e..d8205cfb4ad 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 27aaa734dd6..6072a9c730f 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 f965782369c..0c7183879ce 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 index 1b3fe05043c..27c31f26e17 100644 Binary files a/libjava/classpath/lib/gnu/classpath/Configuration.class and b/libjava/classpath/lib/gnu/classpath/Configuration.class differ diff --git a/libjava/classpath/lib/gnu/classpath/SystemProperties.class b/libjava/classpath/lib/gnu/classpath/SystemProperties.class index b430d0761a5..b0359303db5 100644 Binary files a/libjava/classpath/lib/gnu/classpath/SystemProperties.class and b/libjava/classpath/lib/gnu/classpath/SystemProperties.class differ diff --git a/libjava/classpath/lib/gnu/gcj/convert/Convert.class b/libjava/classpath/lib/gnu/gcj/convert/Convert.class index 89dc4556c23..15917dba993 100644 Binary files a/libjava/classpath/lib/gnu/gcj/convert/Convert.class and b/libjava/classpath/lib/gnu/gcj/convert/Convert.class differ diff --git a/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class b/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class index 10f6cb36a47..a11c8f974c3 100644 Binary files a/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class and b/libjava/classpath/lib/gnu/gcj/tools/gcj_dbtool/Main.class differ diff --git a/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class b/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class index 6e09628a3ad..017314c5b0b 100644 Binary files a/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class and b/libjava/classpath/lib/gnu/java/awt/peer/gtk/CairoGraphics2D.class differ diff --git a/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class b/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class index 95e721095bc..d8b3cae4250 100644 Binary files a/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class and b/libjava/classpath/lib/gnu/java/rmi/registry/RegistryImpl.class differ diff --git a/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class b/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class index 7bacedb0d5e..c781278a659 100644 Binary files a/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class and b/libjava/classpath/lib/gnu/java/security/jce/prng/SecureRandomAdapter.class differ diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class index 1adddb1be0c..6993b3a0f3e 100644 Binary files a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class and b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.class differ diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class index c10db7a1e0d..b73add56309 100644 Binary files a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class and b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/CSPRNGSpi.class differ diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class index 817c972c95d..bf61fb49fb8 100644 Binary files a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class and b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/FortunaImpl.class differ diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class index 747f0032817..5fca78ef177 100644 Binary files a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class and b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/ICMRandomSpi.class differ diff --git a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class index 214773133bf..9c760ea3324 100644 Binary files a/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class and b/libjava/classpath/lib/gnu/javax/crypto/jce/prng/UMacRandomSpi.class differ diff --git a/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class b/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class index 9c38cdf1799..53776d6de50 100644 Binary files a/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class and b/libjava/classpath/lib/gnu/javax/crypto/prng/ICMGenerator.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class index 7e64954f56d..31381bdd6a4 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AnyContentModel.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class index 45f6ab83b81..bc9f56ce98f 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Attribute.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class index f0ca4f00295..7c578d44bca 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$AttributeDecl.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class index 86cba0fe9f4..5d2f9918879 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentModel.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class index cd7acfe30cc..4ced06152ab 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ContentParticle.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class index 3c17511cd36..f05bfcae545 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Doctype.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class index 5eeed5aca99..5ee2d8cff10 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ElementContentModel.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class index 0275f802ac7..64ba55704fc 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$EmptyContentModel.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class index e2d9b966367..97ac508cfdf 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$ExternalIds.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class index 0a37ec3d4fc..2e283aee151 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$Input.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class index 28888f642f6..f5309b07ab6 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser$MixedContentModel.class differ diff --git a/libjava/classpath/lib/gnu/xml/stream/XMLParser.class b/libjava/classpath/lib/gnu/xml/stream/XMLParser.class index f9f823ad36b..84113a5baab 100644 Binary files a/libjava/classpath/lib/gnu/xml/stream/XMLParser.class and b/libjava/classpath/lib/gnu/xml/stream/XMLParser.class differ diff --git a/libjava/classpath/lib/java/security/SecureRandom.class b/libjava/classpath/lib/java/security/SecureRandom.class index e99049bbff0..ef74e5aae7b 100644 Binary files a/libjava/classpath/lib/java/security/SecureRandom.class and b/libjava/classpath/lib/java/security/SecureRandom.class differ diff --git a/libjava/classpath/native/jni/native-lib/cpproc.c b/libjava/classpath/native/jni/native-lib/cpproc.c index bb34f6d6e38..0c80703d636 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 index 2c8a74dc3b5..67c15788fc2 100644 Binary files a/libjava/classpath/tools/classes/gnu/classpath/tools/common/ClasspathToolParser.class and b/libjava/classpath/tools/classes/gnu/classpath/tools/common/ClasspathToolParser.class differ diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class b/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class index 48b5bc82371..1ce24d1d49c 100644 Binary files a/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class and b/libjava/classpath/tools/classes/gnu/classpath/tools/gjdoc/Main.class differ diff --git a/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class b/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class index f7c264b2d86..6608af7770b 100644 Binary files a/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class and b/libjava/classpath/tools/classes/gnu/classpath/tools/orbd/Main.class differ diff --git a/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java b/libjava/classpath/tools/gnu/classpath/tools/gjdoc/Main.java index 6c2c77e5bfd..d1316b34183 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 00000000000..28a02102706 --- /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. + * + *

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 diff --git a/libjava/configure b/libjava/configure index 9b8f52f0a3c..7d1baad8a05 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 87194312104..5d9fd1e849d 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 2420878fbce..b0c57332ddc 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 71b29f7734d..7495038c735 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 00000000000..b24c805141a --- /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 +#include + +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 00000000000..62ff8b7aa93 --- /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 +{ + + /** + *

+ * 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. + *

+ *

+ * The GCJ implementation uses a native method to read bytes from + * a system random source (e.g. /dev/random). + *

+ * + * @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 00000000000..a44f3f4573b --- /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 + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +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 c499fa86962..6abf9be9e3b 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 fefea283199..d684e366a1b 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 58561abbc1c..b54318c4406 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 0013a3fc8ca..00000000000 --- 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 -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 982bc0f1a88..00000000000 --- 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 -#include - -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/java/security/VMSecureRandom.java b/libjava/java/security/VMSecureRandom.java deleted file mode 100644 index 5eeb158bc81..00000000000 --- a/libjava/java/security/VMSecureRandom.java +++ /dev/null @@ -1,129 +0,0 @@ -/* 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 java.security; - -/** - * 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. - * - *

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 diff --git a/libjava/sources.am b/libjava/sources.am index b108484277d..3f33a905738 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))) -- cgit v1.2.3