From d5444a1292a4b67dea5d0278e169abb7aaad7a3a Mon Sep 17 00:00:00 2001 From: David Hook Date: Tue, 7 Mar 2017 10:24:47 +1100 Subject: Fixed N4 calculation issue - see BJA-655 --- crypto/src/crypto/modes/GOFBBlockCipher.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'crypto/src') 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); -- cgit 1.4.1