summary refs log tree commit diff
path: root/crypto/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-05-11 15:51:29 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-05-11 15:51:29 +0700
commit5bd6847669a1e2244a891f1121dad911ca7f8157 (patch)
tree75393ee2b9903d0626f9e0ba55e40fa2fbea355c /crypto/src
parentCheck EncryptionAlgorithm explicitly (diff)
downloadBouncyCastle.NET-ed25519-5bd6847669a1e2244a891f1121dad911ca7f8157.tar.xz
Improve HMac reset
Diffstat (limited to 'crypto/src')
-rw-r--r--crypto/src/crypto/macs/HMac.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/src/crypto/macs/HMac.cs b/crypto/src/crypto/macs/HMac.cs
index 460f3c5a0..3d42aec0f 100644
--- a/crypto/src/crypto/macs/HMac.cs
+++ b/crypto/src/crypto/macs/HMac.cs
@@ -136,11 +136,15 @@ namespace Org.BouncyCastle.Crypto.Macs
         */
         public virtual void Reset()
         {
-			// Reset underlying digest
-            digest.Reset();
-
-			// Initialise the digest
-            digest.BlockUpdate(inputPad, 0, inputPad.Length);
+            if (ipadState != null)
+            {
+                ((IMemoable)digest).Reset(ipadState);
+            }
+            else
+            {
+                digest.Reset();
+                digest.BlockUpdate(inputPad, 0, inputPad.Length);
+            }
         }
 
         private static void XorPad(byte[] pad, int len, byte n)