utils: Add a constant time memeq() variant for cryptographic purposes
This commit is contained in:
@@ -184,6 +184,11 @@ static inline bool memeq(const void *x, const void *y, size_t len)
|
||||
return memcmp(x, y, len) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as memeq(), but with a constant runtime, safe for cryptographic use.
|
||||
*/
|
||||
bool memeq_const(const void *x, const void *y, size_t len);
|
||||
|
||||
/**
|
||||
* Calling memcpy() with NULL pointers, even with n == 0, results in undefined
|
||||
* behavior according to the C standard. This version is guaranteed to not
|
||||
|
||||
Reference in New Issue
Block a user