mirror of
https://github.com/openssl/openssl.git
synced 2024-12-21 06:09:35 +08:00
f5afac4bda
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14986)
86 lines
3.1 KiB
Plaintext
86 lines
3.1 KiB
Plaintext
=pod
|
|
|
|
=head1 NAME
|
|
|
|
OSSL_LIB_CTX, OSSL_LIB_CTX_new, OSSL_LIB_CTX_free, OSSL_LIB_CTX_load_config,
|
|
OSSL_LIB_CTX_get0_global_default, OSSL_LIB_CTX_set0_default
|
|
- OpenSSL library context
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
#include <openssl/crypto.h>
|
|
|
|
typedef struct ossl_lib_ctx_st OSSL_LIB_CTX;
|
|
|
|
OSSL_LIB_CTX *OSSL_LIB_CTX_new(void);
|
|
int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file);
|
|
void OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx);
|
|
OSSL_LIB_CTX *OSSL_LIB_CTX_get0_global_default(void);
|
|
OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *ctx);
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
B<OSSL_LIB_CTX> is an internal OpenSSL library context type.
|
|
Applications may allocate their own, but may also use NULL to use
|
|
a default context with functions that take an B<OSSL_LIB_CTX>
|
|
argument.
|
|
|
|
When a non default library context is in use care should be taken with
|
|
multi-threaded applications to properly clean up thread local resources before
|
|
the OSSL_LIB_CTX is freed.
|
|
See L<OPENSSL_thread_stop_ex(3)> for more information.
|
|
|
|
OSSL_LIB_CTX_new() creates a new OpenSSL library context.
|
|
|
|
OSSL_LIB_CTX_load_config() loads a configuration file using the given C<ctx>.
|
|
This can be used to associate a library context with providers that are loaded
|
|
from a configuration.
|
|
|
|
OSSL_LIB_CTX_free() frees the given I<ctx>, unless it happens to be the
|
|
default OpenSSL library context.
|
|
|
|
OSSL_LIB_CTX_get0_global_default() returns a concrete (non NULL) reference to
|
|
the global default library context.
|
|
|
|
OSSL_LIB_CTX_set0_default() sets the default OpenSSL library context to be
|
|
I<ctx> in the current thread. The previous default library context is
|
|
returned. Care should be taken by the caller to restore the previous
|
|
default library context with a subsequent call of this function. If I<ctx> is
|
|
NULL then no change is made to the default library context, but a pointer to
|
|
the current library context is still returned. On a successful call of this
|
|
function the returned value will always be a concrete (non NULL) library
|
|
context.
|
|
|
|
Care should be taken when changing the default library context and starting
|
|
async jobs (see L<ASYNC_start_job(3)>), as the default library context when
|
|
the job is started will be used throughout the lifetime of an async job, no
|
|
matter how the calling thread makes further default library context changes
|
|
in the mean time. This means that the calling thread must not free the
|
|
library context that was the default at the start of the async job before
|
|
that job has finished.
|
|
|
|
=head1 RETURN VALUES
|
|
|
|
OSSL_LIB_CTX_new(), OSSL_LIB_CTX_get0_global_default() and
|
|
OSSL_LIB_CTX_set0_default() return a library context pointer on success, or NULL
|
|
on error.
|
|
|
|
OSSL_LIB_CTX_free() doesn't return any value.
|
|
|
|
=head1 HISTORY
|
|
|
|
OSSL_LIB_CTX, OSSL_LIB_CTX_new(), OSSL_LIB_CTX_load_config(),
|
|
OSSL_LIB_CTX_free(), OSSL_LIB_CTX_get0_global_default() and
|
|
OSSL_LIB_CTX_set0_default() were added in OpenSSL 3.0.
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
|
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
this file except in compliance with the License. You can obtain a copy
|
|
in the file LICENSE in the source distribution or at
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
=cut
|