diff options
author | Andrew John Hughes <ahughes@redhat.com> | 2009-02-11 20:52:44 +0000 |
---|---|---|
committer | Andrew John Hughes <ahughes@redhat.com> | 2009-02-11 20:52:44 +0000 |
commit | 92b826d5e04551534aec8a9cd99afe08d78da911 (patch) | |
tree | b053e88e048fb754c68d2ec818879c550e02ee73 | |
parent | 82b8256da26f2338d620075fa0b7dc20f58ed1b6 (diff) |
Synchronise with Classpath 0.98 release.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/CLASSPATH@144110 138bc75d-0d04-0410-961f-82ee72b054a4
29 files changed, 475 insertions, 158 deletions
diff --git a/libjava/classpath/ChangeLog b/libjava/classpath/ChangeLog index 9416782db32..169c2f64c7b 100644 --- a/libjava/classpath/ChangeLog +++ b/libjava/classpath/ChangeLog @@ -1,3 +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 e1029514389..882c5ffeecb 100644 --- a/libjava/classpath/Makefile.am +++ b/libjava/classpath/Makefile.am @@ -12,7 +12,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/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/configure.ac b/libjava/classpath/configure.ac index 1678ae100c3..e26a2c26d26 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) AC_CANONICAL_TARGET diff --git a/libjava/classpath/external/jsr166/Makefile.in b/libjava/classpath/external/jsr166/Makefile.in index e25b701bb06..2c6a0f5109e 100644 --- a/libjava/classpath/external/jsr166/Makefile.in +++ b/libjava/classpath/external/jsr166/Makefile.in @@ -50,7 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = SOURCES = diff --git a/libjava/classpath/external/relaxngDatatype/Makefile.in b/libjava/classpath/external/relaxngDatatype/Makefile.in index 19120e601f9..40acd6be02a 100644 --- a/libjava/classpath/external/relaxngDatatype/Makefile.in +++ b/libjava/classpath/external/relaxngDatatype/Makefile.in @@ -50,7 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = SOURCES = diff --git a/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java b/libjava/classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java index fcd3f6acd92..d1ad2d38cb4 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) @@ -2171,4 +2173,4 @@ public abstract class CairoGraphics2D extends Graphics2D return new Rectangle2D.Double(minX, minY, (maxX - minX), (maxY - minY)); } -}
\ No newline at end of file +} 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. - * <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 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/include/config-int.h b/libjava/classpath/include/config-int.h index cb0b640906a..6be0c51c2e2 100644 --- a/libjava/classpath/include/config-int.h +++ b/libjava/classpath/include/config-int.h @@ -1,8 +1,8 @@ #ifndef _CLASSPATH_INCLUDE_CONFIG_INT_H #define _CLASSPATH_INCLUDE_CONFIG_INT_H 1 #ifndef _GENERATED_STDINT_H -#define _GENERATED_STDINT_H "classpath 0.98-pre" -/* generated using gnu compiler gcc (Gentoo 4.3.3 p1.1) 4.3.3 20081229 (prerelease) */ +#define _GENERATED_STDINT_H "classpath 0.98" +/* generated using gnu compiler gcc (Gentoo 4.3.3 p1.0, pie-10.1.5) 4.3.3 */ #define _STDINT_HAVE_STDINT_H 1 #include <stdint.h> #endif 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/native/jni/gconf-peer/Makefile.in b/libjava/classpath/native/jni/gconf-peer/Makefile.in index b5f86518394..a283650ac8e 100644 --- a/libjava/classpath/native/jni/gconf-peer/Makefile.in +++ b/libjava/classpath/native/jni/gconf-peer/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -71,7 +71,7 @@ libgconfpeer_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgconfpeer_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/libjava/classpath/native/jni/gstreamer-peer/Makefile.in b/libjava/classpath/native/jni/gstreamer-peer/Makefile.in index 25af345666e..38b6c325ea8 100644 --- a/libjava/classpath/native/jni/gstreamer-peer/Makefile.in +++ b/libjava/classpath/native/jni/gstreamer-peer/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -74,7 +74,7 @@ libgstreamerpeer_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgstreamerpeer_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/libjava/classpath/native/jni/java-math/Makefile.in b/libjava/classpath/native/jni/java-math/Makefile.in index 1db033d75de..005a9924f5b 100644 --- a/libjava/classpath/native/jni/java-math/Makefile.in +++ b/libjava/classpath/native/jni/java-math/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -71,7 +71,7 @@ libjavamath_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libjavamath_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/libjava/classpath/native/jni/midi-alsa/Makefile.in b/libjava/classpath/native/jni/midi-alsa/Makefile.in index 72932c57a90..8b94b51d3ac 100644 --- a/libjava/classpath/native/jni/midi-alsa/Makefile.in +++ b/libjava/classpath/native/jni/midi-alsa/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -73,7 +73,7 @@ libgjsmalsa_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgjsmalsa_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/libjava/classpath/native/jni/midi-dssi/Makefile.in b/libjava/classpath/native/jni/midi-dssi/Makefile.in index c55b7de7b6d..1ed538921cf 100644 --- a/libjava/classpath/native/jni/midi-dssi/Makefile.in +++ b/libjava/classpath/native/jni/midi-dssi/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -73,7 +73,7 @@ libgjsmdssi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libgjsmdssi_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/libjava/classpath/native/jni/native-lib/Makefile.in b/libjava/classpath/native/jni/native-lib/Makefile.in index 825254f14a2..9315652698c 100644 --- a/libjava/classpath/native/jni/native-lib/Makefile.in +++ b/libjava/classpath/native/jni/native-lib/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) @@ -59,7 +59,7 @@ libclasspathnative_la_LIBADD = am_libclasspathnative_la_OBJECTS = cpnet.lo cpio.lo cpproc.lo libclasspathnative_la_OBJECTS = $(am_libclasspathnative_la_OBJECTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 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/native/plugin/Makefile.in b/libjava/classpath/native/plugin/Makefile.in index ea4642c9b6b..406aea418c7 100644 --- a/libjava/classpath/native/plugin/Makefile.in +++ b/libjava/classpath/native/plugin/Makefile.in @@ -51,7 +51,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -71,7 +71,7 @@ libgcjwebplugin_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(libgcjwebplugin_la_CXXFLAGS) $(CXXFLAGS) \ $(libgcjwebplugin_la_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) diff --git a/libjava/classpath/native/plugin/gcjwebplugin.cc b/libjava/classpath/native/plugin/gcjwebplugin.cc index bb2bfa22343..71cffccb674 100644 --- a/libjava/classpath/native/plugin/gcjwebplugin.cc +++ b/libjava/classpath/native/plugin/gcjwebplugin.cc @@ -45,7 +45,11 @@ exception statement from your version. */ // Netscape plugin API includes. #include <npapi.h> +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) #include <npupp.h> +#else +#include <npfunctions.h> +#endif // GLib includes. #include <glib.h> @@ -827,7 +831,11 @@ GCJ_URLNotify (NPP instance, const char* url, NPReason reason, PLUGIN_DEBUG ("GCJ_URLNotify return"); } +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) jref +#else +void* +#endif GCJ_GetJavaClass (void) { PLUGIN_DEBUG ("GCJ_GetJavaClass"); @@ -1669,6 +1677,7 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable) // Return to the browser the plugin functions that we implement. pluginTable->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; pluginTable->size = sizeof (NPPluginFuncs); +#if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20) pluginTable->newp = NewNPP_NewProc (GCJ_New); pluginTable->destroy = NewNPP_DestroyProc (GCJ_Destroy); pluginTable->setwindow = NewNPP_SetWindowProc (GCJ_SetWindow); @@ -1680,6 +1689,19 @@ NP_Initialize (NPNetscapeFuncs* browserTable, NPPluginFuncs* pluginTable) pluginTable->print = NewNPP_PrintProc (GCJ_Print); pluginTable->urlnotify = NewNPP_URLNotifyProc (GCJ_URLNotify); pluginTable->getvalue = NewNPP_GetValueProc (GCJ_GetValue); +#else + pluginTable->newp = (NPP_NewProcPtr) (GCJ_New); + pluginTable->destroy = (NPP_DestroyProcPtr) (GCJ_Destroy); + pluginTable->setwindow = (NPP_SetWindowProcPtr) (GCJ_SetWindow); + pluginTable->newstream = (NPP_NewStreamProcPtr) (GCJ_NewStream); + pluginTable->destroystream = (NPP_DestroyStreamProcPtr) (GCJ_DestroyStream); + pluginTable->asfile = (NPP_StreamAsFileProcPtr) (GCJ_StreamAsFile); + pluginTable->writeready = (NPP_WriteReadyProcPtr) (GCJ_WriteReady); + pluginTable->write = (NPP_WriteProcPtr) (GCJ_Write); + pluginTable->print = (NPP_PrintProcPtr) (GCJ_Print); + pluginTable->urlnotify = (NPP_URLNotifyProcPtr) (GCJ_URLNotify); + pluginTable->getvalue = (NPP_GetValueProcPtr) (GCJ_GetValue); +#endif initialized = true; diff --git a/libjava/classpath/tools/Makefile.in b/libjava/classpath/tools/Makefile.in index 6b5de446ee1..1948f96d585 100644 --- a/libjava/classpath/tools/Makefile.in +++ b/libjava/classpath/tools/Makefile.in @@ -69,7 +69,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ac_prog_antlr.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs +mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = gappletviewer gjarsigner gkeytool gjar \ gnative2ascii gserialver grmiregistry gtnameserv gorbd grmid \ @@ -182,7 +182,7 @@ gtnameserv_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ binSCRIPT_INSTALL = $(INSTALL_SCRIPT) SCRIPTS = $(bin_SCRIPTS) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include -depcomp = $(SHELL) $(top_srcdir)/../depcomp +depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 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. + * + * <p>The default implementation of this class runs eight threads that + * increment counters in a tight loop, and XORs each counter to + * produce one byte of seed data. This is not very efficient, and is + * not guaranteed to be random (the thread scheduler is probably + * deterministic, after all). If possible, VM implementors should + * reimplement this class so it obtains a random seed from a system + * facility, such as a system entropy gathering device or hardware + * random number generator. + */ +final class VMSecureRandom +{ + + /** + * Generate a random seed. Implementations are free to generate + * fewer random bytes than are requested, and leave the remaining + * bytes of the destination buffer as zeros. Implementations SHOULD, + * however, make a best-effort attempt to satisfy the request. + * + * @param buffer The destination buffer. + * @param offset The offset in the buffer to start putting bytes. + * @param length The number of random bytes to generate. + */ + static int generateSeed(byte[] buffer, int offset, int length) + { + if (length < 0) + throw new IllegalArgumentException("length must be nonnegative"); + if (offset < 0 || offset + length > buffer.length) + throw new IndexOutOfBoundsException(); + + Spinner[] spinners = new Spinner[8]; + int n = 0x1; + for (int i = 0; i < spinners.length; i++) + { + spinners[i] = new Spinner((byte) n); + Thread t = new Thread(spinners[i]); + t.start(); + n <<= 1; + } + + // Wait until at least one spinner has started. + while (!(spinners[0].running || spinners[1].running || spinners[2].running + || spinners[3].running || spinners[4].running || spinners[5].running + || spinners[6].running || spinners[7].running)) + { + Thread.yield(); + } + + for (int i = offset; i < length; i++) + { + buffer[i] = (byte) (spinners[0].value ^ spinners[1].value ^ spinners[2].value + ^ spinners[3].value ^ spinners[4].value ^ spinners[5].value + ^ spinners[6].value ^ spinners[7].value); + Thread.yield(); + } + + for (int i = 0; i < spinners.length; i++) + spinners[i].stop(); + + return length; + } + + static class Spinner implements Runnable + { + volatile byte value; + volatile boolean running; + + Spinner(final byte initial) + { + value = initial; + } + + public void run() + { + running = true; + while (running) + value++; + } + + private void stop() + { + running = false; + } + } +}
\ No newline at end of file |