CRYPTO_memcmp.3ossl - Man Page

Constant time memory comparison

Synopsis

 #include <openssl/crypto.h>

 int CRYPTO_memcmp(const void *a, const void *b, size_t len);

Description

The CRYPTO_memcmp function compares the len bytes pointed to by a and b for equality. It takes an amount of time dependent on len, but independent of the contents of the memory regions pointed to by a and b.

Return Values

CRYPTO_memcmp() returns 0 if the memory regions are equal and nonzero otherwise.

Notes

Unlike memcmp(2), this function cannot be used to order the two memory regions as the return value when they differ is undefined, other than being nonzero.

Info

2024-04-04 3.2.1 OpenSSL