summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2016-01-17 12:32:24 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2016-01-17 12:32:24 +0700
commit4819cab88fdd657bd64c672ff62e255a5cc1fe3e (patch)
treeeba6bc580707be8a5b8d969b43cbf83949dcfb34 /crypto/src
parentRemove expired draft-josefsson-salsa20-tls stuff (diff)
downloadBouncyCastle.NET-ed25519-4819cab88fdd657bd64c672ff62e255a5cc1fe3e.tar.xz
Fix re-init bug in HC128/256 engines
- add StreamCipherResetTest from Java API
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/engines/HC128Engine.cs4
-rw-r--r--crypto/src/crypto/engines/HC256Engine.cs2
2 files changed, 3 insertions, 3 deletions
diff --git a/crypto/src/crypto/engines/HC128Engine.cs b/crypto/src/crypto/engines/HC128Engine.cs

index 7bd1a48ed..b83eb7083 100644 --- a/crypto/src/crypto/engines/HC128Engine.cs +++ b/crypto/src/crypto/engines/HC128Engine.cs
@@ -107,7 +107,8 @@ namespace Org.BouncyCastle.Crypto.Engines if (key.Length != 16) throw new ArgumentException("The key must be 128 bits long"); - cnt = 0; + idx = 0; + cnt = 0; uint[] w = new uint[1280]; @@ -223,7 +224,6 @@ namespace Org.BouncyCastle.Crypto.Engines public virtual void Reset() { - idx = 0; Init(); } diff --git a/crypto/src/crypto/engines/HC256Engine.cs b/crypto/src/crypto/engines/HC256Engine.cs
index b72258a19..d8d83a634 100644 --- a/crypto/src/crypto/engines/HC256Engine.cs +++ b/crypto/src/crypto/engines/HC256Engine.cs
@@ -92,6 +92,7 @@ namespace Org.BouncyCastle.Crypto.Engines iv = newIV; } + idx = 0; cnt = 0; uint[] w = new uint[2560]; @@ -207,7 +208,6 @@ namespace Org.BouncyCastle.Crypto.Engines public virtual void Reset() { - idx = 0; Init(); }