add and use constant time 32 byte equality function

This commit is contained in:
moneromooo-monero 2018-06-13 18:23:06 +01:00
parent 510dbf3329
commit d2e26c23f3
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
9 changed files with 130 additions and 14 deletions

View file

@ -136,7 +136,8 @@ namespace hw {
}
bool operator==(const crypto::key_derivation &d0, const crypto::key_derivation &d1) {
return !memcmp(&d0, &d1, sizeof(d0));
static_assert(sizeof(crypto::key_derivation) == 32, "key_derivation must be 32 bytes");
return !crypto_verify_32((const unsigned char*)&d0, (const unsigned char*)&d1);
}
/* ===================================================================== */