---
name: "libressl-CRYPTO_memcmp"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-CRYPTO_memcmp"
---

# libressl-CRYPTO\_memcmp(3)

constant time memory comparison

## NAME

**CRYPTO\_memcmp** – constant time memory comparison

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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. 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 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)](/memcmp/3.md) and [timingsafe\_memcmp(3)](/timingsafe_memcmp/3.md), this function cannot be used to order the two memory regions. In the current implementation, the return value is always greater than or equal to 0.
