OPENSSL_CTX.pod 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. =pod
  2. =head1 NAME
  3. OPENSSL_CTX, OPENSSL_CTX_new, OPENSSL_CTX_free, OPENSSL_CTX_load_config,
  4. OPENSSL_CTX_set0_default
  5. - OpenSSL library context
  6. =head1 SYNOPSIS
  7. #include <openssl/crypto.h>
  8. typedef struct openssl_ctx_st OPENSSL_CTX;
  9. OPENSSL_CTX *OPENSSL_CTX_new(void);
  10. int OPENSSL_CTX_load_config(OPENSSL_CTX *ctx, const char *config_file);
  11. void OPENSSL_CTX_free(OPENSSL_CTX *ctx);
  12. OPENSSL_CTX *OPENSSL_CTX_set0_default(OPENSSL_CTX *ctx);
  13. =head1 DESCRIPTION
  14. B<OPENSSL_CTX> is an internal OpenSSL library context type.
  15. Applications may allocate their own, but may also use NULL to use
  16. a default context with functions that take an B<OPENSSL_CTX>
  17. argument.
  18. When a non default library context is in use care should be taken with
  19. multi-threaded applications to properly clean up thread local resources before
  20. the OPENSSL_CTX is freed.
  21. See L<OPENSSL_thread_stop_ex(3)> for more information.
  22. OPENSSL_CTX_new() creates a new OpenSSL library context.
  23. OPENSSL_CTX_load_config() loads a configuration file using the given C<ctx>.
  24. This can be used to associate a library context with providers that are loaded
  25. from a configuration.
  26. OPENSSL_CTX_free() frees the given I<ctx>, unless it happens to be the
  27. default OpenSSL library context.
  28. OPENSSL_CTX_set0_default() sets the default OpenSSL library context to be
  29. I<ctx> in the current thread. The previous default library context is
  30. returned. Care should be taken by the caller to restore the previous
  31. default library context with a subsequent call of this function.
  32. Care should be taken when changing the default library context and starting
  33. async jobs (see L<ASYNC_start_job(3)>), as the default library context when
  34. the job is started will be used throughout the lifetime of an async job, no
  35. matter how the calling thread makes further default library context changes
  36. in the mean time. This means that the calling thread must not free the
  37. library context that was the default at the start of the async job before
  38. that job has finished.
  39. =head1 RETURN VALUES
  40. OPENSSL_CTX_new() and OPENSSL_CTX_set0_default() return a library context
  41. pointer on success, or NULL on error.
  42. OPENSSL_CTX_free() doesn't return any value.
  43. =head1 HISTORY
  44. OPENSSL_CTX, OPENSSL_CTX_new(), OPENSSL_CTX_load_config(), OPENSSL_CTX_free()
  45. and OPENSSL_CTX_set0_default() were added in OpenSSL 3.0.
  46. =head1 COPYRIGHT
  47. Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
  48. Licensed under the Apache License 2.0 (the "License"). You may not use
  49. this file except in compliance with the License. You can obtain a copy
  50. in the file LICENSE in the source distribution or at
  51. L<https://www.openssl.org/source/license.html>.
  52. =cut