diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-10-18 12:51:13 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2015-10-18 12:51:13 +0700 |
commit | 6631312ae9e239fb62a7ec0f8573c275c5743dda (patch) | |
tree | 5f7746d46eea9a4d68b873b91a161a0e91cb28cb /crypto | |
parent | Add CalculateMac utility method (diff) | |
download | BouncyCastle.NET-ed25519-6631312ae9e239fb62a7ec0f8573c275c5743dda.tar.xz |
Followups for the SicBlockCipher changes
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/crypto/modes/SicBlockCipher.cs | 7 | ||||
-rw-r--r-- | crypto/test/src/test/BlockCipherTest.cs | 1 |
2 files changed, 5 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(); } } diff --git a/crypto/test/src/test/BlockCipherTest.cs b/crypto/test/src/test/BlockCipherTest.cs index 2e8e8b0b8..93cf2b0a5 100644 --- a/crypto/test/src/test/BlockCipherTest.cs +++ b/crypto/test/src/test/BlockCipherTest.cs @@ -438,6 +438,7 @@ namespace Org.BouncyCastle.Tests { // TODO Examine short IV handling for these FIPS-compliant modes in Java build if (mode.StartsWith("CFB") + || mode.StartsWith("CTR") || mode.StartsWith("GOFB") || mode.StartsWith("OFB") || mode.StartsWith("OPENPGPCFB")) |