hello there, the attached patch --already committed-- adds implementations of Cloneable for TMMH16 and supporting classes.
2006-02-24 Raif S. Naffah <[EMAIL PROTECTED]>
* gnu/javax/crypto/mac/TMMH16.java (clone): New method.
* gnu/java/security/prng/MDGenerator.java (clone): New method.
* gnu/java/security/prng/BasePRNG.java (clone): Clone buffer.
all tests in Mauve gnu/testlet/gnu/javax/crypto/jce/TestOfMac should now
pass.
cheers;
rsn
Index: BasePRNG.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/security/prng/BasePRNG.java,v
retrieving revision 1.1
diff -u -r1.1 BasePRNG.java
--- BasePRNG.java 26 Jan 2006 02:25:11 -0000 1.1
+++ BasePRNG.java 24 Feb 2006 11:10:47 -0000
@@ -186,7 +186,11 @@
public Object clone() throws CloneNotSupportedException
{
- return super.clone();
+ BasePRNG result = (BasePRNG) super.clone();
+ if (this.buffer != null)
+ result.buffer = this.buffer.clone();
+
+ return result;
}
public abstract void setup(Map attributes);
Index: MDGenerator.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/security/prng/MDGenerator.java,v
retrieving revision 1.1
diff -u -r1.1 MDGenerator.java
--- MDGenerator.java 26 Jan 2006 02:25:11 -0000 1.1
+++ MDGenerator.java 24 Feb 2006 11:11:57 -0000
@@ -121,4 +121,15 @@
buffer = mdc.digest();
md.update(buffer, 0, buffer.length);
}
+
+ // Cloneable interface implementation ---------------------------------------
+
+ public Object clone() throws CloneNotSupportedException
+ {
+ MDGenerator result = (MDGenerator) super.clone();
+ if (this.md != null)
+ result.md = (IMessageDigest) this.md.clone();
+
+ return result;
+ }
}
Index: TMMH16.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/javax/crypto/mac/TMMH16.java,v
retrieving revision 1.1
diff -u -r1.1 TMMH16.java
--- TMMH16.java 26 Jan 2006 02:25:09 -0000 1.1
+++ TMMH16.java 24 Feb 2006 11:12:55 -0000
@@ -271,6 +271,30 @@
return valid.booleanValue();
}
+ // Cloneable interface implementation ---------------------------------------
+
+ public Object clone() throws CloneNotSupportedException
+ {
+ TMMH16 result = (TMMH16) super.clone();
+
+ if (this.keystream != null)
+ result.keystream = (IRandom) this.keystream.clone();
+
+ if (this.prefix != null)
+ result.prefix = this.prefix.clone();
+
+ if (this.context != null)
+ result.context = this.context.clone();
+
+ if (this.K0 != null)
+ result.K0 = this.K0.clone();
+
+ if (this.Ki != null)
+ result.Ki = this.Ki.clone();
+
+ return result;
+ }
+
// own methods -------------------------------------------------------------
/**
pgpoYkxQzxYpt.pgp
Description: PGP signature
