From 9bb5fb0429b84de6d544bd74bfdefcc197687bed Mon Sep 17 00:00:00 2001 From: David Hook Date: Fri, 15 Jan 2016 04:43:03 +1100 Subject: counter needs to based on maxlen(p) as tag done on J0 --- crypto/src/crypto/modes/GCMBlockCipher.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crypto/src') diff --git a/crypto/src/crypto/modes/GCMBlockCipher.cs b/crypto/src/crypto/modes/GCMBlockCipher.cs index fbbc242a1..9d940fe75 100644 --- a/crypto/src/crypto/modes/GCMBlockCipher.cs +++ b/crypto/src/crypto/modes/GCMBlockCipher.cs @@ -174,7 +174,7 @@ namespace Org.BouncyCastle.Crypto.Modes this.atLength = 0; this.atLengthPre = 0; this.counter = Arrays.Clone(J0); - this.blocksRemaining = uint.MaxValue; // page 8, len(P) <= 2^39 - 256, 1 block used by tag + this.blocksRemaining = uint.MaxValue - 1; // page 8, len(P) <= 2^39 - 256, 1 block used by tag this.bufOff = 0; this.totalLength = 0; @@ -449,7 +449,7 @@ namespace Org.BouncyCastle.Crypto.Modes atLength = 0; atLengthPre = 0; counter = Arrays.Clone(J0); - blocksRemaining = uint.MaxValue; + blocksRemaining = uint.MaxValue - 1; bufOff = 0; totalLength = 0; -- cgit 1.5.1