1OPENSSL_FORK_PREPARE(3ossl) OpenSSL OPENSSL_FORK_PREPARE(3ossl)
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 The following functions have been deprecated since OpenSSL 3.0, and can
13 be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
14 version value, see openssl_user_macros(7):
15
16 void OPENSSL_fork_prepare(void);
17 void OPENSSL_fork_parent(void);
18 void OPENSSL_fork_child(void);
19
21 These methods are currently unused, and as such, no replacement methods
22 are required or planned.
23
24 OpenSSL has state that should be reset when a process forks. For
25 example, the entropy pool used to generate random numbers (and
26 therefore encryption keys) should not be shared across multiple
27 programs. The OPENSSL_fork_prepare(), OPENSSL_fork_parent(), and
28 OPENSSL_fork_child() functions are used to reset this internal state.
29
30 Platforms without fork(2) will probably not need to use these
31 functions. Platforms with fork(2) but without pthread_atfork(3) will
32 probably need to call them manually, as described in the following
33 paragraph. Platforms such as Linux that have both functions will
34 normally not need to call these functions as the OpenSSL library will
35 do so automatically.
36
37 OPENSSL_init_crypto(3) will register these functions with the
38 appropriate handler, when the OPENSSL_INIT_ATFORK flag is used. For
39 other applications, these functions can be called directly. They should
40 be used according to the calling sequence described by the
41 pthread_atfork(3) documentation, which is summarized here.
42 OPENSSL_fork_prepare() should be called before a fork() is done. After
43 the fork() returns, the parent process should call
44 OPENSSL_fork_parent() and the child process should call
45 OPENSSL_fork_child().
46
48 OPENSSL_fork_prepare(), OPENSSL_fork_parent() and OPENSSL_fork_child()
49 do not return values.
50
52 OPENSSL_init_crypto(3)
53
55 These functions were added in OpenSSL 1.1.1.
56
58 Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
59
60 Licensed under the Apache License 2.0 (the "License"). You may not use
61 this file except in compliance with the License. You can obtain a copy
62 in the file LICENSE in the source distribution or at
63 <https://www.openssl.org/source/license.html>.
64
65
66
673.0.5 2022-07-05 OPENSSL_FORK_PREPARE(3ossl)