aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRandall S. Becker <rsbecker@nexbridge.com>2020-10-29 10:17:25 -0500
committerTomas Mraz <tmraz@fedoraproject.org>2020-11-04 17:02:38 +0100
commit9750b4d39c610bac89fde009c3b22147eee0249c (patch)
treeb0cf02969f2d7cca93cc2f09fdcea3fc248c1d05 /crypto
parent23fb3661cf914eb6a0776abec629b0e3e5976b7f (diff)
downloadopenssl-9750b4d39c610bac89fde009c3b22147eee0249c.tar.gz
Moved OPENSSL_fork_prepare,_parent,_child from init.c to threads_pthread.c.
These methods should ultimately be deprecated. The move is to insulate non-UNIX platforms from these undefined symbols. CLA: Permission is granted by the author to the OpenSSL team to use these modifications. Fixes #13273 Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13276)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/init.c25
-rw-r--r--crypto/threads_pthread.c21
2 files changed, 21 insertions, 25 deletions
diff --git a/crypto/init.c b/crypto/init.c
index cfd4eab9ed..f7c7d59f55 100644
--- a/crypto/init.c
+++ b/crypto/init.c
@@ -666,28 +666,3 @@ int OPENSSL_atexit(void (*handler)(void))
return 1;
}
-#ifdef OPENSSL_SYS_UNIX
-/*
- * The following three functions are for OpenSSL developers. This is
- * where we set/reset state across fork (called via pthread_atfork when
- * it exists, or manually by the application when it doesn't).
- *
- * WARNING! If you put code in either OPENSSL_fork_parent or
- * OPENSSL_fork_child, you MUST MAKE SURE that they are async-signal-
- * safe. See this link, for example:
- * http://man7.org/linux/man-pages/man7/signal-safety.7.html
- */
-
-void OPENSSL_fork_prepare(void)
-{
-}
-
-void OPENSSL_fork_parent(void)
-{
-}
-
-void OPENSSL_fork_child(void)
-{
- /* TODO(3.0): Inform all providers about a fork event */
-}
-#endif
diff --git a/crypto/threads_pthread.c b/crypto/threads_pthread.c
index a2735332b8..d7cac6566a 100644
--- a/crypto/threads_pthread.c
+++ b/crypto/threads_pthread.c
@@ -7,6 +7,9 @@
* https://www.openssl.org/source/license.html
*/
+/* We need to use the OPENSSL_fork_*() deprecated APIs */
+#define OPENSSL_SUPPRESS_DEPRECATED
+
#include <openssl/crypto.h>
#include "internal/cryptlib.h"
@@ -196,12 +199,30 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
# ifndef FIPS_MODULE
# ifdef OPENSSL_SYS_UNIX
+
+# ifndef OPENSSL_NO_DEPRECATED_3_0
+
+void OPENSSL_fork_prepare(void)
+{
+}
+
+void OPENSSL_fork_parent(void)
+{
+}
+
+void OPENSSL_fork_child(void)
+{
+}
+
+# endif
static pthread_once_t fork_once_control = PTHREAD_ONCE_INIT;
static void fork_once_func(void)
{
+# ifndef OPENSSL_NO_DEPRECATED_3_0
pthread_atfork(OPENSSL_fork_prepare,
OPENSSL_fork_parent, OPENSSL_fork_child);
+# endif
}
# endif