]>
Commit | Line | Data |
---|---|---|
2915fe19 RS |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5 | OPENSSL_fork_prepare, | |
6 | OPENSSL_fork_parent, | |
7 | OPENSSL_fork_child | |
8 | - OpenSSL fork handlers | |
9 | ||
10 | =head1 SYNOPSIS | |
11 | ||
12 | #include <openssl/crypto.h> | |
13 | ||
14 | void OPENSSL_fork_prepare(void); | |
15 | void OPENSSL_fork_parent(void); | |
16 | void OPENSSL_fork_child(void); | |
17 | ||
18 | =head1 DESCRIPTION | |
19 | ||
20 | OpenSSL has state that should be reset when a process forks. For example, | |
21 | the entropy pool used to generate random numbers (and therefore encryption | |
22 | keys) should not be shared across multiple programs. | |
23 | The OPENSSL_fork_prepare(), OPENSSL_fork_parent(), and OPENSSL_fork_child() | |
24 | functions are used to reset this internal state. | |
25 | ||
26 | Platforms without fork(2) will probably not need to use these functions. | |
933a73b9 | 27 | Platforms with fork(2) but without pthread_atfork(3) will probably need |
2915fe19 RS |
28 | to call them manually, as described in the following paragraph. Platforms |
29 | such as Linux that have both functions will normally not need to call these | |
30 | functions as the OpenSSL library will do so automatically. | |
31 | ||
a970b14f | 32 | L<OPENSSL_init_crypto(3)> will register these functions with the appropriate |
aa3b3285 | 33 | handler, when the B<OPENSSL_INIT_ATFORK> flag is used. For other |
2915fe19 | 34 | applications, these functions can be called directly. They should be used |
933a73b9 | 35 | according to the calling sequence described by the pthread_atfork(3) |
2915fe19 RS |
36 | documentation, which is summarized here. OPENSSL_fork_prepare() should |
37 | be called before a fork() is done. After the fork() returns, the parent | |
38 | process should call OPENSSL_fork_parent() and the child process should | |
39 | call OPENSSL_fork_child(). | |
40 | ||
1f13ad31 PY |
41 | =head1 RETURN VALUES |
42 | ||
43 | OPENSSL_fork_prepare(), OPENSSL_fork_parent() and OPENSSL_fork_child() do not | |
44 | return values. | |
45 | ||
2915fe19 RS |
46 | =head1 SEE ALSO |
47 | ||
48 | L<OPENSSL_init_crypto(3)> | |
49 | ||
50 | =head1 HISTORY | |
51 | ||
52 | These functions were added in OpenSSL 1.1.1. | |
53 | ||
54 | =head1 COPYRIGHT | |
55 | ||
61f805c1 | 56 | Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved. |
2915fe19 | 57 | |
4746f25a | 58 | Licensed under the Apache License 2.0 (the "License"). You may not use |
2915fe19 RS |
59 | this file except in compliance with the License. You can obtain a copy |
60 | in the file LICENSE in the source distribution or at | |
61 | L<https://www.openssl.org/source/license.html>. | |
62 | ||
63 | =cut |