diff --git a/crypto/src/crypto/signers/Ed25519Signer.cs b/crypto/src/crypto/signers/Ed25519Signer.cs
index e58d14ea4..eb3d25398 100644
--- a/crypto/src/crypto/signers/Ed25519Signer.cs
+++ b/crypto/src/crypto/signers/Ed25519Signer.cs
@@ -98,7 +98,10 @@ namespace Org.BouncyCastle.Crypto.Signers
internal bool VerifySignature(Ed25519PublicKeyParameters publicKey, byte[] signature)
{
if (Ed25519.SignatureSize != signature.Length)
+ {
+ Reset();
return false;
+ }
lock (this)
{
diff --git a/crypto/src/crypto/signers/Ed25519ctxSigner.cs b/crypto/src/crypto/signers/Ed25519ctxSigner.cs
index 2b5296e96..3610e25de 100644
--- a/crypto/src/crypto/signers/Ed25519ctxSigner.cs
+++ b/crypto/src/crypto/signers/Ed25519ctxSigner.cs
@@ -100,7 +100,10 @@ namespace Org.BouncyCastle.Crypto.Signers
internal bool VerifySignature(Ed25519PublicKeyParameters publicKey, byte[] ctx, byte[] signature)
{
if (Ed25519.SignatureSize != signature.Length)
+ {
+ Reset();
return false;
+ }
lock (this)
{
diff --git a/crypto/src/crypto/signers/Ed25519phSigner.cs b/crypto/src/crypto/signers/Ed25519phSigner.cs
index cb3c3080a..8f4afab19 100644
--- a/crypto/src/crypto/signers/Ed25519phSigner.cs
+++ b/crypto/src/crypto/signers/Ed25519phSigner.cs
@@ -74,7 +74,10 @@ namespace Org.BouncyCastle.Crypto.Signers
if (forSigning || null == publicKey)
throw new InvalidOperationException("Ed25519phSigner not initialised for verification");
if (Ed25519.SignatureSize != signature.Length)
+ {
+ prehash.Reset();
return false;
+ }
byte[] pk = publicKey.GetEncoded();
return Ed25519.VerifyPrehash(signature, 0, pk, 0, context, prehash);
diff --git a/crypto/src/crypto/signers/Ed448Signer.cs b/crypto/src/crypto/signers/Ed448Signer.cs
index 9d1495f2e..746029834 100644
--- a/crypto/src/crypto/signers/Ed448Signer.cs
+++ b/crypto/src/crypto/signers/Ed448Signer.cs
@@ -100,7 +100,10 @@ namespace Org.BouncyCastle.Crypto.Signers
internal bool VerifySignature(Ed448PublicKeyParameters publicKey, byte[] ctx, byte[] signature)
{
if (Ed448.SignatureSize != signature.Length)
+ {
+ Reset();
return false;
+ }
lock (this)
{
diff --git a/crypto/src/crypto/signers/Ed448phSigner.cs b/crypto/src/crypto/signers/Ed448phSigner.cs
index f01b6bfd4..197c2f706 100644
--- a/crypto/src/crypto/signers/Ed448phSigner.cs
+++ b/crypto/src/crypto/signers/Ed448phSigner.cs
@@ -74,7 +74,10 @@ namespace Org.BouncyCastle.Crypto.Signers
if (forSigning || null == publicKey)
throw new InvalidOperationException("Ed448phSigner not initialised for verification");
if (Ed448.SignatureSize != signature.Length)
+ {
+ prehash.Reset();
return false;
+ }
byte[] pk = publicKey.GetEncoded();
return Ed448.VerifyPrehash(signature, 0, pk, 0, context, prehash);
|