summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDr. Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>2019-05-27 21:03:09 +0200
committerMatt Caswell <matt@openssl.org>2019-09-09 17:09:06 +0100
commit1b0fe00e2704b5e20334a16d3c9099d1ba2ef1be (patch)
tree0399afc3d5177081e45e6fff1b7d92a9473ddeaf /include
parent73a683b742b344072e36aab173493f5101992c30 (diff)
drbg: ensure fork-safety without using a pthread_atfork handler
When the new OpenSSL CSPRNG was introduced in version 1.1.1, it was announced in the release notes that it would be fork-safe, which the old CSPRNG hadn't been. The fork-safety was implemented using a fork count, which was incremented by a pthread_atfork handler. Initially, this handler was enabled by default. Unfortunately, the default behaviour had to be changed for other reasons in commit b5319bdbd095, so the new OpenSSL CSPRNG failed to keep its promise. This commit restores the fork-safety using a different approach. It replaces the fork count by a fork id, which coincides with the process id on UNIX-like operating systems and is zero on other operating systems. It is used to detect when an automatic reseed after a fork is necessary. To prevent a future regression, it also adds a test to verify that the child reseeds after fork. CVE-2019-1549 Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9802)
Diffstat (limited to 'include')
-rw-r--r--include/internal/cryptlib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index b4d76d5f2e..23e17e5586 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -80,6 +80,7 @@ extern unsigned int OPENSSL_ia32cap_P[];
void OPENSSL_showfatal(const char *fmta, ...);
void crypto_cleanup_all_ex_data_int(void);
int openssl_init_fork_handlers(void);
+int openssl_get_fork_id(void);
char *ossl_safe_getenv(const char *name);