]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: threads/ssl: Make SSL part thread-safe
authorEmeric Brun <ebrun@haproxy.com>
Thu, 15 Jun 2017 14:37:39 +0000 (16:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:32 +0000 (13:58 +0100)
commit821bb9beaa40b4793ad4617fdf4fdab5ad4a4c7b
treea5285d093c902207968a19bedfe1725aad643fe0
parent6b35e9bfbf0f37c8a584c7aabb475afb81b7008c
MAJOR: threads/ssl: Make SSL part thread-safe

First, OpenSSL is now initialized to be thread-safe. This is done by setting 2
callbacks. The first one is ssl_locking_function. It handles the locks and
unlocks. The second one is ssl_id_function. It returns the current thread
id. During the init step, we create as much as R/W locks as needed, ie the
number returned by CRYPTO_num_locks function.

Next, The reusable SSL session in the server context is now thread-local.

Shctx is now also initialized if HAProxy is started with several threads.

And finally, a global lock has been added to protect the LRU cache used to store
generated certificates. The function ssl_sock_get_generated_cert is now
deprecated because the retrieved certificate can be removed by another threads
in same time. Instead, a new function has been added,
ssl_sock_assign_generated_cert. It must be used to search a certificate in the
cache and set it immediatly if found.
include/common/hathreads.h
include/proto/ssl_sock.h
include/types/server.h
src/ssl_sock.c