summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorDavid Hook <dgh@bouncycastle.org>2017-03-07 10:24:47 +1100
committerDavid Hook <dgh@bouncycastle.org>2017-03-07 10:24:47 +1100
commitd5444a1292a4b67dea5d0278e169abb7aaad7a3a (patch)
tree926a47aa629129c8b51a8cc760cb87ff9a1a5e46 /crypto/src
parentFix bug in SecT571KPoint.Add with order-2 points (lambda-projective). (diff)
downloadBouncyCastle.NET-ed25519-d5444a1292a4b67dea5d0278e169abb7aaad7a3a.tar.xz
Fixed N4 calculation issue - see BJA-655
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/modes/GOFBBlockCipher.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/src/crypto/modes/GOFBBlockCipher.cs b/crypto/src/crypto/modes/GOFBBlockCipher.cs
index a91562549..4299f11a9 100644
--- a/crypto/src/crypto/modes/GOFBBlockCipher.cs
+++ b/crypto/src/crypto/modes/GOFBBlockCipher.cs
@@ -169,7 +169,11 @@ namespace Org.BouncyCastle.Crypto.Modes
 			}
 			N3 += C2;
 			N4 += C1;
-			intTobytes(N3, ofbV, 0);
+            if (N4 < C1)  // addition is mod (2**32 - 1)
+            {
+                N4++;
+            }
+            intTobytes(N3, ofbV, 0);
 			intTobytes(N4, ofbV, 4);
 
 			cipher.ProcessBlock(ofbV, 0, ofbOutV, 0);