CRYPTO_memcmp

Compare two memory regions in constant time with respect to their contents.

Synopsis

Declared in <openssl/crypto.h>

int
CRYPTO_memcmp(
    void const* in_a,
    void const* in_b,
    size_t len);

Description

Runtime depends on len but not on the data at in_a / in_b. Unlike memcmp, the non-zero return value must not be used to sort elements.

Return Value

0 if the len bytes are equal; non-zero otherwise (ordering is undefined).

Parameters

NameDescription
in_aFirst buffer.
in_bSecond buffer.
lenNumber of bytes to compare.