Loading crypto/include/internal/cryptlib.h +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ extern unsigned int OPENSSL_ia32cap_P[]; void OPENSSL_showfatal(const char *fmta, ...); extern int OPENSSL_NONPIC_relocated; void crypto_cleanup_all_ex_data_int(void); int openssl_init_fork_handlers(void); int openssl_strerror_r(int errnum, char *buf, size_t buflen); # if !defined(OPENSSL_NO_STDIO) Loading crypto/init.c +29 −0 Original line number Diff line number Diff line Loading @@ -552,6 +552,10 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests)) return 0; if ((opts & OPENSSL_INIT_NO_ATFORK) == 0 && !openssl_init_fork_handlers()) return 0; if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG) && !RUN_ONCE(&config, ossl_init_no_config)) return 0; Loading Loading @@ -677,3 +681,28 @@ 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) { } #endif crypto/threads_none.c +5 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,9 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } int openssl_init_fork_handlers(void) { return 0; } #endif crypto/threads_pthread.c +10 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ */ #include <openssl/crypto.h> #include <internal/cryptlib.h> #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS) Loading Loading @@ -168,4 +169,13 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } int openssl_init_fork_handlers(void) { # ifdef OPENSSL_SYS_UNIX if (pthread_atfork(OPENSSL_fork_prepare, OPENSSL_fork_parent, OPENSSL_fork_child) == 0) return 1; # endif return 0; } #endif crypto/threads_win.c +5 −0 Original line number Diff line number Diff line Loading @@ -133,4 +133,9 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } int openssl_init_fork_handlers(void) { return 0; } #endif Loading
crypto/include/internal/cryptlib.h +1 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ extern unsigned int OPENSSL_ia32cap_P[]; void OPENSSL_showfatal(const char *fmta, ...); extern int OPENSSL_NONPIC_relocated; void crypto_cleanup_all_ex_data_int(void); int openssl_init_fork_handlers(void); int openssl_strerror_r(int errnum, char *buf, size_t buflen); # if !defined(OPENSSL_NO_STDIO) Loading
crypto/init.c +29 −0 Original line number Diff line number Diff line Loading @@ -552,6 +552,10 @@ int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings) && !RUN_ONCE(&add_all_digests, ossl_init_add_all_digests)) return 0; if ((opts & OPENSSL_INIT_NO_ATFORK) == 0 && !openssl_init_fork_handlers()) return 0; if ((opts & OPENSSL_INIT_NO_LOAD_CONFIG) && !RUN_ONCE(&config, ossl_init_no_config)) return 0; Loading Loading @@ -677,3 +681,28 @@ 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) { } #endif
crypto/threads_none.c +5 −0 Original line number Diff line number Diff line Loading @@ -121,4 +121,9 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } int openssl_init_fork_handlers(void) { return 0; } #endif
crypto/threads_pthread.c +10 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ */ #include <openssl/crypto.h> #include <internal/cryptlib.h> #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS) Loading Loading @@ -168,4 +169,13 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } int openssl_init_fork_handlers(void) { # ifdef OPENSSL_SYS_UNIX if (pthread_atfork(OPENSSL_fork_prepare, OPENSSL_fork_parent, OPENSSL_fork_child) == 0) return 1; # endif return 0; } #endif
crypto/threads_win.c +5 −0 Original line number Diff line number Diff line Loading @@ -133,4 +133,9 @@ int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) return 1; } int openssl_init_fork_handlers(void) { return 0; } #endif