diff options
author | David Hook <dgh@bouncycastle.org> | 2017-07-10 13:10:40 +1000 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2017-07-10 13:10:40 +1000 |
commit | 0ae5e68f5618ba8a4e02cc2bfb73116377056f14 (patch) | |
tree | d2fdb35e6a4bf3b594a8395537e9dba7664b8f99 | |
parent | added KCCM (diff) | |
download | BouncyCastle.NET-ed25519-0ae5e68f5618ba8a4e02cc2bfb73116377056f14.tar.xz |
fixed reset issue
-rw-r--r-- | crypto/src/crypto/modes/KCcmBlockCipher.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/src/crypto/modes/KCcmBlockCipher.cs b/crypto/src/crypto/modes/KCcmBlockCipher.cs index b5f121cef..8f1ed9c6f 100644 --- a/crypto/src/crypto/modes/KCcmBlockCipher.cs +++ b/crypto/src/crypto/modes/KCcmBlockCipher.cs @@ -277,6 +277,8 @@ namespace Org.BouncyCastle.Crypto.Modes output[outOff + byteIndex] = (byte)(buffer[byteIndex] ^ macBlock[byteIndex]); } + Array.Copy(macBlock, 0, mac, 0, macSize); + Reset(); return len + macSize; @@ -340,7 +342,7 @@ namespace Org.BouncyCastle.Crypto.Modes Reset(); - return len; + return len - macSize; } } @@ -388,7 +390,6 @@ namespace Org.BouncyCastle.Crypto.Modes public virtual byte[] GetMac() { - Array.Copy(macBlock, 0, mac, 0, macSize); return Arrays.Clone(mac); } @@ -407,6 +408,8 @@ namespace Org.BouncyCastle.Crypto.Modes Arrays.Fill(G1, (byte)0); Arrays.Fill(buffer, (byte)0); Arrays.Fill(counter, (byte)0); + Arrays.Fill(macBlock, (byte)0); + counter[0] = 0x01; data.SetLength(0); associatedText.SetLength(0); |