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