summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-11-16 14:51:48 +0100
committerTomas Mraz <tomas@openssl.org>2022-11-22 17:08:23 +0100
commitf5a3669c8bc9cd1ea00f2bb7d058a752e6d2f152 (patch)
tree690249a77b2a4470b9b66f92c9cae6db4af63926 /crypto
parent26cfa4cd85f6b26dd7a48c2ff06bfa4a2cea4764 (diff)
downloadopenssl-new-f5a3669c8bc9cd1ea00f2bb7d058a752e6d2f152.tar.gz
Add functions supporting thread pool only when it is enabled
Fixes #19691 Reviewed-by: Hugo Landau <hlandau@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19695)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/context.c6
-rw-r--r--crypto/thread/arch.c17
-rw-r--r--crypto/thread/build.info6
-rw-r--r--crypto/thread/internal.c4
4 files changed, 8 insertions, 25 deletions
diff --git a/crypto/context.c b/crypto/context.c
index 173256bcfb..dcd9a1396b 100644
--- a/crypto/context.c
+++ b/crypto/context.c
@@ -174,7 +174,7 @@ static int context_init(OSSL_LIB_CTX *ctx)
goto err;
#endif
-#if defined(OPENSSL_THREADS)
+#ifndef OPENSSL_NO_THREAD_POOL
ctx->threads = ossl_threads_ctx_new(ctx);
if (ctx->threads == NULL)
goto err;
@@ -308,7 +308,7 @@ static void context_deinit_objs(OSSL_LIB_CTX *ctx)
}
#endif
-#if defined(OPENSSL_THREADS)
+#ifndef OPENSSL_NO_THREAD_POOL
if (ctx->threads != NULL) {
ossl_threads_ctx_free(ctx->threads);
ctx->threads = NULL;
@@ -551,7 +551,7 @@ void *ossl_lib_ctx_get_data(OSSL_LIB_CTX *ctx, int index)
case OSSL_LIB_CTX_SELF_TEST_CB_INDEX:
return ctx->self_test_cb;
#endif
-#if defined(OPENSSL_THREADS)
+#ifndef OPENSSL_NO_THREAD_POOL
case OSSL_LIB_CTX_THREAD_INDEX:
return ctx->threads;
#endif
diff --git a/crypto/thread/arch.c b/crypto/thread/arch.c
index 3dddcb10a8..8d6f477706 100644
--- a/crypto/thread/arch.c
+++ b/crypto/thread/arch.c
@@ -10,8 +10,6 @@
#include <openssl/configuration.h>
#include <internal/thread_arch.h>
-#if defined(OPENSSL_THREADS)
-
CRYPTO_THREAD *ossl_crypto_thread_native_start(CRYPTO_THREAD_ROUTINE routine,
void *data, int joinable)
{
@@ -133,18 +131,3 @@ int ossl_crypto_thread_native_clean(CRYPTO_THREAD *handle)
return 1;
}
-
-#else
-
-CRYPTO_THREAD *ossl_crypto_thread_native_start(CRYPTO_THREAD_ROUTINE routine,
- void *data, int joinable)
-{
- return NULL;
-}
-
-int ossl_crypto_thread_native_clean(CRYPTO_THREAD *handle)
-{
- return 0;
-}
-
-#endif
diff --git a/crypto/thread/build.info b/crypto/thread/build.info
index 3ab689d4a4..1e9b97d48a 100644
--- a/crypto/thread/build.info
+++ b/crypto/thread/build.info
@@ -1,8 +1,12 @@
LIBS=../../libcrypto
-$THREADS=\
+IF[{- !$disabled{'thread-pool'} -}]
+ $THREADS=\
api.c internal.c arch.c \
arch/thread_win.c arch/thread_posix.c arch/thread_none.c
+ELSE
+ $THREADS=api.c
+ENDIF
SOURCE[../../libcrypto]=$THREADS
SOURCE[../../providers/libfips.a]=$THREADS
diff --git a/crypto/thread/internal.c b/crypto/thread/internal.c
index 22af876cd7..4d966f3e53 100644
--- a/crypto/thread/internal.c
+++ b/crypto/thread/internal.c
@@ -124,8 +124,6 @@ int ossl_crypto_thread_clean(void *vhandle)
#endif
-#if defined(OPENSSL_THREADS)
-
void *ossl_threads_ctx_new(OSSL_LIB_CTX *ctx)
{
struct openssl_threads_st *t = OPENSSL_zalloc(sizeof(*t));
@@ -157,5 +155,3 @@ void ossl_threads_ctx_free(void *vdata)
ossl_crypto_condvar_free(&t->cond_finished);
OPENSSL_free(t);
}
-
-#endif