summaryrefslogtreecommitdiff
path: root/xed25519.cpp
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-12-26 19:55:12 -0500
committerJeffrey Walton <noloader@gmail.com>2018-12-26 19:55:12 -0500
commitd5338fd21249310a97fd0caf61d8d2768ae024a2 (patch)
treeb795ed9247cc5193d9e313f176719c2b1d109ee9 /xed25519.cpp
parent1fc26dc14c8fb4a51515b6f6a146baa59238cf90 (diff)
downloadcryptopp-git-d5338fd21249310a97fd0caf61d8d2768ae024a2.tar.gz
Remove unneeded buf compare
Diffstat (limited to 'xed25519.cpp')
-rw-r--r--xed25519.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/xed25519.cpp b/xed25519.cpp
index d9eae90a..900f4ab8 100644
--- a/xed25519.cpp
+++ b/xed25519.cpp
@@ -269,10 +269,8 @@ bool x25519::Validate(RandomNumberGenerator &rng, unsigned int level) const
SecByteBlock sk(m_sk, SECRET_KEYLENGTH), pk(PUBLIC_KEYLENGTH);
ClampKeys(pk, sk);
- bool equal = true;
- equal &= VerifyBufsEqual(pk, m_pk, PUBLIC_KEYLENGTH);
- equal &= VerifyBufsEqual(sk, m_sk, SECRET_KEYLENGTH);
- if (equal == false)
+ // Secret key is already clamped, bufs are equal
+ if (VerifyBufsEqual(pk, m_pk, PUBLIC_KEYLENGTH) == false)
return false;
}
@@ -396,10 +394,8 @@ bool ed25519PrivateKey::Validate(RandomNumberGenerator &rng, unsigned int level)
SecByteBlock sk(m_sk, SECRET_KEYLENGTH), pk(PUBLIC_KEYLENGTH);
ClampKeys(pk, sk);
- bool equal = true;
- equal &= VerifyBufsEqual(pk, m_pk, PUBLIC_KEYLENGTH);
- equal &= VerifyBufsEqual(sk, m_sk, SECRET_KEYLENGTH);
- if (equal == false)
+ // Secret key is already clamped, bufs are equal
+ if (VerifyBufsEqual(pk, m_pk, PUBLIC_KEYLENGTH) == false)
return false;
}