1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/src/crypto/modes/SicBlockCipher.cs b/crypto/src/crypto/modes/SicBlockCipher.cs
index 3e2b8deba..17f86ee10 100644
--- a/crypto/src/crypto/modes/SicBlockCipher.cs
+++ b/crypto/src/crypto/modes/SicBlockCipher.cs
@@ -18,8 +18,7 @@ namespace Org.BouncyCastle.Crypto.Modes
private readonly int blockSize;
private readonly byte[] counter;
private readonly byte[] counterOut;
-
- private byte[] IV = null;
+ private byte[] IV;
/**
* Basic constructor.
@@ -32,6 +31,7 @@ namespace Org.BouncyCastle.Crypto.Modes
this.blockSize = cipher.GetBlockSize();
this.counter = new byte[blockSize];
this.counterOut = new byte[blockSize];
+ this.IV = new byte[blockSize];
}
/**
@@ -108,7 +108,8 @@ namespace Org.BouncyCastle.Crypto.Modes
public virtual void Reset()
{
- Array.Copy(IV, 0, counter, 0, counter.Length);
+ Arrays.Fill(counter, (byte)0);
+ Array.Copy(IV, 0, counter, 0, System.Math.Min(IV.Length, counter.Length));
cipher.Reset();
}
}
|