man.bsd.lv manual page server

Manual Page Search Parameters

CRYPTO_LOCK(3) Library Functions Manual CRYPTO_LOCK(3)

CRYPTO_THREADID_current, CRYPTO_THREADID_cmp, CRYPTO_THREADID_cpy, CRYPTO_THREADID_hash, CRYPTO_lock, CRYPTO_w_lock, CRYPTO_w_unlock, CRYPTO_r_lock, CRYPTO_r_unlock, CRYPTO_addthread support

#include <openssl/crypto.h>

void
CRYPTO_THREADID_current(CRYPTO_THREADID *id);

int
CRYPTO_THREADID_cmp(const CRYPTO_THREADID *a, const CRYPTO_THREADID *b);

void
CRYPTO_THREADID_cpy(CRYPTO_THREADID *dest, const CRYPTO_THREADID *src);

unsigned long
CRYPTO_THREADID_hash(const CRYPTO_THREADID *id);

void
CRYPTO_lock(int mode, int type, const char *file, int line);

int
CRYPTO_add(int *p, int amount, int type);

#define	CRYPTO_w_lock(type) \
	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE, type, __FILE__, __LINE__)
#define	CRYPTO_w_unlock(type) \
	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE, type, __FILE__, __LINE__)
#define	CRYPTO_r_lock(type) \
	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ, type, __FILE__, __LINE__)
#define	CRYPTO_r_unlock(type) \
	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ, type, __FILE__, __LINE__)

These functions are obsolete.

() stores a unique identifier of the currently executing thread into the opaque object id.

() copies the contents of src to dest.

() 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, () is a wrapper around pthread_mutex_lock(3) and pthread_mutex_unlock(3).

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

CRYPTO_THREADID_cmp() returns 0 if a and b refer to the same thread or a non-zero value otherwise.

CRYPTO_THREADID_hash() returns a numeric value usable as a hash-table key. In the LibreSSL implementation, it is the value returned from pthread_self(3) for the thread id.

CRYPTO_add() returns the new value of *p.

crypto(3)

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.

CRYPTO_THREADID_current(), CRYPTO_THREADID_cmp(), CRYPTO_THREADID_cpy(), and CRYPTO_THREADID_hash() first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9.

March 10, 2019 OpenBSD-7.0