Sync libgcj with GNU Classpath 0.98.

2009-02-13  Andrew John Hughes  <ahughes@redhat.com>

	Import GNU Classpath (classpath-0_98-release).

	* Makefile.am: Add natVMSecureRandom.cc.
	* Makefile.in: Regenerated.
	* classpath/ChangeLog,
	* classpath/Makefile.am: Merged.
	* classpath/Makefile.in: Regenerated.
	* classpath/NEWS: Merged.
	* classpath/config.guess,
	* classpath/config.sub,
	* classpath/configure: Regenerated.
	* classpath/configure.ac: Merged.
	* classpath/gnu/java/awt/peer/gtk/CairoGraphics2D.java,
	* classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java,
	* classpath/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java,
	* classpath/gnu/javax/crypto/jce/prng/CSPRNGSpi.java,
	* classpath/gnu/javax/crypto/jce/prng/FortunaImpl.java,
	* classpath/gnu/javax/crypto/jce/prng/ICMRandomSpi.java,
	* classpath/gnu/javax/crypto/jce/prng/UMacRandomSpi.java,
	* classpath/gnu/javax/crypto/prng/ICMGenerator.java,
	* classpath/gnu/xml/stream/XMLParser.java,
	* classpath/java/security/SecureRandom.java,
	* classpath/native/jni/native-lib/cpproc.c,
	* classpath/native/plugin/gcjwebplugin.cc,
	* classpath/tools/gnu/classpath/tools/gjdoc/Main.java: Merged.
	* configure: Regenerated.
	* configure.ac: Add symlink for natVMSecureRandomPosix.cc to natVMSecureRandom.cc
	* gnu/classpath/Configuration.java: Change version to 0.98.
	* gnu/java/security/jce/prng/SecureRandomAdapter.h: Regenerated.
	* gnu/java/security/jce/prng/VMSecureRandom.h: Generated.
	* gnu/java/security/jce/prng/VMSecureRandom.java: Added native implementation.
	* gnu/java/security/jce/prng/natVMSecureRandomPosix.cc: Wrapper around /dev/random.
	* gnu/javax/crypto/jce/prng/CSPRNGSpi.h,
	* gnu/javax/crypto/jce/prng/FortunaImpl.h,
	* java/security/SecureRandom.h: Regenerated.
	* java/security/VMSecureRandom$Spinner.h,
	* java/security/VMSecureRandom.h,
	* java/security/VMSecureRandom.java: Removed.
	* sources.am: Move VMSecureRandom to gnu.java.security.jce.prng.

From-SVN: r144434
This commit is contained in:
Andrew John Hughes 2009-02-25 21:40:28 +00:00
parent a16b68bb66
commit dc6a0b2d94
66 changed files with 612 additions and 249 deletions

View file

@ -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);
}
}