[kaffe] tomcat3.2.3 doesn't work properly on Kaffe-1.0.6-6

Dalibor Topic robilad@yahoo.com
Thu, 13 Jun 2002 12:13:26 -0700 (PDT)


--0-1838121665-1023995606=:34156
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline


--- Tatsuya Tsurukawa <turukawa@isl.melco.co.jp>
wrote:
> I'm now testing Apache SOAP 2.2 and TOMCAT 3.2.3 on
> Red Hat Linux 7.2.
> to make simple Web Services. 
> 
> They work well on Sun's JDK1.3.1. Then I tried to
> use Kaffe-1.0.6-6 as
> JVM instead of Sun's JDK, and I found it doesn't
> work. I saw follwing
> errors.

I just had a success to get tomcat 3.2.4 running on
current kaffe from CVS with the attached patches from
Tim Stack.

* how I got it to run:
- got latest kaffe from CVS
- applied attached patches
- compiled and installed
- got the tar.gz package from jakarta.
- extracted it
- added all jars in the lib/ directory to the
classpath
- ran it with
kaffe -Dtomcat.home=<path-to>/jakarta-tomcat-3.2.4/ 
org.apache.tomcat.startup.Tomcat
- tested the servlet examples. all worked for me on
lynx and mozilla.
- the jsp examples failed since the JSP engine wanted
to explicately use sun's javac as the java compiler.
there might be a way to get around it by setting an
option to use jikes instead, but I didn't try it. Just
adding kaffe's rt.jar and classes.zip from JDK 1.1.8
to the classpath worked for me. A better solution
would be to write a KjcCompiler class.

I hope this helps 

regards,

dalibor topic

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--0-1838121665-1023995606=:34156
Content-Type: text/plain; name="ks.diff.txt"
Content-Description: ks.diff.txt
Content-Disposition: inline; filename="ks.diff.txt"

Index: SHA.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/kaffe/security/provider/SHA.java,v
retrieving revision 1.2
diff -u -r1.2 SHA.java
--- SHA.java	22 Nov 2001 06:21:25 -0000	1.2
+++ SHA.java	3 Jun 2002 20:57:57 -0000
@@ -17,7 +17,7 @@
 
 
 public final class SHA extends UpdateDigest {
-	public static final String DIGEST_NAME = "SHA";
+	public static final String DIGEST_NAME = "SHA-1";
 	public static final int DIGEST_LENGTH = 20;
 
 	public SHA() {
Index: Kaffe.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/kaffe/security/provider/Kaffe.java,v
retrieving revision 1.3
diff -u -r1.3 Kaffe.java
--- Kaffe.java	4 Jan 2002 05:12:33 -0000	1.3
+++ Kaffe.java	3 Jun 2002 20:57:57 -0000
@@ -39,8 +39,12 @@
 				    "kaffe.security.provider.MD4");
 			    put("MessageDigest.MD5",
 				    "kaffe.security.provider.MD5");
-			    put("MessageDigest.SHA",
+			    put("MessageDigest.SHA-1",
 				    "kaffe.security.provider.SHA");
+			    put("Alg.Alias.MessageDigest.SHA1",
+				    "SHA-1");
+			    put("Alg.Alias.MessageDigest.SHA",
+				    "SHA-1");
 			    put("SecureRandom.SHA1PRNG",
 				    "kaffe.security.provider.SHA1PRNG");
 			    return null;

--0-1838121665-1023995606=:34156
Content-Type: text/plain; name="sha2.diff.txt"
Content-Description: sha2.diff.txt
Content-Disposition: inline; filename="sha2.diff.txt"

Index: SHA1PRNG.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/kaffe/security/provider/SHA1PRNG.java,v
retrieving revision 1.3
diff -u -r1.3 SHA1PRNG.java
--- SHA1PRNG.java	12 May 2002 15:08:46 -0000	1.3
+++ SHA1PRNG.java	4 Jun 2002 17:13:40 -0000
@@ -6,10 +6,6 @@
  *
  * See the file "license.terms" for information on usage and redistribution
  * of this file.
- *
- * NB!!!! THIS DOES NOT ACTUALLY IMPLEMENT SHA1PRNG - it uses random and
- *        is a place holder.
- *
  */
 
 package kaffe.security.provider;
@@ -25,14 +21,15 @@
 public class SHA1PRNG
 	extends SecureRandomSpi
 {
-	private static final int SEED_SIZE = 20;
-	private static final int DATA_SIZE = 40;
+	private static final int SEED_SIZE = 8;
+	private static final int DATA_SIZE = 16;
 	
 	private MessageDigest md;
 	private byte seed[] = new byte[SEED_SIZE];
 	private int seedPos = 0;
 	private byte data[] = new byte[DATA_SIZE];
 	private int dataPos = 0;
+	private long counter = 0;
 	
 	public SHA1PRNG()
 	{
@@ -43,7 +40,7 @@
 			this.md = MessageDigest.getInstance("SHA-1");
 
 			new Random().nextBytes(this.seed);
-			digest = this.md.digest(this.data);
+			digest = this.md.digest(this.seed);
 			System.arraycopy(digest, 0, this.data, 0, SEED_SIZE);
 		}
 		catch(NoSuchAlgorithmException e)
@@ -77,7 +74,8 @@
 	
 	protected void engineNextBytes(byte[] bytes)
 	{
-		if( bytes.length < (20 - this.dataPos) )
+		this.counter += 1;
+		if( bytes.length < (SEED_SIZE - this.dataPos) )
 		{
 			System.arraycopy(this.data, this.dataPos,
 					 bytes, 0,
@@ -110,8 +108,24 @@
 					System.arraycopy(this.seed,
 							 0,
 							 this.data,
-							 SEED_SIZE,
+							 0,
 							 SEED_SIZE);
+					this.data[SEED_SIZE    ] =
+						(byte)(this.counter);
+					this.data[SEED_SIZE + 1] =
+						(byte)(this.counter >>  8);
+					this.data[SEED_SIZE + 2] =
+						(byte)(this.counter >> 16);
+					this.data[SEED_SIZE + 3] =
+						(byte)(this.counter >> 24);
+					this.data[SEED_SIZE + 4] =
+						(byte)(this.counter >> 32);
+					this.data[SEED_SIZE + 5] =
+						(byte)(this.counter >> 40);
+					this.data[SEED_SIZE + 6] =
+						(byte)(this.counter >> 48);
+					this.data[SEED_SIZE + 7] =
+						(byte)(this.counter >> 56);
 					digest = this.md.digest(this.data);
 					System.arraycopy(digest,
 							 0,

--0-1838121665-1023995606=:34156--