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