summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRandall S. Becker <rsbecker@nexbridge.com>2021-06-23 14:50:09 -0600
committerPauli <pauli@openssl.org>2021-07-02 12:33:45 +1000
commit6870c1e7b79043a9a85b70de7b2b29276aff235c (patch)
treeed6f84af6d35122e27de64bf407ac531606da787
parentd60e719c2d158a2998412d45c52df25375e10b74 (diff)
Defined out MUTEX attributes not available on NonStop SPT Threads.
Standard Posix Threads (SPT) Threads are an older separate branch of pthreads that do not support some of the capabilities in the current Posix User Threads (PUT). The change also includes a rename of the close field of OSSL_STORE_LOADER which was causing preprocessor conflicts. Fixes #15885 Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com> Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15886)
-rw-r--r--crypto/store/store_lib.c2
-rw-r--r--crypto/store/store_local.h2
-rw-r--r--crypto/store/store_register.c8
-rw-r--r--crypto/threads_pthread.c8
4 files changed, 12 insertions, 8 deletions
diff --git a/crypto/store/store_lib.c b/crypto/store/store_lib.c
index 636a94e832..7dcb939066 100644
--- a/crypto/store/store_lib.c
+++ b/crypto/store/store_lib.c
@@ -514,7 +514,7 @@ static int ossl_store_close_it(OSSL_STORE_CTX *ctx)
ret = ctx->loader->p_close(ctx->loader_ctx);
#ifndef OPENSSL_NO_DEPRECATED_3_0
if (ctx->fetched_loader == NULL)
- ret = ctx->loader->close(ctx->loader_ctx);
+ ret = ctx->loader->closefn(ctx->loader_ctx);
#endif
sk_OSSL_STORE_INFO_pop_free(ctx->cached_info, OSSL_STORE_INFO_free);
diff --git a/crypto/store/store_local.h b/crypto/store/store_local.h
index 6aeaaa915f..8f817fd514 100644
--- a/crypto/store/store_local.h
+++ b/crypto/store/store_local.h
@@ -92,7 +92,7 @@ struct ossl_store_loader_st {
OSSL_STORE_load_fn load;
OSSL_STORE_eof_fn eof;
OSSL_STORE_error_fn error;
- OSSL_STORE_close_fn close;
+ OSSL_STORE_close_fn closefn;
OSSL_STORE_open_ex_fn open_ex;
#endif
diff --git a/crypto/store/store_register.c b/crypto/store/store_register.c
index dfb0cdc811..6fa7352ccd 100644
--- a/crypto/store/store_register.c
+++ b/crypto/store/store_register.c
@@ -130,7 +130,7 @@ int OSSL_STORE_LOADER_set_error(OSSL_STORE_LOADER *loader,
int OSSL_STORE_LOADER_set_close(OSSL_STORE_LOADER *loader,
OSSL_STORE_close_fn close_function)
{
- loader->close = close_function;
+ loader->closefn = close_function;
return 1;
}
@@ -185,7 +185,7 @@ int ossl_store_register_loader_int(OSSL_STORE_LOADER *loader)
/* Check that functions we absolutely require are present */
if (loader->open == NULL || loader->load == NULL || loader->eof == NULL
- || loader->error == NULL || loader->close == NULL) {
+ || loader->error == NULL || loader->closefn == NULL) {
ERR_raise(ERR_LIB_OSSL_STORE, OSSL_STORE_R_LOADER_INCOMPLETE);
return 0;
}
@@ -220,7 +220,7 @@ const OSSL_STORE_LOADER *ossl_store_get0_loader_int(const char *scheme)
template.open = NULL;
template.load = NULL;
template.eof = NULL;
- template.close = NULL;
+ template.closefn = NULL;
template.open_ex = NULL;
if (!RUN_ONCE(&registry_init, do_registry_init)) {
@@ -251,7 +251,7 @@ OSSL_STORE_LOADER *ossl_store_unregister_loader_int(const char *scheme)
template.open = NULL;
template.load = NULL;
template.eof = NULL;
- template.close = NULL;
+ template.closefn = NULL;
if (!RUN_ONCE(&registry_init, do_registry_init)) {
ERR_raise(ERR_LIB_OSSL_STORE, ERR_R_MALLOC_FAILURE);
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index 00a98f4c71..9f00d8be5e 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -57,10 +57,14 @@ CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
* We don't use recursive mutexes, but try to catch errors if we do.
*/
pthread_mutexattr_init(&attr);
-# if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
+# if !defined (__TANDEM) && !defined (_SPT_MODEL_)
+# if !defined(NDEBUG) && !defined(OPENSSL_NO_MUTEX_ERRORCHECK)
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK);
-# else
+# else
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_NORMAL);
+# endif
+# else
+ /* The SPT Thread Library does not define MUTEX attributes. */
# endif
if (pthread_mutex_init(lock, &attr) != 0) {