summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 21:48:14 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 21:48:14 +0700
commitdb0c88a3eae79a534ff1854089cff24fbf46c7e2 (patch)
treeb73aad3bd3e699ad8af4e29626e3e5b2659d23c2
parentMisc. asn1 changes from Java API (diff)
downloadBouncyCastle.NET-ed25519-db0c88a3eae79a534ff1854089cff24fbf46c7e2.tar.xz
Additional fix to GOFB mode
-rw-r--r--crypto/src/crypto/modes/GOFBBlockCipher.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/src/crypto/modes/GOFBBlockCipher.cs b/crypto/src/crypto/modes/GOFBBlockCipher.cs
index 4299f11a9..436b58a1d 100644
--- a/crypto/src/crypto/modes/GOFBBlockCipher.cs
+++ b/crypto/src/crypto/modes/GOFBBlockCipher.cs
@@ -171,7 +171,10 @@ namespace Org.BouncyCastle.Crypto.Modes
 			N4 += C1;
             if (N4 < C1)  // addition is mod (2**32 - 1)
             {
-                N4++;
+                if (N4 > 0)
+                {
+                    N4++;
+                }
             }
             intTobytes(N3, ofbV, 0);
 			intTobytes(N4, ofbV, 4);