Hi,
Raif Naffah, the gnu.crypto maintainer, send me some updates for our
MessageDigest implementation. While testing it against Kissme I found a
couple of deficiencies in our java.security.Security class. Which are
fixed by the following patch:
2002-08-18 Mark Wielaard <[EMAIL PROTECTED]>
* gnu/classpath/Configuration.java.in: Add CLASSPATH_HOME field.
* java/lang/System.java: Set gnu.classpath.home property.
* java/security/Security.java: Use java.home are gnu.classpath.home
to load providers.
(loadProviders): Extra dir argument.
(getProvider): Return null when not found.
The only interesting thing added is the gnu.classpath.home system
property which can be used to find installed files like the
classpath.security file. Maybe it can also be used in other situations
to get at classpath data regardless of the actual VM used.
Cheers,
Mark
Index: gnu/classpath/Configuration.java.in
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/classpath/Configuration.java.in,v
retrieving revision 1.6
diff -u -r1.6 Configuration.java.in
--- gnu/classpath/Configuration.java.in 22 Jan 2002 22:26:56 -0000 1.6
+++ gnu/classpath/Configuration.java.in 18 Aug 2002 16:16:44 -0000
@@ -44,6 +44,14 @@
public interface Configuration
{
/**
+ * The value of CLASSPATH_HOME is the location that the classpath
+ * libraries and support files where installed in. It is set according to
+ * the argument for --prefix given to configure and used to set the
+ * System property gnu.classpath.home.
+ */
+ String CLASSPATH_HOME = "@prefix@";
+
+ /**
* The value of DEBUG is substituted according to whether the
* "--enable-debug" argument was passed to configure. Code
* which is made conditional based on the value of this flag - typically
Index: java/lang/System.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/System.java,v
retrieving revision 1.22
diff -u -r1.22 System.java
--- java/lang/System.java 30 Apr 2002 17:44:08 -0000 1.22
+++ java/lang/System.java 18 Aug 2002 16:16:44 -0000
@@ -73,6 +73,7 @@
loadLibrary("javalang");
Properties defaultProperties = Runtime.defaultProperties;
+ defaultProperties.put("gnu.classpath.home", Configuration.CLASSPATH_HOME);
defaultProperties.put("gnu.cpu.endian",
isWordsBigEndian() ? "big" : "little");
Index: java/security/Security.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/security/Security.java,v
retrieving revision 1.9
diff -u -r1.9 Security.java
--- java/security/Security.java 22 Jan 2002 22:27:00 -0000 1.9
+++ java/security/Security.java 18 Aug 2002 16:16:44 -0000
@@ -59,8 +59,9 @@
static
{
- loadProviders(System.getProperty("java.vm.name"));
- loadProviders("classpath");
+ loadProviders(System.getProperty("java.home"),
+ System.getProperty("java.vm.name"));
+ loadProviders(System.getProperty("gnu.classpath.home"), "classpath");
}
// This class can't be instantiated.
@@ -68,13 +69,13 @@
{
}
- private static void loadProviders(String vendor)
+ private static void loadProviders(String dir, String vendor)
{
- if (vendor == null)
+ if (dir == null || vendor == null)
return;
String separator = System.getProperty("file.separator");
- String secfilestr = (System.getProperty("java.home") +
+ String secfilestr = (dir +
separator + "lib" +
separator + "security" +
separator + vendor + ".security");
@@ -263,15 +264,15 @@
*/
public static Provider getProvider(String name)
{
- Provider p = null;
+ Provider p;
int max = providers.size ();
for (int i = 0; i < max; i++)
{
p = (Provider) providers.elementAt(i);
if (p.getName() == name)
- break;
+ return p;
}
- return p;
+ return null;
}
/**