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
9 changed files with 130 additions and 14 deletions
+2 -1
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);
}
/* ===================================================================== */