crypto: add preemptive threading support
authorČestmír Kalina <ckalina@redhat.com>
Mon, 27 Sep 2021 20:42:11 +0000 (22:42 +0200)
committerMatt Caswell <matt@openssl.org>
Mon, 17 Oct 2022 08:45:39 +0000 (09:45 +0100)
commit4574a7fd8dda070b129d76defca07703cab53842
treea6e03446b0f784e550010a2c51efe5b7861e9473
parentb1372197496650c3cb318cade911a3bd6af14adc
crypto: add preemptive threading support

Some primitives are designed to be used in a multi-threaded environment,
if supported, e.g., Argon2.

This patch adds support for preemptive threading and basic synchronization
primitives for platforms compliant with POSIX threads or Windows CRT.
Native functions are wrapped to provide a common (internal) API.

Threading support can be disabled at compile time. If enabled, threading
is disabled by default and needs to be explicitly enabled by the user.

Thread enablement requires an explicit limit on the number of threads that
OpenSSL may spawn (non-negative integer/infinity). The limit may be changed.

Signed-off-by: Čestmír Kalina <ckalina@redhat.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12255)
20 files changed:
Configure
INSTALL.md
crypto/build.info
crypto/context.c
crypto/thread/api.c [new file with mode: 0644]
crypto/thread/arch.c [new file with mode: 0644]
crypto/thread/arch/thread_none.c [new file with mode: 0644]
crypto/thread/arch/thread_posix.c [new file with mode: 0644]
crypto/thread/arch/thread_win.c [new file with mode: 0644]
crypto/thread/build.info [new file with mode: 0644]
crypto/thread/internal.c [new file with mode: 0644]
doc/man3/CRYPTO_THREAD_run_once.pod
include/crypto/context.h
include/internal/cryptlib.h
include/internal/thread.h [new file with mode: 0644]
include/internal/thread_arch.h [new file with mode: 0644]
include/openssl/thread.h [new file with mode: 0644]
test/build.info
test/threadstest.c
util/libcrypto.num