Mbed TLS v2.28.9
|
#include <stddef.h>
Go to the source code of this file.
Functions | |
int | mbedtls_ct_memcmp (const void *a, const void *b, size_t n) |
int mbedtls_ct_memcmp | ( | const void * | a, |
const void * | b, | ||
size_t | n ) |
Constant-time functions
Copyright The Mbed TLS Contributors SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 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.
a | Pointer to the first buffer. |
b | Pointer to the second buffer. |
n | The number of bytes to compare in the buffer. |