carta
libressl-CRYPTO_lock(3)

libressl-CRYPTO_lock3

Thread support

Usage

Crypto Library (libcrypto, -lcrypto)

void

int

Overview

These functions are obsolete.

CRYPTO_lock() locks or unlocks a mutex lock.

mode is a bitfield describing what should be done with the lock. For each call, either CRYPTO_LOCK or CRYPTO_UNLOCK must be included. In the LibreSSL implementation, CRYPTO_READ and CRYPTO_WRITE are ignored.

type is a number in the range 0 <= type < CRYPTO_NUM_LOCKS identifying a particular lock. Currently, the value of CRYPTO_NUM_LOCKS is 41.

The file and line arguments are ignored.

In the LibreSSL implementation, CRYPTO_lock() is a wrapper around pthread_mutex_lock(3) and pthread_mutex_unlock(3).

CRYPTO_add() locks the lock number type, adds amount to *p, and unlocks the lock number type again.

Return values

CRYPTO_add() returns the new value of *p.

History

CRYPTO_lock(), CRYPTO_w_lock(), CRYPTO_w_unlock(), CRYPTO_r_lock(), and CRYPTO_r_unlock() first appeared in SSLeay 0.6.0. CRYPTO_add() first appeared in SSLeay 0.6.2. These functions have been available since OpenBSD 2.4.

From libressl 4.4.0-1 in Arch Linux 2026-11-01. Parsed by carta from the page's mdoc source.