diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gnu/java/security/prng/BasePRNG.java | 6 | ||||
-rw-r--r-- | gnu/java/security/prng/MDGenerator.java | 11 | ||||
-rw-r--r-- | gnu/javax/crypto/mac/TMMH16.java | 24 |
4 files changed, 46 insertions, 1 deletions
@@ -1,3 +1,9 @@ +2006-02-24 Raif S. Naffah <raif@swiftdsl.com.au> + + * 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. + 2006-02-23 Roman Kennke <kennke@aicas.com> Reported by Ingo Proetel <proetel@aicas.com> diff --git a/gnu/java/security/prng/BasePRNG.java b/gnu/java/security/prng/BasePRNG.java index 13aa33650..93da3467d 100644 --- a/gnu/java/security/prng/BasePRNG.java +++ b/gnu/java/security/prng/BasePRNG.java @@ -186,7 +186,11 @@ public abstract class BasePRNG implements IRandom 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); diff --git a/gnu/java/security/prng/MDGenerator.java b/gnu/java/security/prng/MDGenerator.java index b43ca33a6..255647d1c 100644 --- a/gnu/java/security/prng/MDGenerator.java +++ b/gnu/java/security/prng/MDGenerator.java @@ -121,4 +121,15 @@ public class MDGenerator extends BasePRNG implements Cloneable 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; + } } diff --git a/gnu/javax/crypto/mac/TMMH16.java b/gnu/javax/crypto/mac/TMMH16.java index 82de3aac9..fcfc38a90 100644 --- a/gnu/javax/crypto/mac/TMMH16.java +++ b/gnu/javax/crypto/mac/TMMH16.java @@ -271,6 +271,30 @@ public class TMMH16 extends BaseMac implements Cloneable 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 ------------------------------------------------------------- /** |