CRYPTO_MEMCMP(3)
π NAME π
okay so welcome to the CRYPTO_memcmp(3) page from the Library Functions Manual, aka the libcrypto girlie π
this one is all about constant time memory comparison β no cap, it's giving secure little helper energy π«Ά
β¨ SYNOPSIS β¨
library βlibcryptoβ #include <openssl/crypto.h>
int
CRYPTO_memcmp(const void *a, const void *b, size_t len);
πΈ DESCRIPTION πΈ
CRYPTO_memcmp() compares the len bytes pointed to by a and b for equality π
the way it works timing-wise: it takes an amount of time dependent on len, but independent of the contents of the memory regions pointed to by a and b β¨ so the clock is basically like βhow many bytes, bestie?β and not βwhatβs inside them?β π
π¦ RETURN VALUES π¦
CRYPTO_memcmp()returns0if the content of the memory regions is equal π- or non-zero otherwise π
π HISTORY π
CRYPTO_memcmp()first appeared in OpenSSL 1.0.1d π₯- and has been available since OpenBSD 5.6 π
π BUGS π
- unlike
memcmp(3)andtimingsafe_memcmp(3), this function cannot be used to order the two memory regions π like, it is not a sorting vibe, periodt - in the current implementation, the return value is always greater than or equal to
0π§
xoxo, this page is from Debian and dated June 8, 2025 π stay constant-time, bestie π
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2019 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms