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