Browse Source

Do not accept the point at infinity as valid public key for ecrecover.

cl-refactor
chriseth 10 years ago
parent
commit
33ffc693ed
  1. 2
      libdevcrypto/CryptoPP.cpp

2
libdevcrypto/CryptoPP.cpp

@ -287,6 +287,8 @@ Public Secp256k1PP::recover(Signature _signature, bytesConstRef _message)
{ {
// todo: make generator member // todo: make generator member
p = m_curve.CascadeMultiply(u2, x, u1, m_params.GetSubgroupGenerator()); p = m_curve.CascadeMultiply(u2, x, u1, m_params.GetSubgroupGenerator());
if (p.identity)
return Public();
m_curve.EncodePoint(recoveredbytes, p, false); m_curve.EncodePoint(recoveredbytes, p, false);
} }
memcpy(recovered.data(), &recoveredbytes[1], 64); memcpy(recovered.data(), &recoveredbytes[1], 64);

Loading…
Cancel
Save