1OPENSSL_FORK_PREPARE(3) OpenSSL OPENSSL_FORK_PREPARE(3)
2
3
4
6 OPENSSL_fork_prepare, OPENSSL_fork_parent, OPENSSL_fork_child - OpenSSL
7 fork handlers
8
10 #include <openssl/crypto.h>
11
12 void OPENSSL_fork_prepare(void);
13 void OPENSSL_fork_parent(void);
14 void OPENSSL_fork_child(void);
15
17 OpenSSL has state that should be reset when a process forks. For
18 example, the entropy pool used to generate random numbers (and
19 therefore encryption keys) should not be shared across multiple
20 programs. The OPENSSL_fork_prepare(), OPENSSL_fork_parent(), and
21 OPENSSL_fork_child() functions are used to reset this internal state.
22
23 Platforms without fork(2) will probably not need to use these
24 functions. Platforms with fork(2) but without pthread_atfork(3) will
25 probably need to call them manually, as described in the following
26 paragraph. Platforms such as Linux that have both functions will
27 normally not need to call these functions as the OpenSSL library will
28 do so automatically.
29
30 OPENSSL_init_crypto(3) will register these functions with the
31 appropriate handler, when the OPENSSL_INIT_ATFORK flag is used. For
32 other applications, these functions can be called directly. They should
33 be used according to the calling sequence described by the
34 pthread_atfork(3) documentation, which is summarized here.
35 OPENSSL_fork_prepare() should be called before a fork() is done. After
36 the fork() returns, the parent process should call
37 OPENSSL_fork_parent() and the child process should call
38 OPENSSL_fork_child().
39
41 OPENSSL_fork_prepare(), OPENSSL_fork_parent() and OPENSSL_fork_child()
42 do not return values.
43
45 OPENSSL_init_crypto(3)
46
48 These functions were added in OpenSSL 1.1.1.
49
51 Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.
52
53 Licensed under the OpenSSL license (the "License"). You may not use
54 this file except in compliance with the License. You can obtain a copy
55 in the file LICENSE in the source distribution or at
56 <https://www.openssl.org/source/license.html>.
57
58
59
601.1.1l 2021-09-15 OPENSSL_FORK_PREPARE(3)