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