Remove unneeded buf compare

This commit is contained in:
Jeffrey Walton 2018-12-26 19:55:12 -05:00
parent 1fc26dc14c
commit d5338fd212
No known key found for this signature in database
GPG Key ID: B36AB348921B1838

View File

@ -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;
}