OPENSSL_fork_prepare.pod 2.0 KB

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