summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 22:09:39 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2017-06-10 22:09:39 +0700
commit5c185fa4dbb26af89b5cab888013f490e378ff36 (patch)
treeb27c5e70714142c2cf98080604c529b8ea58acd9 /crypto
parentAdd Reseed method to SP800SecureRandom (diff)
downloadBouncyCastle.NET-ed25519-5c185fa4dbb26af89b5cab888013f490e378ff36.tar.xz
Fix reset for ISO9792-2 scheme
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/crypto/signers/Iso9796d2PssSigner.cs5
-rw-r--r--crypto/src/crypto/signers/Iso9796d2Signer.cs6
2 files changed, 10 insertions, 1 deletions
diff --git a/crypto/src/crypto/signers/Iso9796d2PssSigner.cs b/crypto/src/crypto/signers/Iso9796d2PssSigner.cs
index 3aa2e3719..6b8037095 100644
--- a/crypto/src/crypto/signers/Iso9796d2PssSigner.cs
+++ b/crypto/src/crypto/signers/Iso9796d2PssSigner.cs
@@ -516,6 +516,7 @@ namespace Org.BouncyCastle.Crypto.Signers
             if (!isOkay)
             {
                 fullMessage = false;
+                messageLength = 0;
                 ClearBlock(recoveredMessage);
                 return false;
             }
@@ -528,12 +529,14 @@ namespace Org.BouncyCastle.Crypto.Signers
             {
                 if (!IsSameAs(mBuf, recoveredMessage))
                 {
+                    messageLength = 0;
                     ClearBlock(mBuf);
                     return false;
                 }
-                messageLength = 0;
             }
 
+            messageLength = 0;
+
             ClearBlock(mBuf);
             return true;
         }
diff --git a/crypto/src/crypto/signers/Iso9796d2Signer.cs b/crypto/src/crypto/signers/Iso9796d2Signer.cs
index b90ed8f0b..303913068 100644
--- a/crypto/src/crypto/signers/Iso9796d2Signer.cs
+++ b/crypto/src/crypto/signers/Iso9796d2Signer.cs
@@ -360,6 +360,8 @@ namespace Org.BouncyCastle.Crypto.Signers
 
             byte[] b = cipher.ProcessBlock(block, 0, block.Length);
 
+            messageLength = 0;
+
             ClearBlock(mBuf);
             ClearBlock(block);
 
@@ -526,11 +528,15 @@ namespace Org.BouncyCastle.Crypto.Signers
             ClearBlock(mBuf);
             ClearBlock(block);
 
+            messageLength = 0;
+
             return true;
         }
 
         private bool ReturnFalse(byte[] block)
         {
+            messageLength = 0;
+
             ClearBlock(mBuf);
             ClearBlock(block);