diff --git a/core/src/main/java/org/bouncycastle/crypto/modes/KGCMBlockCipher.java b/core/src/main/java/org/bouncycastle/crypto/modes/KGCMBlockCipher.java index d0483a2bce..318b73516f 100755 --- a/core/src/main/java/org/bouncycastle/crypto/modes/KGCMBlockCipher.java +++ b/core/src/main/java/org/bouncycastle/crypto/modes/KGCMBlockCipher.java @@ -99,6 +99,7 @@ public void init(boolean forEncryption, CipherParameters params) newNonce = aeadParameters.getNonce(); initialAssociatedText = aeadParameters.getAssociatedText(); + associatedText.reset(); macSize = macSizeInBits / 8; keyParameter = aeadParameters.getKey(); @@ -113,6 +114,7 @@ else if (params instanceof ParametersWithIV) newNonce = withIV.getIV(); initialAssociatedText = null; + associatedText.reset(); macSize = blockSize; // Set default mac size CipherParameters innerParameters = withIV.getParameters();