mbedtls_ct_memcmp() function
Constant-time buffer comparison without branches. This is equivalent to the standard memcmp function, but is likely to be compiled to code using bitwise operation rather than a branch. This function can be used to write constant-time code by replacing branches with bit operations using masks.
Syntax
int mbedtls_ct_memcmp(const void *a,
const void *b,
size_t n);
Arguments
a
Pointer to the first buffer.
b
Pointer to the second buffer.
n
The number of bytes to compare in the buffer.
Return value
Zero if the content of the two buffer is the same, otherwise non-zero.