Blast-Radius Aware AI Code Review for Business-Critical Systems
LiveReview LiveReview Explore LiveReview

CRYPTO_memcmp - Constant time memory comparison

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.

Name

       CRYPTO_memcmp - Constant time memory comparison

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.

Return Values

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

Synopsis

        #include <openssl/crypto.h>

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

See Also