Sortix
Sortix Download Manual Development Source Code News Blog More
current nightly

Sortix volatile manual

This manual documents Sortix volatile, a development build that has not been officially released. You can instead view this document in the latest official manual.

CRYPTO_MEMCMP(3) Library Functions Manual CRYPTO_MEMCMP(3)

NAME

CRYPTO_memcmp — constant time memory comparison

SYNOPSIS

#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) and timingsafe_memcmp(3), 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.

August 25, 2019 Sortix 1.1.0-dev
Copyright 2011-2025 Jonas 'Sortie' Termansen and contributors.
Sortix's source code is free software under the ISC license.
#sortix on irc.sortix.org
@sortix_org