4
0
mirror of https://github.com/QuasarApp/openssl.git synced 2025-05-02 12:39:38 +00:00

Rename OPENSSL_CTX prefix to OSSL_LIB_CTX

Many of the new types introduced by OpenSSL 3.0 have an OSSL_ prefix,
e.g., OSSL_CALLBACK, OSSL_PARAM, OSSL_ALGORITHM, OSSL_SERIALIZER.

The OPENSSL_CTX type stands out a little by using a different prefix.
For consistency reasons, this type is renamed to OSSL_LIB_CTX.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12621)
This commit is contained in:
Dr. Matthias St. Pierre 2020-10-15 12:55:50 +03:00 committed by Matt Caswell
parent 29000e43ea
commit b425001010
377 changed files with 1414 additions and 1392 deletions

@ -112,9 +112,9 @@ OpenSSL 3.0
*Rich Salz and Richard Levitte* *Rich Salz and Richard Levitte*
* Added a library context that applications as well as other * Added a library context `OSSL_LIB_CTX` that applications as well as
libraries can use to form a separate context within which libcrypto other libraries can use to form a separate context within which
operations are performed. libcrypto operations are performed.
There are two ways this can be used: There are two ways this can be used:
@ -122,16 +122,19 @@ OpenSSL 3.0
such an argument, such as `EVP_CIPHER_fetch` and similar algorithm such an argument, such as `EVP_CIPHER_fetch` and similar algorithm
fetching functions. fetching functions.
- Indirectly, by creating a new library context and then assigning - Indirectly, by creating a new library context and then assigning
it as the new default, with `OPENSSL_CTX_set0_default`. it as the new default, with `OSSL_LIB_CTX_set0_default`.
All public OpenSSL functions that take an `OPENSSL_CTX` pointer, All public OpenSSL functions that take an `OSSL_LIB_CTX` pointer,
apart from the functions directly related to `OPENSSL_CTX`, accept apart from the functions directly related to `OSSL_LIB_CTX`, accept
NULL to indicate that the default library context should be used. NULL to indicate that the default library context should be used.
Library code that changes the default library context using Library code that changes the default library context using
`OPENSSL_CTX_set0_default` should take care to restore it with a `OSSL_LIB_CTX_set0_default` should take care to restore it with a
second call before returning to the caller. second call before returning to the caller.
_(Note: the library context was initially called `OPENSSL_CTX` and
renamed to `OSSL_LIB_CTX` in version 3.0.0 alpha7.)_
*Richard Levitte* *Richard Levitte*
* Handshake now fails if Extended Master Secret extension is dropped * Handshake now fails if Extended Master Secret extension is dropped

@ -22,7 +22,7 @@ OpenSSL 3.0
* Remove the `RAND_DRBG` API. * Remove the `RAND_DRBG` API.
* Deprecated the `ENGINE` API. * Deprecated the `ENGINE` API.
* Added `OPENSSL_CTX`, a libcrypto library context. * Added `OSSL_LIB_CTX`, a libcrypto library context.
* Interactive mode is removed from the 'openssl' program. * Interactive mode is removed from the 'openssl' program.
* The X25519, X448, Ed25519, Ed448 and SHAKE256 algorithms are included in * The X25519, X448, Ed25519, Ed448 and SHAKE256 algorithms are included in
the FIPS provider. None have the "fips=yes" property set and, as such, the FIPS provider. None have the "fips=yes" property set and, as such,

@ -384,7 +384,7 @@ static int process_pollReq(OSSL_CMP_SRV_CTX *srv_ctx,
return 1; return 1;
} }
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OPENSSL_CTX *libctx, const char *propq) OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_SRV_CTX_new(libctx, propq); OSSL_CMP_SRV_CTX *srv_ctx = OSSL_CMP_SRV_CTX_new(libctx, propq);
mock_srv_ctx *ctx = mock_srv_ctx_new(); mock_srv_ctx *ctx = mock_srv_ctx_new();

@ -16,7 +16,8 @@
# include <openssl/cmp.h> # include <openssl/cmp.h>
OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OPENSSL_CTX *libctx, const char *propq); OSSL_CMP_SRV_CTX *ossl_cmp_mock_srv_new(OSSL_LIB_CTX *libctx,
const char *propq);
void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx); void ossl_cmp_mock_srv_free(OSSL_CMP_SRV_CTX *srv_ctx);
int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert); int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);

@ -28,7 +28,7 @@ static int cms_cb(int ok, X509_STORE_CTX *ctx);
static void receipt_request_print(CMS_ContentInfo *cms); static void receipt_request_print(CMS_ContentInfo *cms);
static CMS_ReceiptRequest *make_receipt_request( static CMS_ReceiptRequest *make_receipt_request(
STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst, STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
STACK_OF(OPENSSL_STRING) *rr_from, OPENSSL_CTX *libctx, const char *propq); STACK_OF(OPENSSL_STRING) *rr_from, OSSL_LIB_CTX *libctx, const char *propq);
static int cms_set_pkey_param(EVP_PKEY_CTX *pctx, static int cms_set_pkey_param(EVP_PKEY_CTX *pctx,
STACK_OF(OPENSSL_STRING) *param); STACK_OF(OPENSSL_STRING) *param);
@ -233,7 +233,8 @@ const OPTIONS cms_options[] = {
static CMS_ContentInfo *load_content_info(int informat, BIO *in, BIO **indata, static CMS_ContentInfo *load_content_info(int informat, BIO *in, BIO **indata,
const char *name, const char *name,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx,
const char *propq)
{ {
CMS_ContentInfo *ret, *ci; CMS_ContentInfo *ret, *ci;
@ -301,7 +302,7 @@ int cms_main(int argc, char **argv)
long ltmp; long ltmp;
const char *mime_eol = "\n"; const char *mime_eol = "\n";
OPTION_CHOICE o; OPTION_CHOICE o;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
if ((vpm = X509_VERIFY_PARAM_new()) == NULL) if ((vpm = X509_VERIFY_PARAM_new()) == NULL)
@ -1389,7 +1390,7 @@ static STACK_OF(GENERAL_NAMES) *make_names_stack(STACK_OF(OPENSSL_STRING) *ns)
static CMS_ReceiptRequest *make_receipt_request( static CMS_ReceiptRequest *make_receipt_request(
STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst, STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
STACK_OF(OPENSSL_STRING) *rr_from, STACK_OF(OPENSSL_STRING) *rr_from,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
STACK_OF(GENERAL_NAMES) *rct_to = NULL, *rct_from = NULL; STACK_OF(GENERAL_NAMES) *rct_to = NULL, *rct_from = NULL;
CMS_ReceiptRequest *rr; CMS_ReceiptRequest *rr;

@ -220,7 +220,7 @@ static void free_config_and_unload(CONF *conf)
static int verify_module_load(const char *parent_config_file) static int verify_module_load(const char *parent_config_file)
{ {
return OPENSSL_CTX_load_config(NULL, parent_config_file); return OSSL_LIB_CTX_load_config(NULL, parent_config_file);
} }
/* /*

@ -22,7 +22,7 @@
#endif #endif
static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e, static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
OPENSSL_CTX *libctx, const char *propq); OSSL_LIB_CTX *libctx, const char *propq);
static int genpkey_cb(EVP_PKEY_CTX *ctx); static int genpkey_cb(EVP_PKEY_CTX *ctx);
typedef enum OPTION_choice { typedef enum OPTION_choice {
@ -73,7 +73,7 @@ int genpkey_main(int argc, char **argv)
OPTION_CHOICE o; OPTION_CHOICE o;
int outformat = FORMAT_PEM, text = 0, ret = 1, rv, do_param = 0; int outformat = FORMAT_PEM, text = 0, ret = 1, rv, do_param = 0;
int private = 0; int private = 0;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
prog = opt_init(argc, argv, genpkey_options); prog = opt_init(argc, argv, genpkey_options);
@ -240,7 +240,7 @@ int genpkey_main(int argc, char **argv)
} }
static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e, static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
BIO *pbio; BIO *pbio;
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;
@ -287,7 +287,7 @@ static int init_keygen_file(EVP_PKEY_CTX **pctx, const char *file, ENGINE *e,
int init_gen_str(EVP_PKEY_CTX **pctx, int init_gen_str(EVP_PKEY_CTX **pctx,
const char *algname, ENGINE *e, int do_param, const char *algname, ENGINE *e, int do_param,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;
const EVP_PKEY_ASN1_METHOD *ameth; const EVP_PKEY_ASN1_METHOD *ameth;

@ -225,7 +225,7 @@ int x509_ctrl_string(X509 *x, const char *value);
int x509_req_ctrl_string(X509_REQ *x, const char *value); int x509_req_ctrl_string(X509_REQ *x, const char *value);
int init_gen_str(EVP_PKEY_CTX **pctx, int init_gen_str(EVP_PKEY_CTX **pctx,
const char *algname, ENGINE *e, int do_param, const char *algname, ENGINE *e, int do_param,
OPENSSL_CTX *libctx, const char *propq); OSSL_LIB_CTX *libctx, const char *propq);
int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md, int do_X509_sign(X509 *x, EVP_PKEY *pkey, const EVP_MD *md,
STACK_OF(OPENSSL_STRING) *sigopts); STACK_OF(OPENSSL_STRING) *sigopts);
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts); int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts);
@ -308,15 +308,15 @@ typedef struct verify_options_st {
extern VERIFY_CB_ARGS verify_args; extern VERIFY_CB_ARGS verify_args;
OPENSSL_CTX *app_create_libctx(void); OSSL_LIB_CTX *app_create_libctx(void);
OPENSSL_CTX *app_get0_libctx(void); OSSL_LIB_CTX *app_get0_libctx(void);
OSSL_PARAM *app_params_new_from_opts(STACK_OF(OPENSSL_STRING) *opts, OSSL_PARAM *app_params_new_from_opts(STACK_OF(OPENSSL_STRING) *opts,
const OSSL_PARAM *paramdefs); const OSSL_PARAM *paramdefs);
void app_params_free(OSSL_PARAM *params); void app_params_free(OSSL_PARAM *params);
int app_provider_load(OPENSSL_CTX *libctx, const char *provider_name); int app_provider_load(OSSL_LIB_CTX *libctx, const char *provider_name);
void app_providers_cleanup(void); void app_providers_cleanup(void);
OPENSSL_CTX *app_get0_libctx(void); OSSL_LIB_CTX *app_get0_libctx(void);
const char *app_get0_propq(void); const char *app_get0_propq(void);
#endif #endif

@ -27,7 +27,7 @@ static void provider_free(OSSL_PROVIDER *prov)
OSSL_PROVIDER_unload(prov); OSSL_PROVIDER_unload(prov);
} }
int app_provider_load(OPENSSL_CTX *libctx, const char *provider_name) int app_provider_load(OSSL_LIB_CTX *libctx, const char *provider_name)
{ {
OSSL_PROVIDER *prov; OSSL_PROVIDER *prov;

@ -63,7 +63,7 @@ typedef struct {
unsigned long mask; unsigned long mask;
} NAME_EX_TBL; } NAME_EX_TBL;
static OPENSSL_CTX *app_libctx = NULL; static OSSL_LIB_CTX *app_libctx = NULL;
static int set_table_opts(unsigned long *flags, const char *arg, static int set_table_opts(unsigned long *flags, const char *arg,
const NAME_EX_TBL * in_tbl); const NAME_EX_TBL * in_tbl);
@ -322,7 +322,7 @@ static char *app_get_pass(const char *arg, int keepbio)
return OPENSSL_strdup(tpass); return OPENSSL_strdup(tpass);
} }
OPENSSL_CTX *app_get0_libctx(void) OSSL_LIB_CTX *app_get0_libctx(void)
{ {
return app_libctx; return app_libctx;
} }
@ -333,7 +333,7 @@ const char *app_get0_propq(void)
return NULL; return NULL;
} }
OPENSSL_CTX *app_create_libctx(void) OSSL_LIB_CTX *app_create_libctx(void)
{ {
/* /*
* Load the NULL provider into the default library context and create a * Load the NULL provider into the default library context and create a
@ -345,7 +345,7 @@ OPENSSL_CTX *app_create_libctx(void)
BIO_puts(bio_err, "Failed to create null provider\n"); BIO_puts(bio_err, "Failed to create null provider\n");
return NULL; return NULL;
} }
app_libctx = OPENSSL_CTX_new(); app_libctx = OSSL_LIB_CTX_new();
} }
if (app_libctx == NULL) if (app_libctx == NULL)
BIO_puts(bio_err, "Failed to create library context\n"); BIO_puts(bio_err, "Failed to create library context\n");
@ -676,7 +676,7 @@ int load_key_certs_crls(const char *uri, int maybe_stdin,
{ {
PW_CB_DATA uidata; PW_CB_DATA uidata;
OSSL_STORE_CTX *ctx = NULL; OSSL_STORE_CTX *ctx = NULL;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
int ncerts = 0; int ncerts = 0;
int ncrls = 0; int ncrls = 0;
@ -1077,7 +1077,7 @@ X509_STORE *setup_verify(const char *CAfile, int noCAfile,
{ {
X509_STORE *store = X509_STORE_new(); X509_STORE *store = X509_STORE_new();
X509_LOOKUP *lookup; X509_LOOKUP *lookup;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
if (store == NULL) if (store == NULL)

@ -88,7 +88,7 @@ static int apps_startup(void)
static void apps_shutdown(void) static void apps_shutdown(void)
{ {
app_providers_cleanup(); app_providers_cleanup();
OPENSSL_CTX_free(app_get0_libctx()); OSSL_LIB_CTX_free(app_get0_libctx());
destroy_ui_method(); destroy_ui_method();
} }

@ -60,7 +60,7 @@ int pkcs7_main(int argc, char **argv)
char *infile = NULL, *outfile = NULL, *prog; char *infile = NULL, *outfile = NULL, *prog;
int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1; int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;
OPTION_CHOICE o; OPTION_CHOICE o;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
prog = opt_init(argc, argv, pkcs7_options); prog = opt_init(argc, argv, pkcs7_options);

@ -24,7 +24,7 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
const char *keyfile, int keyform, int key_type, const char *keyfile, int keyform, int key_type,
char *passinarg, int pkey_op, ENGINE *e, char *passinarg, int pkey_op, ENGINE *e,
const int impl, int rawin, EVP_PKEY **ppkey, const int impl, int rawin, EVP_PKEY **ppkey,
OPENSSL_CTX *libctx, const char *propq); OSSL_LIB_CTX *libctx, const char *propq);
static int setup_peer(EVP_PKEY_CTX *ctx, int peerform, const char *file, static int setup_peer(EVP_PKEY_CTX *ctx, int peerform, const char *file,
ENGINE *e); ENGINE *e);
@ -124,7 +124,7 @@ int pkeyutl_main(int argc, char **argv)
int rawin = 0; int rawin = 0;
const EVP_MD *md = NULL; const EVP_MD *md = NULL;
int filesize = -1; int filesize = -1;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = NULL; const char *propq = NULL;
prog = opt_init(argc, argv, pkeyutl_options); prog = opt_init(argc, argv, pkeyutl_options);
@ -512,7 +512,7 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize,
char *passinarg, int pkey_op, ENGINE *e, char *passinarg, int pkey_op, ENGINE *e,
const int engine_impl, int rawin, const int engine_impl, int rawin,
EVP_PKEY **ppkey, EVP_PKEY **ppkey,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL; EVP_PKEY_CTX *ctx = NULL;

@ -154,7 +154,7 @@ int smime_main(int argc, char **argv)
int vpmtouched = 0, rv = 0; int vpmtouched = 0, rv = 0;
ENGINE *e = NULL; ENGINE *e = NULL;
const char *mime_eol = "\n"; const char *mime_eol = "\n";
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
if ((vpm = X509_VERIFY_PARAM_new()) == NULL) if ((vpm = X509_VERIFY_PARAM_new()) == NULL)

@ -19,7 +19,7 @@
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata, static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search, int expected, int criterion, OSSL_STORE_SEARCH *search,
int text, int noout, int recursive, int indent, BIO *out, int text, int noout, int recursive, int indent, BIO *out,
const char *prog, OPENSSL_CTX *libctx, const char *propq); const char *prog, OSSL_LIB_CTX *libctx, const char *propq);
typedef enum OPTION_choice { typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE, OPT_OUT, OPT_PASSIN, OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE, OPT_OUT, OPT_PASSIN,
@ -84,7 +84,7 @@ int storeutl_main(int argc, char *argv[])
char *alias = NULL; char *alias = NULL;
OSSL_STORE_SEARCH *search = NULL; OSSL_STORE_SEARCH *search = NULL;
const EVP_MD *digest = NULL; const EVP_MD *digest = NULL;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
while ((o = opt_next()) != OPT_EOF) { while ((o = opt_next()) != OPT_EOF) {
@ -351,7 +351,7 @@ static int indent_printf(int indent, BIO *bio, const char *format, ...)
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata, static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search, int expected, int criterion, OSSL_STORE_SEARCH *search,
int text, int noout, int recursive, int indent, BIO *out, int text, int noout, int recursive, int indent, BIO *out,
const char *prog, OPENSSL_CTX *libctx, const char *propq) const char *prog, OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_STORE_CTX *store_ctx = NULL; OSSL_STORE_CTX *store_ctx = NULL;
int ret = 1, items = 0; int ret = 1, items = 0;

@ -957,7 +957,7 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
{ {
X509_STORE *cert_ctx = NULL; X509_STORE *cert_ctx = NULL;
X509_LOOKUP *lookup = NULL; X509_LOOKUP *lookup = NULL;
OPENSSL_CTX *libctx = app_get0_libctx(); OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq(); const char *propq = app_get0_propq();
cert_ctx = X509_STORE_new(); cert_ctx = X509_STORE_new();

@ -55,7 +55,7 @@ int ASN1_digest(i2d_of_void *i2d, const EVP_MD *type, char *data,
int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn, int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn,
unsigned char *data, unsigned int *len, unsigned char *data, unsigned int *len,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
int i, ret = 0; int i, ret = 0;
unsigned char *str = NULL; unsigned char *str = NULL;

@ -126,7 +126,7 @@ int ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2,
int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1, int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1,
X509_ALGOR *algor2, ASN1_BIT_STRING *signature, X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
const void *data, const ASN1_OCTET_STRING *id, const void *data, const ASN1_OCTET_STRING *id,
EVP_PKEY *pkey, const EVP_MD *md, OPENSSL_CTX *libctx, EVP_PKEY *pkey, const EVP_MD *md, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
int rv = 0; int rv = 0;

@ -95,7 +95,7 @@ int ASN1_item_verify(const ASN1_ITEM *it, const X509_ALGOR *alg,
int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg, int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg,
const ASN1_BIT_STRING *signature, const void *data, const ASN1_BIT_STRING *signature, const void *data,
const ASN1_OCTET_STRING *id, EVP_PKEY *pkey, const ASN1_OCTET_STRING *id, EVP_PKEY *pkey,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
EVP_MD_CTX *ctx; EVP_MD_CTX *ctx;
int rv = -1; int rv = -1;

@ -232,7 +232,7 @@ static int asn1_write_micalg(BIO *out, STACK_OF(X509_ALGOR) *mdalgs)
int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags, int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
int ctype_nid, int econt_nid, int ctype_nid, int econt_nid,
STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it, STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
char bound[33], c; char bound[33], c;
int i; int i;

@ -22,7 +22,8 @@
#include "crypto/evp.h" #include "crypto/evp.h"
EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp, EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp,
long length, OPENSSL_CTX *libctx, const char *propq) long length, OSSL_LIB_CTX *libctx,
const char *propq)
{ {
EVP_PKEY *ret; EVP_PKEY *ret;
const unsigned char *p = *pp; const unsigned char *p = *pp;
@ -98,7 +99,7 @@ EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
*/ */
EVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp, EVP_PKEY *d2i_AutoPrivateKey_ex(EVP_PKEY **a, const unsigned char **pp,
long length, OPENSSL_CTX *libctx, long length, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
STACK_OF(ASN1_TYPE) *inkey; STACK_OF(ASN1_TYPE) *inkey;

@ -170,7 +170,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
int (*func)(void *), void *args, size_t size) int (*func)(void *), void *args, size_t size)
{ {
async_ctx *ctx; async_ctx *ctx;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL)) if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
return ASYNC_ERR; return ASYNC_ERR;
@ -208,7 +208,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
* Restore the default libctx to what it was the last time the * Restore the default libctx to what it was the last time the
* fibre ran * fibre ran
*/ */
libctx = OPENSSL_CTX_set0_default(ctx->currjob->libctx); libctx = OSSL_LIB_CTX_set0_default(ctx->currjob->libctx);
/* Resume previous job */ /* Resume previous job */
if (!async_fibre_swapcontext(&ctx->dispatcher, if (!async_fibre_swapcontext(&ctx->dispatcher,
&ctx->currjob->fibrectx, 1)) { &ctx->currjob->fibrectx, 1)) {
@ -221,7 +221,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
* again to what it was originally, and remember what it had * again to what it was originally, and remember what it had
* been changed to. * been changed to.
*/ */
ctx->currjob->libctx = OPENSSL_CTX_set0_default(libctx); ctx->currjob->libctx = OSSL_LIB_CTX_set0_default(libctx);
continue; continue;
} }
@ -252,7 +252,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
ctx->currjob->func = func; ctx->currjob->func = func;
ctx->currjob->waitctx = wctx; ctx->currjob->waitctx = wctx;
libctx = openssl_ctx_get_concrete(NULL); libctx = ossl_lib_ctx_get_concrete(NULL);
if (!async_fibre_swapcontext(&ctx->dispatcher, if (!async_fibre_swapcontext(&ctx->dispatcher,
&ctx->currjob->fibrectx, 1)) { &ctx->currjob->fibrectx, 1)) {
ASYNCerr(ASYNC_F_ASYNC_START_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT); ASYNCerr(ASYNC_F_ASYNC_START_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
@ -262,7 +262,7 @@ int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *wctx, int *ret,
* In case the fibre changed the default libctx we set it back again * In case the fibre changed the default libctx we set it back again
* to what it was, and remember what it had been changed to. * to what it was, and remember what it had been changed to.
*/ */
ctx->currjob->libctx = OPENSSL_CTX_set0_default(libctx); ctx->currjob->libctx = OSSL_LIB_CTX_set0_default(libctx);
} }
err: err:

@ -43,7 +43,7 @@ struct async_job_st {
int ret; int ret;
int status; int status;
ASYNC_WAIT_CTX *waitctx; ASYNC_WAIT_CTX *waitctx;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
}; };
struct fd_lookup_st { struct fd_lookup_st {

@ -87,7 +87,7 @@ struct bignum_ctx {
/* Flags. */ /* Flags. */
int flags; int flags;
/* The library context */ /* The library context */
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
}; };
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
@ -128,7 +128,7 @@ static void ctxdbg(BIO *channel, const char *text, BN_CTX *ctx)
# define CTXDBG(str, ctx) do {} while(0) # define CTXDBG(str, ctx) do {} while(0)
#endif /* FIPS_MODULE */ #endif /* FIPS_MODULE */
BN_CTX *BN_CTX_new_ex(OPENSSL_CTX *ctx) BN_CTX *BN_CTX_new_ex(OSSL_LIB_CTX *ctx)
{ {
BN_CTX *ret; BN_CTX *ret;
@ -150,7 +150,7 @@ BN_CTX *BN_CTX_new(void)
} }
#endif #endif
BN_CTX *BN_CTX_secure_new_ex(OPENSSL_CTX *ctx) BN_CTX *BN_CTX_secure_new_ex(OSSL_LIB_CTX *ctx)
{ {
BN_CTX *ret = BN_CTX_new_ex(ctx); BN_CTX *ret = BN_CTX_new_ex(ctx);
@ -249,7 +249,7 @@ BIGNUM *BN_CTX_get(BN_CTX *ctx)
return ret; return ret;
} }
OPENSSL_CTX *bn_get_lib_ctx(BN_CTX *ctx) OSSL_LIB_CTX *bn_get_lib_ctx(BN_CTX *ctx)
{ {
if (ctx == NULL) if (ctx == NULL)
return NULL; return NULL;

@ -25,7 +25,7 @@ static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
{ {
unsigned char *buf = NULL; unsigned char *buf = NULL;
int b, ret = 0, bit, bytes, mask; int b, ret = 0, bit, bytes, mask;
OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
if (bits == 0) { if (bits == 0) {
if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
@ -254,7 +254,7 @@ int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
unsigned char *k_bytes = NULL; unsigned char *k_bytes = NULL;
int ret = 0; int ret = 0;
EVP_MD *md = NULL; EVP_MD *md = NULL;
OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
if (mdctx == NULL) if (mdctx == NULL)
goto err; goto err;

@ -101,7 +101,7 @@ static int cmp_ctx_set_md(OSSL_CMP_CTX *ctx, EVP_MD **pmd, int nid)
* Allocates and initializes OSSL_CMP_CTX context structure with default values. * Allocates and initializes OSSL_CMP_CTX context structure with default values.
* Returns new context on success, NULL on error * Returns new context on success, NULL on error
*/ */
OSSL_CMP_CTX *OSSL_CMP_CTX_new(OPENSSL_CTX *libctx, const char *propq) OSSL_CMP_CTX *OSSL_CMP_CTX_new(OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_CMP_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); OSSL_CMP_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

@ -28,7 +28,7 @@
* this structure is used to store the context for CMP sessions * this structure is used to store the context for CMP sessions
*/ */
struct ossl_cmp_ctx_st { struct ossl_cmp_ctx_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
const char *propq; const char *propq;
OSSL_CMP_log_cb_t log_cb; /* log callback for error/debug/etc. output */ OSSL_CMP_log_cb_t log_cb; /* log callback for error/debug/etc. output */
OSSL_CMP_severity log_verbosity; /* level of verbosity of log output */ OSSL_CMP_severity log_verbosity; /* level of verbosity of log output */
@ -747,7 +747,7 @@ int ossl_cmp_asn1_octet_string_set1(ASN1_OCTET_STRING **tgt,
int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt, int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
const unsigned char *bytes, int len); const unsigned char *bytes, int len);
STACK_OF(X509) STACK_OF(X509)
*ossl_cmp_build_cert_chain(OPENSSL_CTX *libctx, const char *propq, *ossl_cmp_build_cert_chain(OSSL_LIB_CTX *libctx, const char *propq,
X509_STORE *store, X509_STORE *store,
STACK_OF(X509) *certs, X509 *cert); STACK_OF(X509) *certs, X509 *cert);

@ -48,7 +48,7 @@ void OSSL_CMP_SRV_CTX_free(OSSL_CMP_SRV_CTX *srv_ctx)
OPENSSL_free(srv_ctx); OPENSSL_free(srv_ctx);
} }
OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OPENSSL_CTX *libctx, const char *propq) OSSL_CMP_SRV_CTX *OSSL_CMP_SRV_CTX_new(OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_CMP_SRV_CTX *ctx = OPENSSL_zalloc(sizeof(OSSL_CMP_SRV_CTX)); OSSL_CMP_SRV_CTX *ctx = OPENSSL_zalloc(sizeof(OSSL_CMP_SRV_CTX));

@ -217,7 +217,7 @@ int ossl_cmp_X509_STORE_add1_certs(X509_STORE *store, STACK_OF(X509) *certs,
*/ */
/* TODO this should be of more general interest and thus be exported. */ /* TODO this should be of more general interest and thus be exported. */
STACK_OF(X509) STACK_OF(X509)
*ossl_cmp_build_cert_chain(OPENSSL_CTX *libctx, const char *propq, *ossl_cmp_build_cert_chain(OSSL_LIB_CTX *libctx, const char *propq,
X509_STORE *store, X509_STORE *store,
STACK_OF(X509) *certs, X509 *cert) STACK_OF(X509) *certs, X509 *cert)
{ {

@ -21,7 +21,7 @@
/* CMS CompressedData Utilities */ /* CMS CompressedData Utilities */
CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OPENSSL_CTX *libctx, CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;

@ -18,7 +18,8 @@
/* CMS DigestedData Utilities */ /* CMS DigestedData Utilities */
CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md, CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx,
const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;
CMS_DigestedData *dd; CMS_DigestedData *dd;

@ -16,7 +16,7 @@
#ifndef OPENSSL_NO_EC #ifndef OPENSSL_NO_EC
static EVP_PKEY *pkey_type2param(int ptype, const void *pval, static EVP_PKEY *pkey_type2param(int ptype, const void *pval,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx = NULL; EVP_PKEY_CTX *pctx = NULL;

@ -219,7 +219,7 @@ EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri)
} }
CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher, CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher,
OPENSSL_CTX *libctx, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;
@ -248,7 +248,7 @@ CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher)
} }
CMS_ContentInfo * CMS_ContentInfo *
CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OPENSSL_CTX *libctx, CMS_AuthEnvelopedData_create_ex(const EVP_CIPHER *cipher, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;

@ -117,7 +117,7 @@ int ess_check_signing_certs(CMS_SignerInfo *si, STACK_OF(X509) *chain)
CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex( CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
unsigned char *id, int idlen, int allorfirst, unsigned char *id, int idlen, int allorfirst,
STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo, STACK_OF(GENERAL_NAMES) *receiptList, STACK_OF(GENERAL_NAMES) *receiptsTo,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
CMS_ReceiptRequest *rr; CMS_ReceiptRequest *rr;

@ -40,7 +40,7 @@ int i2d_CMS_ContentInfo(const CMS_ContentInfo *a, unsigned char **out)
return ASN1_item_i2d((const ASN1_VALUE *)a, out, (CMS_ContentInfo_it())); return ASN1_item_i2d((const ASN1_VALUE *)a, out, (CMS_ContentInfo_it()));
} }
CMS_ContentInfo *CMS_ContentInfo_new_ex(OPENSSL_CTX *libctx, const char *propq) CMS_ContentInfo *CMS_ContentInfo_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
{ {
CMS_ContentInfo *ci; CMS_ContentInfo *ci;
@ -78,7 +78,7 @@ const CMS_CTX *cms_get0_cmsctx(const CMS_ContentInfo *cms)
return cms != NULL ? &cms->ctx : NULL; return cms != NULL ? &cms->ctx : NULL;
} }
OPENSSL_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx) OSSL_LIB_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx)
{ {
return ctx->libctx; return ctx->libctx;
} }
@ -117,7 +117,7 @@ const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms)
return cms->contentType; return cms->contentType;
} }
CMS_ContentInfo *cms_Data_create(OPENSSL_CTX *libctx, const char *propq) CMS_ContentInfo *cms_Data_create(OSSL_LIB_CTX *libctx, const char *propq)
{ {
CMS_ContentInfo *cms = CMS_ContentInfo_new_ex(libctx, propq); CMS_ContentInfo *cms = CMS_ContentInfo_new_ex(libctx, propq);

@ -47,7 +47,7 @@ typedef struct CMS_ReceiptsFrom_st CMS_ReceiptsFrom;
typedef struct CMS_CTX_st CMS_CTX; typedef struct CMS_CTX_st CMS_CTX;
struct CMS_CTX_st { struct CMS_CTX_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
}; };
@ -390,16 +390,18 @@ DECLARE_ASN1_ALLOC_FUNCTIONS(CMS_IssuerAndSerialNumber)
BIO *cms_content_bio(CMS_ContentInfo *cms); BIO *cms_content_bio(CMS_ContentInfo *cms);
const CMS_CTX *cms_get0_cmsctx(const CMS_ContentInfo *cms); const CMS_CTX *cms_get0_cmsctx(const CMS_ContentInfo *cms);
OPENSSL_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx); OSSL_LIB_CTX *cms_ctx_get0_libctx(const CMS_CTX *ctx);
const char *cms_ctx_get0_propq(const CMS_CTX *ctx); const char *cms_ctx_get0_propq(const CMS_CTX *ctx);
void cms_resolve_libctx(CMS_ContentInfo *ci); void cms_resolve_libctx(CMS_ContentInfo *ci);
CMS_ContentInfo *cms_Data_create(OPENSSL_CTX *ctx, const char *propq); CMS_ContentInfo *cms_Data_create(OSSL_LIB_CTX *ctx, const char *propq);
CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md, CMS_ContentInfo *cms_DigestedData_create(const EVP_MD *md,
OPENSSL_CTX *libctx, const char *propq); OSSL_LIB_CTX *libctx,
const char *propq);
BIO *cms_DigestedData_init_bio(const CMS_ContentInfo *cms); BIO *cms_DigestedData_init_bio(const CMS_ContentInfo *cms);
int cms_DigestedData_do_final(const CMS_ContentInfo *cms, BIO *chain, int verify); int cms_DigestedData_do_final(const CMS_ContentInfo *cms,
BIO *chain, int verify);
BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms); BIO *cms_SignedData_init_bio(CMS_ContentInfo *cms);
int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain); int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain);
@ -411,7 +413,7 @@ int cms_SignerIdentifier_get0_signer_id(CMS_SignerIdentifier *sid,
ASN1_INTEGER **sno); ASN1_INTEGER **sno);
int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert); int cms_SignerIdentifier_cert_cmp(CMS_SignerIdentifier *sid, X509 *cert);
CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OPENSSL_CTX *libctx, CMS_ContentInfo *cms_CompressedData_create(int comp_nid, OSSL_LIB_CTX *libctx,
const char *propq); const char *propq);
BIO *cms_CompressedData_init_bio(const CMS_ContentInfo *cms); BIO *cms_CompressedData_init_bio(const CMS_ContentInfo *cms);

@ -119,7 +119,7 @@ int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags)
} }
CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags, CMS_ContentInfo *CMS_data_create_ex(BIO *in, unsigned int flags,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
CMS_ContentInfo *cms = cms_Data_create(libctx, propq); CMS_ContentInfo *cms = cms_Data_create(libctx, propq);
@ -164,7 +164,7 @@ int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
} }
CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md, CMS_ContentInfo *CMS_digest_create_ex(BIO *in, const EVP_MD *md,
unsigned int flags, OPENSSL_CTX *ctx, unsigned int flags, OSSL_LIB_CTX *ctx,
const char *propq) const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;
@ -220,7 +220,7 @@ int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher, CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher,
const unsigned char *key, const unsigned char *key,
size_t keylen, unsigned int flags, size_t keylen, unsigned int flags,
OPENSSL_CTX *libctx, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;
@ -500,7 +500,7 @@ int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey, CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,
STACK_OF(X509) *certs, BIO *data, STACK_OF(X509) *certs, BIO *data,
unsigned int flags, OPENSSL_CTX *libctx, unsigned int flags, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;
@ -619,7 +619,7 @@ CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *data, CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *data,
const EVP_CIPHER *cipher, unsigned int flags, const EVP_CIPHER *cipher, unsigned int flags,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
CMS_ContentInfo *cms; CMS_ContentInfo *cms;
int i; int i;

@ -178,7 +178,7 @@ int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out)
* the "CONF classic" functions, for consistency. * the "CONF classic" functions, for consistency.
*/ */
CONF *NCONF_new_ex(OPENSSL_CTX *libctx, CONF_METHOD *meth) CONF *NCONF_new_ex(OSSL_LIB_CTX *libctx, CONF_METHOD *meth)
{ {
CONF *ret; CONF *ret;

@ -148,7 +148,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
} }
int CONF_modules_load_file_ex(OPENSSL_CTX *libctx, const char *filename, int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
const char *appname, unsigned long flags) const char *appname, unsigned long flags)
{ {
char *file = NULL; char *file = NULL;

@ -12,34 +12,34 @@
#include "internal/thread_once.h" #include "internal/thread_once.h"
#include "internal/property.h" #include "internal/property.h"
struct openssl_ctx_onfree_list_st { struct ossl_lib_ctx_onfree_list_st {
openssl_ctx_onfree_fn *fn; ossl_lib_ctx_onfree_fn *fn;
struct openssl_ctx_onfree_list_st *next; struct ossl_lib_ctx_onfree_list_st *next;
}; };
struct openssl_ctx_st { struct ossl_lib_ctx_st {
CRYPTO_RWLOCK *lock; CRYPTO_RWLOCK *lock;
CRYPTO_EX_DATA data; CRYPTO_EX_DATA data;
/* /*
* For most data in the OPENSSL_CTX we just use ex_data to store it. But * For most data in the OSSL_LIB_CTX we just use ex_data to store it. But
* that doesn't work for ex_data itself - so we store that directly. * that doesn't work for ex_data itself - so we store that directly.
*/ */
OSSL_EX_DATA_GLOBAL global; OSSL_EX_DATA_GLOBAL global;
/* Map internal static indexes to dynamically created indexes */ /* Map internal static indexes to dynamically created indexes */
int dyn_indexes[OPENSSL_CTX_MAX_INDEXES]; int dyn_indexes[OSSL_LIB_CTX_MAX_INDEXES];
/* Keep a separate lock for each index */ /* Keep a separate lock for each index */
CRYPTO_RWLOCK *index_locks[OPENSSL_CTX_MAX_INDEXES]; CRYPTO_RWLOCK *index_locks[OSSL_LIB_CTX_MAX_INDEXES];
CRYPTO_RWLOCK *oncelock; CRYPTO_RWLOCK *oncelock;
int run_once_done[OPENSSL_CTX_MAX_RUN_ONCE]; int run_once_done[OSSL_LIB_CTX_MAX_RUN_ONCE];
int run_once_ret[OPENSSL_CTX_MAX_RUN_ONCE]; int run_once_ret[OSSL_LIB_CTX_MAX_RUN_ONCE];
struct openssl_ctx_onfree_list_st *onfreelist; struct ossl_lib_ctx_onfree_list_st *onfreelist;
}; };
static int context_init(OPENSSL_CTX *ctx) static int context_init(OSSL_LIB_CTX *ctx)
{ {
size_t i; size_t i;
int exdata_done = 0; int exdata_done = 0;
@ -52,19 +52,19 @@ static int context_init(OPENSSL_CTX *ctx)
if (ctx->oncelock == NULL) if (ctx->oncelock == NULL)
goto err; goto err;
for (i = 0; i < OPENSSL_CTX_MAX_INDEXES; i++) { for (i = 0; i < OSSL_LIB_CTX_MAX_INDEXES; i++) {
ctx->index_locks[i] = CRYPTO_THREAD_lock_new(); ctx->index_locks[i] = CRYPTO_THREAD_lock_new();
ctx->dyn_indexes[i] = -1; ctx->dyn_indexes[i] = -1;
if (ctx->index_locks[i] == NULL) if (ctx->index_locks[i] == NULL)
goto err; goto err;
} }
/* OPENSSL_CTX is built on top of ex_data so we initialise that directly */ /* OSSL_LIB_CTX is built on top of ex_data so we initialise that directly */
if (!do_ex_data_init(ctx)) if (!do_ex_data_init(ctx))
goto err; goto err;
exdata_done = 1; exdata_done = 1;
if (!crypto_new_ex_data_ex(ctx, CRYPTO_EX_INDEX_OPENSSL_CTX, NULL, if (!crypto_new_ex_data_ex(ctx, CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL,
&ctx->data)) { &ctx->data)) {
crypto_cleanup_all_ex_data_int(ctx); crypto_cleanup_all_ex_data_int(ctx);
goto err; goto err;
@ -84,9 +84,9 @@ static int context_init(OPENSSL_CTX *ctx)
return 0; return 0;
} }
static int context_deinit(OPENSSL_CTX *ctx) static int context_deinit(OSSL_LIB_CTX *ctx)
{ {
struct openssl_ctx_onfree_list_st *tmp, *onfree; struct ossl_lib_ctx_onfree_list_st *tmp, *onfree;
int i; int i;
if (ctx == NULL) if (ctx == NULL)
@ -101,9 +101,9 @@ static int context_deinit(OPENSSL_CTX *ctx)
onfree = onfree->next; onfree = onfree->next;
OPENSSL_free(tmp); OPENSSL_free(tmp);
} }
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_OPENSSL_CTX, NULL, &ctx->data); CRYPTO_free_ex_data(CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL, &ctx->data);
crypto_cleanup_all_ex_data_int(ctx); crypto_cleanup_all_ex_data_int(ctx);
for (i = 0; i < OPENSSL_CTX_MAX_INDEXES; i++) for (i = 0; i < OSSL_LIB_CTX_MAX_INDEXES; i++)
CRYPTO_THREAD_lock_free(ctx->index_locks[i]); CRYPTO_THREAD_lock_free(ctx->index_locks[i]);
CRYPTO_THREAD_lock_free(ctx->oncelock); CRYPTO_THREAD_lock_free(ctx->oncelock);
@ -114,7 +114,7 @@ static int context_deinit(OPENSSL_CTX *ctx)
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
/* The default default context */ /* The default default context */
static OPENSSL_CTX default_context_int; static OSSL_LIB_CTX default_context_int;
static CRYPTO_ONCE default_context_init = CRYPTO_ONCE_STATIC_INIT; static CRYPTO_ONCE default_context_init = CRYPTO_ONCE_STATIC_INIT;
static CRYPTO_THREAD_LOCAL default_context_thread_local; static CRYPTO_THREAD_LOCAL default_context_thread_local;
@ -125,12 +125,12 @@ DEFINE_RUN_ONCE_STATIC(default_context_do_init)
&& context_init(&default_context_int); && context_init(&default_context_int);
} }
void openssl_ctx_default_deinit(void) void ossl_lib_ctx_default_deinit(void)
{ {
context_deinit(&default_context_int); context_deinit(&default_context_int);
} }
static OPENSSL_CTX *get_thread_default_context(void) static OSSL_LIB_CTX *get_thread_default_context(void)
{ {
if (!RUN_ONCE(&default_context_init, default_context_do_init)) if (!RUN_ONCE(&default_context_init, default_context_do_init))
return NULL; return NULL;
@ -138,16 +138,16 @@ static OPENSSL_CTX *get_thread_default_context(void)
return CRYPTO_THREAD_get_local(&default_context_thread_local); return CRYPTO_THREAD_get_local(&default_context_thread_local);
} }
static OPENSSL_CTX *get_default_context(void) static OSSL_LIB_CTX *get_default_context(void)
{ {
OPENSSL_CTX *current_defctx = get_thread_default_context(); OSSL_LIB_CTX *current_defctx = get_thread_default_context();
if (current_defctx == NULL) if (current_defctx == NULL)
current_defctx = &default_context_int; current_defctx = &default_context_int;
return current_defctx; return current_defctx;
} }
static int set_default_context(OPENSSL_CTX *defctx) static int set_default_context(OSSL_LIB_CTX *defctx)
{ {
if (defctx == &default_context_int) if (defctx == &default_context_int)
defctx = NULL; defctx = NULL;
@ -156,37 +156,37 @@ static int set_default_context(OPENSSL_CTX *defctx)
} }
#endif #endif
OPENSSL_CTX *OPENSSL_CTX_new(void) OSSL_LIB_CTX *OSSL_LIB_CTX_new(void)
{ {
OPENSSL_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); OSSL_LIB_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
if (ctx != NULL && !context_init(ctx)) { if (ctx != NULL && !context_init(ctx)) {
OPENSSL_CTX_free(ctx); OSSL_LIB_CTX_free(ctx);
ctx = NULL; ctx = NULL;
} }
return ctx; return ctx;
} }
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
int OPENSSL_CTX_load_config(OPENSSL_CTX *ctx, const char *config_file) int OSSL_LIB_CTX_load_config(OSSL_LIB_CTX *ctx, const char *config_file)
{ {
return CONF_modules_load_file_ex(ctx, config_file, NULL, 0) > 0; return CONF_modules_load_file_ex(ctx, config_file, NULL, 0) > 0;
} }
#endif #endif
void OPENSSL_CTX_free(OPENSSL_CTX *ctx) void OSSL_LIB_CTX_free(OSSL_LIB_CTX *ctx)
{ {
if (openssl_ctx_is_default(ctx)) if (ossl_lib_ctx_is_default(ctx))
return; return;
context_deinit(ctx); context_deinit(ctx);
OPENSSL_free(ctx); OPENSSL_free(ctx);
} }
OPENSSL_CTX *OPENSSL_CTX_set0_default(OPENSSL_CTX *libctx) OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx)
{ {
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
OPENSSL_CTX *current_defctx; OSSL_LIB_CTX *current_defctx;
if ((current_defctx = get_default_context()) != NULL if ((current_defctx = get_default_context()) != NULL
&& set_default_context(libctx)) && set_default_context(libctx))
@ -196,7 +196,7 @@ OPENSSL_CTX *OPENSSL_CTX_set0_default(OPENSSL_CTX *libctx)
return NULL; return NULL;
} }
OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx) OSSL_LIB_CTX *ossl_lib_ctx_get_concrete(OSSL_LIB_CTX *ctx)
{ {
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
if (ctx == NULL) if (ctx == NULL)
@ -205,7 +205,7 @@ OPENSSL_CTX *openssl_ctx_get_concrete(OPENSSL_CTX *ctx)
return ctx; return ctx;
} }
int openssl_ctx_is_default(OPENSSL_CTX *ctx) int ossl_lib_ctx_is_default(OSSL_LIB_CTX *ctx)
{ {
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
if (ctx == NULL || ctx == get_default_context()) if (ctx == NULL || ctx == get_default_context())
@ -214,48 +214,48 @@ int openssl_ctx_is_default(OPENSSL_CTX *ctx)
return 0; return 0;
} }
int openssl_ctx_is_global_default(OPENSSL_CTX *ctx) int ossl_lib_ctx_is_global_default(OSSL_LIB_CTX *ctx)
{ {
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
if (openssl_ctx_get_concrete(ctx) == &default_context_int) if (ossl_lib_ctx_get_concrete(ctx) == &default_context_int)
return 1; return 1;
#endif #endif
return 0; return 0;
} }
static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign, static void ossl_lib_ctx_generic_new(void *parent_ign, void *ptr_ign,
CRYPTO_EX_DATA *ad, int index, CRYPTO_EX_DATA *ad, int index,
long argl_ign, void *argp) long argl_ign, void *argp)
{ {
const OPENSSL_CTX_METHOD *meth = argp; const OSSL_LIB_CTX_METHOD *meth = argp;
void *ptr = meth->new_func(crypto_ex_data_get_openssl_ctx(ad)); void *ptr = meth->new_func(crypto_ex_data_get_ossl_lib_ctx(ad));
if (ptr != NULL) if (ptr != NULL)
CRYPTO_set_ex_data(ad, index, ptr); CRYPTO_set_ex_data(ad, index, ptr);
} }
static void openssl_ctx_generic_free(void *parent_ign, void *ptr, static void ossl_lib_ctx_generic_free(void *parent_ign, void *ptr,
CRYPTO_EX_DATA *ad, int index, CRYPTO_EX_DATA *ad, int index,
long argl_ign, void *argp) long argl_ign, void *argp)
{ {
const OPENSSL_CTX_METHOD *meth = argp; const OSSL_LIB_CTX_METHOD *meth = argp;
meth->free_func(ptr); meth->free_func(ptr);
} }
/* Non-static so we can use it in context_internal_test */ /* Non-static so we can use it in context_internal_test */
static int openssl_ctx_init_index(OPENSSL_CTX *ctx, int static_index, static int ossl_lib_ctx_init_index(OSSL_LIB_CTX *ctx, int static_index,
const OPENSSL_CTX_METHOD *meth) const OSSL_LIB_CTX_METHOD *meth)
{ {
int idx; int idx;
ctx = openssl_ctx_get_concrete(ctx); ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL) if (ctx == NULL)
return 0; return 0;
idx = crypto_get_ex_new_index_ex(ctx, CRYPTO_EX_INDEX_OPENSSL_CTX, 0, idx = crypto_get_ex_new_index_ex(ctx, CRYPTO_EX_INDEX_OSSL_LIB_CTX, 0,
(void *)meth, (void *)meth,
openssl_ctx_generic_new, ossl_lib_ctx_generic_new,
NULL, openssl_ctx_generic_free); NULL, ossl_lib_ctx_generic_free);
if (idx < 0) if (idx < 0)
return 0; return 0;
@ -263,13 +263,13 @@ static int openssl_ctx_init_index(OPENSSL_CTX *ctx, int static_index,
return 1; return 1;
} }
void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index, void *ossl_lib_ctx_get_data(OSSL_LIB_CTX *ctx, int index,
const OPENSSL_CTX_METHOD *meth) const OSSL_LIB_CTX_METHOD *meth)
{ {
void *data = NULL; void *data = NULL;
int dynidx; int dynidx;
ctx = openssl_ctx_get_concrete(ctx); ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL) if (ctx == NULL)
return NULL; return NULL;
@ -295,7 +295,7 @@ void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
return data; return data;
} }
if (!openssl_ctx_init_index(ctx, index, meth)) { if (!ossl_lib_ctx_init_index(ctx, index, meth)) {
CRYPTO_THREAD_unlock(ctx->lock); CRYPTO_THREAD_unlock(ctx->lock);
CRYPTO_THREAD_unlock(ctx->index_locks[index]); CRYPTO_THREAD_unlock(ctx->index_locks[index]);
return NULL; return NULL;
@ -304,7 +304,7 @@ void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
CRYPTO_THREAD_unlock(ctx->lock); CRYPTO_THREAD_unlock(ctx->lock);
/* The alloc call ensures there's a value there */ /* The alloc call ensures there's a value there */
if (CRYPTO_alloc_ex_data(CRYPTO_EX_INDEX_OPENSSL_CTX, NULL, if (CRYPTO_alloc_ex_data(CRYPTO_EX_INDEX_OSSL_LIB_CTX, NULL,
&ctx->data, ctx->dyn_indexes[index])) &ctx->data, ctx->dyn_indexes[index]))
data = CRYPTO_get_ex_data(&ctx->data, ctx->dyn_indexes[index]); data = CRYPTO_get_ex_data(&ctx->data, ctx->dyn_indexes[index]);
@ -313,20 +313,20 @@ void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
return data; return data;
} }
OSSL_EX_DATA_GLOBAL *openssl_ctx_get_ex_data_global(OPENSSL_CTX *ctx) OSSL_EX_DATA_GLOBAL *ossl_lib_ctx_get_ex_data_global(OSSL_LIB_CTX *ctx)
{ {
ctx = openssl_ctx_get_concrete(ctx); ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL) if (ctx == NULL)
return NULL; return NULL;
return &ctx->global; return &ctx->global;
} }
int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx, int ossl_lib_ctx_run_once(OSSL_LIB_CTX *ctx, unsigned int idx,
openssl_ctx_run_once_fn run_once_fn) ossl_lib_ctx_run_once_fn run_once_fn)
{ {
int done = 0, ret = 0; int done = 0, ret = 0;
ctx = openssl_ctx_get_concrete(ctx); ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL) if (ctx == NULL)
return 0; return 0;
@ -354,9 +354,9 @@ int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx,
return ret; return ret;
} }
int openssl_ctx_onfree(OPENSSL_CTX *ctx, openssl_ctx_onfree_fn onfreefn) int ossl_lib_ctx_onfree(OSSL_LIB_CTX *ctx, ossl_lib_ctx_onfree_fn onfreefn)
{ {
struct openssl_ctx_onfree_list_st *newonfree struct ossl_lib_ctx_onfree_list_st *newonfree
= OPENSSL_malloc(sizeof(*newonfree)); = OPENSSL_malloc(sizeof(*newonfree));
if (newonfree == NULL) if (newonfree == NULL)

@ -14,7 +14,7 @@
#include "internal/provider.h" #include "internal/provider.h"
struct algorithm_data_st { struct algorithm_data_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
int operation_id; /* May be zero for finding them all */ int operation_id; /* May be zero for finding them all */
int (*pre)(OSSL_PROVIDER *, int operation_id, void *data, int *result); int (*pre)(OSSL_PROVIDER *, int operation_id, void *data, int *result);
void (*fn)(OSSL_PROVIDER *, const OSSL_ALGORITHM *, int no_store, void (*fn)(OSSL_PROVIDER *, const OSSL_ALGORITHM *, int no_store,
@ -85,7 +85,7 @@ static int algorithm_do_this(OSSL_PROVIDER *provider, void *cbdata)
return ok; return ok;
} }
void ossl_algorithm_do_all(OPENSSL_CTX *libctx, int operation_id, void ossl_algorithm_do_all(OSSL_LIB_CTX *libctx, int operation_id,
OSSL_PROVIDER *provider, OSSL_PROVIDER *provider,
int (*pre)(OSSL_PROVIDER *, int operation_id, int (*pre)(OSSL_PROVIDER *, int operation_id,
void *data, int *result), void *data, int *result),

@ -16,7 +16,7 @@
#include "internal/provider.h" #include "internal/provider.h"
struct construct_data_st { struct construct_data_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
OSSL_METHOD_STORE *store; OSSL_METHOD_STORE *store;
int operation_id; int operation_id;
int force_store; int force_store;
@ -100,7 +100,7 @@ static void ossl_method_construct_this(OSSL_PROVIDER *provider,
data->mcm->destruct(method, data->mcm_data); data->mcm->destruct(method, data->mcm_data);
} }
void *ossl_method_construct(OPENSSL_CTX *libctx, int operation_id, void *ossl_method_construct(OSSL_LIB_CTX *libctx, int operation_id,
int force_store, int force_store,
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data) OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data)
{ {

@ -62,9 +62,9 @@ static void namenum_free(NAMENUM_ENTRY *n)
OPENSSL_free(n); OPENSSL_free(n);
} }
/* OPENSSL_CTX_METHOD functions for a namemap stored in a library context */ /* OSSL_LIB_CTX_METHOD functions for a namemap stored in a library context */
static void *stored_namemap_new(OPENSSL_CTX *libctx) static void *stored_namemap_new(OSSL_LIB_CTX *libctx)
{ {
OSSL_NAMEMAP *namemap = ossl_namemap_new(); OSSL_NAMEMAP *namemap = ossl_namemap_new();
@ -85,7 +85,7 @@ static void stored_namemap_free(void *vnamemap)
} }
} }
static const OPENSSL_CTX_METHOD stored_namemap_method = { static const OSSL_LIB_CTX_METHOD stored_namemap_method = {
stored_namemap_new, stored_namemap_new,
stored_namemap_free, stored_namemap_free,
}; };
@ -390,11 +390,11 @@ static void get_legacy_md_names(const OBJ_NAME *on, void *arg)
* ========================== * ==========================
*/ */
OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx) OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx)
{ {
OSSL_NAMEMAP *namemap = OSSL_NAMEMAP *namemap =
openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX, ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX,
&stored_namemap_method); &stored_namemap_method);
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
if (namemap != NULL && ossl_namemap_empty(namemap)) { if (namemap != NULL && ossl_namemap_empty(namemap)) {

@ -353,7 +353,7 @@ int OSSL_CRMF_MSG_push0_extension(OSSL_CRMF_MSG *crm,
static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps, static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps,
const OSSL_CRMF_CERTREQUEST *cr, const OSSL_CRMF_CERTREQUEST *cr,
EVP_PKEY *pkey, const EVP_MD *digest, EVP_PKEY *pkey, const EVP_MD *digest,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
if (ps == NULL || cr == NULL || pkey == NULL) { if (ps == NULL || cr == NULL || pkey == NULL) {
CRMFerr(0, CRMF_R_NULL_ARGUMENT); CRMFerr(0, CRMF_R_NULL_ARGUMENT);
@ -373,7 +373,7 @@ static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps,
int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm, int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
EVP_PKEY *pkey, const EVP_MD *digest, EVP_PKEY *pkey, const EVP_MD *digest,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_CRMF_POPO *pp = NULL; OSSL_CRMF_POPO *pp = NULL;
ASN1_INTEGER *tag = NULL; ASN1_INTEGER *tag = NULL;
@ -441,7 +441,7 @@ int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
/* verifies the Proof-of-Possession of the request with the given rid in reqs */ /* verifies the Proof-of-Possession of the request with the given rid in reqs */
int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs, int OSSL_CRMF_MSGS_verify_popo(const OSSL_CRMF_MSGS *reqs,
int rid, int acceptRAVerified, int rid, int acceptRAVerified,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_CRMF_MSG *req = NULL; OSSL_CRMF_MSG *req = NULL;
X509_PUBKEY *pubkey = NULL; X509_PUBKEY *pubkey = NULL;
@ -587,7 +587,7 @@ int OSSL_CRMF_CERTTEMPLATE_fill(OSSL_CRMF_CERTTEMPLATE *tmpl,
*/ */
X509 X509
*OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert, *OSSL_CRMF_ENCRYPTEDVALUE_get1_encCert(const OSSL_CRMF_ENCRYPTEDVALUE *ecert,
OPENSSL_CTX *libctx, const char *propq, OSSL_LIB_CTX *libctx, const char *propq,
EVP_PKEY *pkey) EVP_PKEY *pkey)
{ {
X509 *cert = NULL; /* decrypted certificate */ X509 *cert = NULL; /* decrypted certificate */

@ -35,7 +35,7 @@
* |macnid| e.g., NID_hmac_sha1 * |macnid| e.g., NID_hmac_sha1
* returns pointer to OSSL_CRMF_PBMPARAMETER on success, NULL on error * returns pointer to OSSL_CRMF_PBMPARAMETER on success, NULL on error
*/ */
OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OPENSSL_CTX *libctx, size_t slen, OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OSSL_LIB_CTX *libctx, size_t slen,
int owfnid, size_t itercnt, int owfnid, size_t itercnt,
int macnid) int macnid)
{ {
@ -123,7 +123,7 @@ OSSL_CRMF_PBMPARAMETER *OSSL_CRMF_pbmp_new(OPENSSL_CTX *libctx, size_t slen,
* returns 1 on success, 0 on error * returns 1 on success, 0 on error
*/ */
/* TODO try to combine with other MAC calculations in the libray */ /* TODO try to combine with other MAC calculations in the libray */
int OSSL_CRMF_pbm_new(OPENSSL_CTX *libctx, const char *propq, int OSSL_CRMF_pbm_new(OSSL_LIB_CTX *libctx, const char *propq,
const OSSL_CRMF_PBMPARAMETER *pbmp, const OSSL_CRMF_PBMPARAMETER *pbmp,
const unsigned char *msg, size_t msglen, const unsigned char *msg, size_t msglen,
const unsigned char *sec, size_t seclen, const unsigned char *sec, size_t seclen,

@ -133,7 +133,7 @@ SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64,
* -1 on internal (malloc) failure * -1 on internal (malloc) failure
*/ */
int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64, int CTLOG_new_from_base64_ex(CTLOG **ct_log, const char *pkey_base64,
const char *name, OPENSSL_CTX *libctx, const char *name, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
unsigned char *pkey_der = NULL; unsigned char *pkey_der = NULL;

@ -101,7 +101,7 @@ struct sct_ctx_st {
/* milliseconds since epoch (to check that the SCT isn't from the future) */ /* milliseconds since epoch (to check that the SCT isn't from the future) */
uint64_t epoch_time_in_ms; uint64_t epoch_time_in_ms;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
}; };
@ -113,14 +113,14 @@ struct ct_policy_eval_ctx_st {
/* milliseconds since epoch (to check that SCTs aren't from the future) */ /* milliseconds since epoch (to check that SCTs aren't from the future) */
uint64_t epoch_time_in_ms; uint64_t epoch_time_in_ms;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
}; };
/* /*
* Creates a new context for verifying an SCT. * Creates a new context for verifying an SCT.
*/ */
SCT_CTX *SCT_CTX_new(OPENSSL_CTX *ctx, const char *propq); SCT_CTX *SCT_CTX_new(OSSL_LIB_CTX *ctx, const char *propq);
/* /*
* Deletes an SCT verification context. * Deletes an SCT verification context.
*/ */

@ -22,7 +22,7 @@
* Information about a CT log server. * Information about a CT log server.
*/ */
struct ctlog_st { struct ctlog_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
char *name; char *name;
uint8_t log_id[CT_V1_HASHLEN]; uint8_t log_id[CT_V1_HASHLEN];
@ -34,7 +34,7 @@ struct ctlog_st {
* It takes ownership of any CTLOG instances added to it. * It takes ownership of any CTLOG instances added to it.
*/ */
struct ctlog_store_st { struct ctlog_store_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
STACK_OF(CTLOG) *logs; STACK_OF(CTLOG) *logs;
}; };
@ -100,7 +100,7 @@ err:
return ret; return ret;
} }
CTLOG_STORE *CTLOG_STORE_new_ex(OPENSSL_CTX *libctx, const char *propq) CTLOG_STORE *CTLOG_STORE_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
{ {
CTLOG_STORE *ret = OPENSSL_zalloc(sizeof(*ret)); CTLOG_STORE *ret = OPENSSL_zalloc(sizeof(*ret));
@ -264,7 +264,7 @@ end:
* Takes ownership of the public key. * Takes ownership of the public key.
* Copies the name. * Copies the name.
*/ */
CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OPENSSL_CTX *libctx, CTLOG *CTLOG_new_ex(EVP_PKEY *public_key, const char *name, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));

@ -25,7 +25,7 @@
*/ */
static const time_t SCT_CLOCK_DRIFT_TOLERANCE = 300; static const time_t SCT_CLOCK_DRIFT_TOLERANCE = 300;
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OPENSSL_CTX *libctx, CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new_ex(OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX)); CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));

@ -20,7 +20,7 @@
#include "ct_local.h" #include "ct_local.h"
SCT_CTX *SCT_CTX_new(OPENSSL_CTX *libctx, const char *propq) SCT_CTX *SCT_CTX_new(OSSL_LIB_CTX *libctx, const char *propq)
{ {
SCT_CTX *sctx = OPENSSL_zalloc(sizeof(*sctx)); SCT_CTX *sctx = OPENSSL_zalloc(sizeof(*sctx));

@ -479,7 +479,7 @@ static size_t dh_pkey_dirty_cnt(const EVP_PKEY *pkey)
} }
static int dh_pkey_export_to(const EVP_PKEY *from, void *to_keydata, static int dh_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx, EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
DH *dh = from->pkey.dh; DH *dh = from->pkey.dh;

@ -91,7 +91,7 @@ int dh_get_named_group_uid_from_size(int pbits)
#ifdef FIPS_MODULE #ifdef FIPS_MODULE
static int dh_gen_named_group(OPENSSL_CTX *libctx, DH *ret, int prime_len) static int dh_gen_named_group(OSSL_LIB_CTX *libctx, DH *ret, int prime_len)
{ {
DH *dh; DH *dh;
int ok = 0; int ok = 0;

@ -100,7 +100,7 @@ const char *ossl_ffc_named_group_from_uid(int uid)
return NULL; return NULL;
} }
static DH *dh_param_init(OPENSSL_CTX *libctx, int uid, const BIGNUM *p, static DH *dh_param_init(OSSL_LIB_CTX *libctx, int uid, const BIGNUM *p,
const BIGNUM *q, const BIGNUM *g) const BIGNUM *q, const BIGNUM *g)
{ {
DH *dh = dh_new_ex(libctx); DH *dh = dh_new_ex(libctx);
@ -117,7 +117,7 @@ static DH *dh_param_init(OPENSSL_CTX *libctx, int uid, const BIGNUM *p,
return dh; return dh;
} }
static DH *dh_new_by_group_name(OPENSSL_CTX *libctx, const char *name) static DH *dh_new_by_group_name(OSSL_LIB_CTX *libctx, const char *name)
{ {
int i; int i;
@ -136,7 +136,7 @@ static DH *dh_new_by_group_name(OPENSSL_CTX *libctx, const char *name)
return NULL; return NULL;
} }
DH *dh_new_by_nid_ex(OPENSSL_CTX *libctx, int nid) DH *dh_new_by_nid_ex(OSSL_LIB_CTX *libctx, int nid)
{ {
const char *name = ossl_ffc_named_group_from_uid(nid); const char *name = ossl_ffc_named_group_from_uid(nid);

@ -29,7 +29,7 @@ int dh_KDF_X9_42_asn1(unsigned char *out, size_t outlen,
const unsigned char *Z, size_t Zlen, const unsigned char *Z, size_t Zlen,
const char *cek_alg, const char *cek_alg,
const unsigned char *ukm, size_t ukmlen, const EVP_MD *md, const unsigned char *ukm, size_t ukmlen, const EVP_MD *md,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
int ret = 0; int ret = 0;
EVP_KDF_CTX *kctx = NULL; EVP_KDF_CTX *kctx = NULL;
@ -69,7 +69,7 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
int nid; int nid;
const char *key_alg = NULL; const char *key_alg = NULL;
const OSSL_PROVIDER *prov = EVP_MD_provider(md); const OSSL_PROVIDER *prov = EVP_MD_provider(md);
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
nid = OBJ_obj2nid(key_oid); nid = OBJ_obj2nid(key_oid);
if (nid == NID_undef) if (nid == NID_undef)

@ -24,7 +24,7 @@
#include "crypto/dh.h" #include "crypto/dh.h"
#include "dh_local.h" #include "dh_local.h"
static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx); static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx);
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
int DH_set_method(DH *dh, const DH_METHOD *meth) int DH_set_method(DH *dh, const DH_METHOD *meth)
@ -63,12 +63,12 @@ DH *DH_new_method(ENGINE *engine)
} }
#endif /* !FIPS_MODULE */ #endif /* !FIPS_MODULE */
DH *dh_new_ex(OPENSSL_CTX *libctx) DH *dh_new_ex(OSSL_LIB_CTX *libctx)
{ {
return dh_new_intern(NULL, libctx); return dh_new_intern(NULL, libctx);
} }
static DH *dh_new_intern(ENGINE *engine, OPENSSL_CTX *libctx) static DH *dh_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
{ {
DH *ret = OPENSSL_zalloc(sizeof(*ret)); DH *ret = OPENSSL_zalloc(sizeof(*ret));

@ -32,7 +32,7 @@ struct dh_st {
CRYPTO_EX_DATA ex_data; CRYPTO_EX_DATA ex_data;
ENGINE *engine; ENGINE *engine;
#endif #endif
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
const DH_METHOD *meth; const DH_METHOD *meth;
CRYPTO_RWLOCK *lock; CRYPTO_RWLOCK *lock;

@ -274,7 +274,7 @@ static int pkey_dh_ctrl_str(EVP_PKEY_CTX *ctx,
return -2; return -2;
} }
static DH *ffc_params_generate(OPENSSL_CTX *libctx, DH_PKEY_CTX *dctx, static DH *ffc_params_generate(OSSL_LIB_CTX *libctx, DH_PKEY_CTX *dctx,
BN_GENCB *pcb) BN_GENCB *pcb)
{ {
DH *ret; DH *ret;

@ -498,7 +498,7 @@ static size_t dsa_pkey_dirty_cnt(const EVP_PKEY *pkey)
} }
static int dsa_pkey_export_to(const EVP_PKEY *from, void *to_keydata, static int dsa_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx, EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
DSA *dsa = from->pkey.dsa; DSA *dsa = from->pkey.dsa;

@ -25,7 +25,7 @@
#include "crypto/dsa.h" #include "crypto/dsa.h"
#include "crypto/dh.h" /* required by DSA_dup_DH() */ #include "crypto/dh.h" /* required by DSA_dup_DH() */
static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx); static DSA *dsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx);
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
@ -132,7 +132,7 @@ const DSA_METHOD *DSA_get_method(DSA *d)
return d->meth; return d->meth;
} }
static DSA *dsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx) static DSA *dsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
{ {
DSA *ret = OPENSSL_zalloc(sizeof(*ret)); DSA *ret = OPENSSL_zalloc(sizeof(*ret));
@ -194,7 +194,7 @@ DSA *DSA_new_method(ENGINE *engine)
return dsa_new_intern(engine, NULL); return dsa_new_intern(engine, NULL);
} }
DSA *dsa_new_with_ctx(OPENSSL_CTX *libctx) DSA *dsa_new_with_ctx(OSSL_LIB_CTX *libctx)
{ {
return dsa_new_intern(NULL, libctx); return dsa_new_intern(NULL, libctx);
} }

@ -32,7 +32,7 @@ struct dsa_st {
/* functional reference if 'meth' is ENGINE-provided */ /* functional reference if 'meth' is ENGINE-provided */
ENGINE *engine; ENGINE *engine;
CRYPTO_RWLOCK *lock; CRYPTO_RWLOCK *lock;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
/* Provider data */ /* Provider data */
size_t dirty_cnt; /* If any key material changes, increment this */ size_t dirty_cnt; /* If any key material changes, increment this */

@ -5439,7 +5439,7 @@ static void sc_muladd(uint8_t *s, const uint8_t *a, const uint8_t *b,
int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len, int ED25519_sign(uint8_t *out_sig, const uint8_t *message, size_t message_len,
const uint8_t public_key[32], const uint8_t private_key[32], const uint8_t public_key[32], const uint8_t private_key[32],
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
uint8_t az[SHA512_DIGEST_LENGTH]; uint8_t az[SHA512_DIGEST_LENGTH];
uint8_t nonce[SHA512_DIGEST_LENGTH]; uint8_t nonce[SHA512_DIGEST_LENGTH];
@ -5495,7 +5495,7 @@ static const char allzeroes[15];
int ED25519_verify(const uint8_t *message, size_t message_len, int ED25519_verify(const uint8_t *message, size_t message_len,
const uint8_t signature[64], const uint8_t public_key[32], const uint8_t signature[64], const uint8_t public_key[32],
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
int i; int i;
ge_p3 A; ge_p3 A;
@ -5577,7 +5577,7 @@ err:
return res; return res;
} }
int ED25519_public_from_private(OPENSSL_CTX *ctx, uint8_t out_public_key[32], int ED25519_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[32],
const uint8_t private_key[32], const char *propq) const uint8_t private_key[32], const char *propq)
{ {
uint8_t az[SHA512_DIGEST_LENGTH]; uint8_t az[SHA512_DIGEST_LENGTH];

@ -10,11 +10,11 @@
# define OSSL_CRYPTO_EC_CURVE448_LOCAL_H # define OSSL_CRYPTO_EC_CURVE448_LOCAL_H
# include "curve448utils.h" # include "curve448utils.h"
int ED448ph_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64], int ED448ph_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
const uint8_t public_key[57], const uint8_t private_key[57], const uint8_t public_key[57], const uint8_t private_key[57],
const uint8_t *context, size_t context_len, const char *propq); const uint8_t *context, size_t context_len, const char *propq);
int ED448ph_verify(OPENSSL_CTX *ctx, const uint8_t hash[64], int ED448ph_verify(OSSL_LIB_CTX *ctx, const uint8_t hash[64],
const uint8_t signature[114], const uint8_t public_key[57], const uint8_t signature[114], const uint8_t public_key[57],
const uint8_t *context, size_t context_len, const char *propq); const uint8_t *context, size_t context_len, const char *propq);

@ -38,7 +38,7 @@
* privkey (in): The private key. * privkey (in): The private key.
*/ */
c448_error_t c448_ed448_derive_public_key( c448_error_t c448_ed448_derive_public_key(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t pubkey [EDDSA_448_PUBLIC_BYTES], uint8_t pubkey [EDDSA_448_PUBLIC_BYTES],
const uint8_t privkey [EDDSA_448_PRIVATE_BYTES], const uint8_t privkey [EDDSA_448_PRIVATE_BYTES],
const char *propq); const char *propq);
@ -61,7 +61,7 @@ c448_error_t c448_ed448_derive_public_key(
* disambiguation. For Ed448 it is safe. * disambiguation. For Ed448 it is safe.
*/ */
c448_error_t c448_ed448_sign( c448_error_t c448_ed448_sign(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES], uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES], const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@ -87,7 +87,7 @@ c448_error_t c448_ed448_sign(
* disambiguation. For Ed448 it is safe. * disambiguation. For Ed448 it is safe.
*/ */
c448_error_t c448_ed448_sign_prehash( c448_error_t c448_ed448_sign_prehash(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES], uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES], const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@ -114,7 +114,7 @@ c448_error_t c448_ed448_sign_prehash(
* non-prehashed messages, at least without some very careful protocol-level * non-prehashed messages, at least without some very careful protocol-level
* disambiguation. For Ed448 it is safe. * disambiguation. For Ed448 it is safe.
*/ */
c448_error_t c448_ed448_verify(OPENSSL_CTX *ctx, c448_error_t c448_ed448_verify(OSSL_LIB_CTX *ctx,
const uint8_t const uint8_t
signature[EDDSA_448_SIGNATURE_BYTES], signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t const uint8_t
@ -142,7 +142,7 @@ c448_error_t c448_ed448_verify(OPENSSL_CTX *ctx,
* disambiguation. For Ed448 it is safe. * disambiguation. For Ed448 it is safe.
*/ */
c448_error_t c448_ed448_verify_prehash( c448_error_t c448_ed448_verify_prehash(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
const uint8_t signature[EDDSA_448_SIGNATURE_BYTES], const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t hash[64], const uint8_t hash[64],
@ -199,7 +199,7 @@ c448_error_t curve448_point_decode_like_eddsa_and_mul_by_ratio(
* ed (in): The EdDSA private key * ed (in): The EdDSA private key
*/ */
c448_error_t c448_ed448_convert_private_key_to_x448( c448_error_t c448_ed448_convert_private_key_to_x448(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t x[X448_PRIVATE_BYTES], uint8_t x[X448_PRIVATE_BYTES],
const uint8_t ed[EDDSA_448_PRIVATE_BYTES], const uint8_t ed[EDDSA_448_PRIVATE_BYTES],
const char *propq); const char *propq);

@ -20,7 +20,7 @@
#define COFACTOR 4 #define COFACTOR 4
static c448_error_t oneshot_hash(OPENSSL_CTX *ctx, uint8_t *out, size_t outlen, static c448_error_t oneshot_hash(OSSL_LIB_CTX *ctx, uint8_t *out, size_t outlen,
const uint8_t *in, size_t inlen, const uint8_t *in, size_t inlen,
const char *propq) const char *propq)
{ {
@ -54,7 +54,7 @@ static void clamp(uint8_t secret_scalar_ser[EDDSA_448_PRIVATE_BYTES])
secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 2] |= 0x80; secret_scalar_ser[EDDSA_448_PRIVATE_BYTES - 2] |= 0x80;
} }
static c448_error_t hash_init_with_dom(OPENSSL_CTX *ctx, EVP_MD_CTX *hashctx, static c448_error_t hash_init_with_dom(OSSL_LIB_CTX *ctx, EVP_MD_CTX *hashctx,
uint8_t prehashed, uint8_t prehashed,
uint8_t for_prehash, uint8_t for_prehash,
const uint8_t *context, const uint8_t *context,
@ -95,7 +95,7 @@ static c448_error_t hash_init_with_dom(OPENSSL_CTX *ctx, EVP_MD_CTX *hashctx,
/* In this file because it uses the hash */ /* In this file because it uses the hash */
c448_error_t c448_ed448_convert_private_key_to_x448( c448_error_t c448_ed448_convert_private_key_to_x448(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t x[X448_PRIVATE_BYTES], uint8_t x[X448_PRIVATE_BYTES],
const uint8_t ed [EDDSA_448_PRIVATE_BYTES], const uint8_t ed [EDDSA_448_PRIVATE_BYTES],
const char *propq) const char *propq)
@ -107,7 +107,7 @@ c448_error_t c448_ed448_convert_private_key_to_x448(
} }
c448_error_t c448_ed448_derive_public_key( c448_error_t c448_ed448_derive_public_key(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES], const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const char *propq) const char *propq)
@ -153,7 +153,7 @@ c448_error_t c448_ed448_derive_public_key(
} }
c448_error_t c448_ed448_sign( c448_error_t c448_ed448_sign(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES], uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES], const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@ -261,7 +261,7 @@ c448_error_t c448_ed448_sign(
} }
c448_error_t c448_ed448_sign_prehash( c448_error_t c448_ed448_sign_prehash(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES], uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES], const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
@ -273,7 +273,7 @@ c448_error_t c448_ed448_sign_prehash(
} }
c448_error_t c448_ed448_verify( c448_error_t c448_ed448_verify(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
const uint8_t signature[EDDSA_448_SIGNATURE_BYTES], const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t *message, size_t message_len, const uint8_t *message, size_t message_len,
@ -356,7 +356,7 @@ c448_error_t c448_ed448_verify(
} }
c448_error_t c448_ed448_verify_prehash( c448_error_t c448_ed448_verify_prehash(
OPENSSL_CTX *ctx, OSSL_LIB_CTX *ctx,
const uint8_t signature[EDDSA_448_SIGNATURE_BYTES], const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES], const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t hash[64], const uint8_t *context, const uint8_t hash[64], const uint8_t *context,
@ -366,7 +366,7 @@ c448_error_t c448_ed448_verify_prehash(
context_len, propq); context_len, propq);
} }
int ED448_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t *message, int ED448_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t *message,
size_t message_len, const uint8_t public_key[57], size_t message_len, const uint8_t public_key[57],
const uint8_t private_key[57], const uint8_t *context, const uint8_t private_key[57], const uint8_t *context,
size_t context_len, const char *propq) size_t context_len, const char *propq)
@ -376,7 +376,7 @@ int ED448_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t *message,
== C448_SUCCESS; == C448_SUCCESS;
} }
int ED448_verify(OPENSSL_CTX *ctx, const uint8_t *message, size_t message_len, int ED448_verify(OSSL_LIB_CTX *ctx, const uint8_t *message, size_t message_len,
const uint8_t signature[114], const uint8_t public_key[57], const uint8_t signature[114], const uint8_t public_key[57],
const uint8_t *context, size_t context_len, const char *propq) const uint8_t *context, size_t context_len, const char *propq)
{ {
@ -385,7 +385,7 @@ int ED448_verify(OPENSSL_CTX *ctx, const uint8_t *message, size_t message_len,
propq) == C448_SUCCESS; propq) == C448_SUCCESS;
} }
int ED448ph_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64], int ED448ph_sign(OSSL_LIB_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
const uint8_t public_key[57], const uint8_t private_key[57], const uint8_t public_key[57], const uint8_t private_key[57],
const uint8_t *context, size_t context_len, const char *propq) const uint8_t *context, size_t context_len, const char *propq)
{ {
@ -394,7 +394,7 @@ int ED448ph_sign(OPENSSL_CTX *ctx, uint8_t *out_sig, const uint8_t hash[64],
} }
int ED448ph_verify(OPENSSL_CTX *ctx, const uint8_t hash[64], int ED448ph_verify(OSSL_LIB_CTX *ctx, const uint8_t hash[64],
const uint8_t signature[114], const uint8_t public_key[57], const uint8_t signature[114], const uint8_t public_key[57],
const uint8_t *context, size_t context_len, const char *propq) const uint8_t *context, size_t context_len, const char *propq)
{ {
@ -402,7 +402,7 @@ int ED448ph_verify(OPENSSL_CTX *ctx, const uint8_t hash[64],
(uint8_t)context_len, propq) == C448_SUCCESS; (uint8_t)context_len, propq) == C448_SUCCESS;
} }
int ED448_public_from_private(OPENSSL_CTX *ctx, uint8_t out_public_key[57], int ED448_public_from_private(OSSL_LIB_CTX *ctx, uint8_t out_public_key[57],
const uint8_t private_key[57], const char *propq) const uint8_t private_key[57], const char *propq)
{ {
return c448_ed448_derive_public_key(ctx, out_public_key, private_key, propq) return c448_ed448_derive_public_key(ctx, out_public_key, private_key, propq)

@ -101,7 +101,7 @@ static int eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
} }
static EC_KEY *eckey_type2param(int ptype, const void *pval, static EC_KEY *eckey_type2param(int ptype, const void *pval,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
EC_KEY *eckey = NULL; EC_KEY *eckey = NULL;
EC_GROUP *group = NULL; EC_GROUP *group = NULL;
@ -155,7 +155,7 @@ static int eckey_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
int ptype, pklen; int ptype, pklen;
EC_KEY *eckey = NULL; EC_KEY *eckey = NULL;
X509_ALGOR *palg; X509_ALGOR *palg;
OPENSSL_CTX *libctx = NULL; OSSL_LIB_CTX *libctx = NULL;
const char *propq = NULL; const char *propq = NULL;
if (!X509_PUBKEY_get0_libctx(&libctx, &propq, pubkey) if (!X509_PUBKEY_get0_libctx(&libctx, &propq, pubkey)
@ -200,7 +200,7 @@ static int eckey_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
} }
static int eckey_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8, static int eckey_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
const unsigned char *p = NULL; const unsigned char *p = NULL;
const void *pval; const void *pval;
@ -562,7 +562,7 @@ size_t ec_pkey_dirty_cnt(const EVP_PKEY *pkey)
static static
int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata, int ec_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx, EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
const EC_KEY *eckey = NULL; const EC_KEY *eckey = NULL;

@ -50,7 +50,8 @@ static char *ec_param_encoding_id2name(int id)
} }
int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl, int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
OSSL_PARAM params[], OPENSSL_CTX *libctx, const char *propq, OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
const char *propq,
BN_CTX *bnctx, unsigned char **genbuf) BN_CTX *bnctx, unsigned char **genbuf)
{ {
int ret = 0, curve_nid, encoding_flag; int ret = 0, curve_nid, encoding_flag;

@ -3180,7 +3180,7 @@ int ec_curve_name2nid(const char *name)
return NID_undef; return NID_undef;
} }
static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx, static EC_GROUP *ec_group_new_from_data(OSSL_LIB_CTX *libctx,
const char *propq, const char *propq,
const ec_list_element curve) const ec_list_element curve)
{ {
@ -3290,7 +3290,7 @@ static EC_GROUP *ec_group_new_from_data(OPENSSL_CTX *libctx,
return group; return group;
} }
EC_GROUP *EC_GROUP_new_by_curve_name_ex(OPENSSL_CTX *libctx, const char *propq, EC_GROUP *EC_GROUP_new_by_curve_name_ex(OSSL_LIB_CTX *libctx, const char *propq,
int nid) int nid)
{ {
EC_GROUP *ret = NULL; EC_GROUP *ret = NULL;

@ -34,12 +34,12 @@ EC_KEY *EC_KEY_new(void)
} }
#endif #endif
EC_KEY *EC_KEY_new_ex(OPENSSL_CTX *ctx, const char *propq) EC_KEY *EC_KEY_new_ex(OSSL_LIB_CTX *ctx, const char *propq)
{ {
return ec_key_new_method_int(ctx, propq, NULL); return ec_key_new_method_int(ctx, propq, NULL);
} }
EC_KEY *EC_KEY_new_by_curve_name_ex(OPENSSL_CTX *ctx, const char *propq, EC_KEY *EC_KEY_new_by_curve_name_ex(OSSL_LIB_CTX *ctx, const char *propq,
int nid) int nid)
{ {
EC_KEY *ret = EC_KEY_new_ex(ctx, propq); EC_KEY *ret = EC_KEY_new_ex(ctx, propq);
@ -651,7 +651,7 @@ int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x,
} }
OPENSSL_CTX *ec_key_get_libctx(const EC_KEY *key) OSSL_LIB_CTX *ec_key_get_libctx(const EC_KEY *key)
{ {
return key->libctx; return key->libctx;
} }

@ -76,7 +76,7 @@ int EC_KEY_set_method(EC_KEY *key, const EC_KEY_METHOD *meth)
return 1; return 1;
} }
EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, const char *propq, EC_KEY *ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
ENGINE *engine) ENGINE *engine)
{ {
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));

@ -26,7 +26,7 @@
/* functions for EC_GROUP objects */ /* functions for EC_GROUP objects */
EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq, EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
const EC_METHOD *meth) const EC_METHOD *meth)
{ {
EC_GROUP *ret; EC_GROUP *ret;
@ -1403,7 +1403,7 @@ int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1,
* mathematically wrong anyway and should not be used. * mathematically wrong anyway and should not be used.
*/ */
static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group, static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group,
OPENSSL_CTX *libctx, OSSL_LIB_CTX *libctx,
const char *propq, const char *propq,
BN_CTX *ctx) BN_CTX *ctx)
{ {
@ -1499,7 +1499,7 @@ static int ec_encoding_param2id(const OSSL_PARAM *p, int *id)
} }
static EC_GROUP *group_new_from_name(const OSSL_PARAM *p, static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
int ok = 0, nid; int ok = 0, nid;
const char *curve_name = NULL; const char *curve_name = NULL;
@ -1528,7 +1528,7 @@ static EC_GROUP *group_new_from_name(const OSSL_PARAM *p,
} }
EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[], EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[],
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
const OSSL_PARAM *ptmp, *pa, *pb; const OSSL_PARAM *ptmp, *pa, *pb;
int ok = 0; int ok = 0;

@ -275,7 +275,7 @@ struct ec_group_st {
EC_PRE_COMP *ec; EC_PRE_COMP *ec;
} pre_comp; } pre_comp;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
}; };
@ -299,7 +299,7 @@ struct ec_key_st {
CRYPTO_EX_DATA ex_data; CRYPTO_EX_DATA ex_data;
#endif #endif
CRYPTO_RWLOCK *lock; CRYPTO_RWLOCK *lock;
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
char *propq; char *propq;
/* Provider data */ /* Provider data */
@ -601,7 +601,7 @@ int ec_group_simple_order_bits(const EC_GROUP *group);
* \param meth EC_METHOD to use * \param meth EC_METHOD to use
* \return newly created EC_GROUP object or NULL in case of an error. * \return newly created EC_GROUP object or NULL in case of an error.
*/ */
EC_GROUP *ec_group_new_ex(OPENSSL_CTX *libctx, const char *propq, EC_GROUP *ec_group_new_ex(OSSL_LIB_CTX *libctx, const char *propq,
const EC_METHOD *meth); const EC_METHOD *meth);
#ifdef ECP_NISTZ256_ASM #ifdef ECP_NISTZ256_ASM
@ -657,7 +657,7 @@ struct ec_key_method_st {
#define EC_KEY_METHOD_DYNAMIC 1 #define EC_KEY_METHOD_DYNAMIC 1
EC_KEY *ec_key_new_method_int(OPENSSL_CTX *libctx, const char *propq, EC_KEY *ec_key_new_method_int(OSSL_LIB_CTX *libctx, const char *propq,
ENGINE *engine); ENGINE *engine);
int ossl_ec_key_gen(EC_KEY *eckey); int ossl_ec_key_gen(EC_KEY *eckey);

@ -25,7 +25,7 @@ int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
const unsigned char *Z, size_t Zlen, const unsigned char *Z, size_t Zlen,
const unsigned char *sinfo, size_t sinfolen, const unsigned char *sinfo, size_t sinfolen,
const EVP_MD *md, const EVP_MD *md,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
int ret = 0; int ret = 0;
EVP_KDF_CTX *kctx = NULL; EVP_KDF_CTX *kctx = NULL;

@ -10,7 +10,7 @@
#include <openssl/err.h> #include <openssl/err.h>
#include "crypto/ecx.h" #include "crypto/ecx.h"
ECX_KEY *ecx_key_new(OPENSSL_CTX *libctx, ECX_KEY_TYPE type, int haspubkey, ECX_KEY *ecx_key_new(OSSL_LIB_CTX *libctx, ECX_KEY_TYPE type, int haspubkey,
const char *propq) const char *propq)
{ {
ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret)); ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret));

@ -36,7 +36,7 @@ typedef enum {
/* Setup EVP_PKEY using public, private or generation */ /* Setup EVP_PKEY using public, private or generation */
static int ecx_key_op(EVP_PKEY *pkey, int id, const X509_ALGOR *palg, static int ecx_key_op(EVP_PKEY *pkey, int id, const X509_ALGOR *palg,
const unsigned char *p, int plen, ecx_key_op_t op, const unsigned char *p, int plen, ecx_key_op_t op,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
ECX_KEY *key = NULL; ECX_KEY *key = NULL;
unsigned char *privkey, *pubkey; unsigned char *privkey, *pubkey;
@ -150,7 +150,7 @@ static int ecx_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
} }
static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8, static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
const unsigned char *p; const unsigned char *p;
int plen; int plen;
@ -396,7 +396,7 @@ static size_t ecx_pkey_dirty_cnt(const EVP_PKEY *pkey)
} }
static int ecx_pkey_export_to(const EVP_PKEY *from, void *to_keydata, static int ecx_pkey_export_to(const EVP_PKEY *from, void *to_keydata,
EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx, EVP_KEYMGMT *to_keymgmt, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
const ECX_KEY *key = from->pkey.ecx; const ECX_KEY *key = from->pkey.ecx;

@ -217,7 +217,7 @@ int OSSL_DECODER_CTX_add_decoder(OSSL_DECODER_CTX *ctx, OSSL_DECODER *decoder)
} }
int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx, int OSSL_DECODER_CTX_add_extra(OSSL_DECODER_CTX *ctx,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
/* /*
* This function goes through existing decoder methods in * This function goes through existing decoder methods in

@ -69,20 +69,20 @@ static void decoder_store_free(void *vstore)
ossl_method_store_free(vstore); ossl_method_store_free(vstore);
} }
static void *decoder_store_new(OPENSSL_CTX *ctx) static void *decoder_store_new(OSSL_LIB_CTX *ctx)
{ {
return ossl_method_store_new(ctx); return ossl_method_store_new(ctx);
} }
static const OPENSSL_CTX_METHOD decoder_store_method = { static const OSSL_LIB_CTX_METHOD decoder_store_method = {
decoder_store_new, decoder_store_new,
decoder_store_free, decoder_store_free,
}; };
/* Data to be passed through ossl_method_construct() */ /* Data to be passed through ossl_method_construct() */
struct decoder_data_st { struct decoder_data_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
OSSL_METHOD_CONSTRUCT_METHOD *mcm; OSSL_METHOD_CONSTRUCT_METHOD *mcm;
int id; /* For get_decoder_from_store() */ int id; /* For get_decoder_from_store() */
const char *names; /* For get_decoder_from_store() */ const char *names; /* For get_decoder_from_store() */
@ -95,7 +95,7 @@ struct decoder_data_st {
*/ */
/* Temporary decoder method store, constructor and destructor */ /* Temporary decoder method store, constructor and destructor */
static void *alloc_tmp_decoder_store(OPENSSL_CTX *ctx) static void *alloc_tmp_decoder_store(OSSL_LIB_CTX *ctx)
{ {
return ossl_method_store_new(ctx); return ossl_method_store_new(ctx);
} }
@ -107,14 +107,14 @@ static void dealloc_tmp_decoder_store(void *store)
} }
/* Get the permanent decoder store */ /* Get the permanent decoder store */
static OSSL_METHOD_STORE *get_decoder_store(OPENSSL_CTX *libctx) static OSSL_METHOD_STORE *get_decoder_store(OSSL_LIB_CTX *libctx)
{ {
return openssl_ctx_get_data(libctx, OPENSSL_CTX_DECODER_STORE_INDEX, return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_STORE_INDEX,
&decoder_store_method); &decoder_store_method);
} }
/* Get decoder methods from a store, or put one in */ /* Get decoder methods from a store, or put one in */
static void *get_decoder_from_store(OPENSSL_CTX *libctx, void *store, static void *get_decoder_from_store(OSSL_LIB_CTX *libctx, void *store,
void *data) void *data)
{ {
struct decoder_data_st *methdata = data; struct decoder_data_st *methdata = data;
@ -136,7 +136,7 @@ static void *get_decoder_from_store(OPENSSL_CTX *libctx, void *store,
return method; return method;
} }
static int put_decoder_in_store(OPENSSL_CTX *libctx, void *store, static int put_decoder_in_store(OSSL_LIB_CTX *libctx, void *store,
void *method, const OSSL_PROVIDER *prov, void *method, const OSSL_PROVIDER *prov,
int operation_id, const char *names, int operation_id, const char *names,
const char *propdef, void *unused) const char *propdef, void *unused)
@ -245,7 +245,7 @@ static void *construct_decoder(const OSSL_ALGORITHM *algodef,
* namemap entry, this is it. Should the name already exist there, we * namemap entry, this is it. Should the name already exist there, we
* know that ossl_namemap_add() will return its corresponding number. * know that ossl_namemap_add() will return its corresponding number.
*/ */
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *names = algodef->algorithm_names; const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR); int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@ -274,7 +274,7 @@ static void free_decoder(void *method)
} }
/* Fetching support. Can fetch by numeric identity or by name */ /* Fetching support. Can fetch by numeric identity or by name */
static OSSL_DECODER *inner_ossl_decoder_fetch(OPENSSL_CTX *libctx, int id, static OSSL_DECODER *inner_ossl_decoder_fetch(OSSL_LIB_CTX *libctx, int id,
const char *name, const char *name,
const char *properties) const char *properties)
{ {
@ -331,13 +331,13 @@ static OSSL_DECODER *inner_ossl_decoder_fetch(OPENSSL_CTX *libctx, int id,
return method; return method;
} }
OSSL_DECODER *OSSL_DECODER_fetch(OPENSSL_CTX *libctx, const char *name, OSSL_DECODER *OSSL_DECODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
const char *properties) const char *properties)
{ {
return inner_ossl_decoder_fetch(libctx, 0, name, properties); return inner_ossl_decoder_fetch(libctx, 0, name, properties);
} }
OSSL_DECODER *ossl_decoder_fetch_by_number(OPENSSL_CTX *libctx, int id, OSSL_DECODER *ossl_decoder_fetch_by_number(OSSL_LIB_CTX *libctx, int id,
const char *properties) const char *properties)
{ {
return inner_ossl_decoder_fetch(libctx, id, NULL, properties); return inner_ossl_decoder_fetch(libctx, id, NULL, properties);
@ -380,7 +380,7 @@ int OSSL_DECODER_number(const OSSL_DECODER *decoder)
int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name) int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name)
{ {
if (decoder->base.prov != NULL) { if (decoder->base.prov != NULL) {
OPENSSL_CTX *libctx = ossl_provider_library_context(decoder->base.prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
return ossl_namemap_name2num(namemap, name) == decoder->base.id; return ossl_namemap_name2num(namemap, name) == decoder->base.id;
@ -398,7 +398,7 @@ static void decoder_do_one(OSSL_PROVIDER *provider,
int no_store, void *vdata) int no_store, void *vdata)
{ {
struct decoder_do_all_data_st *data = vdata; struct decoder_do_all_data_st *data = vdata;
OPENSSL_CTX *libctx = ossl_provider_library_context(provider); OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *names = algodef->algorithm_names; const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR); int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@ -413,7 +413,7 @@ static void decoder_do_one(OSSL_PROVIDER *provider,
} }
} }
void OSSL_DECODER_do_all_provided(OPENSSL_CTX *libctx, void OSSL_DECODER_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(OSSL_DECODER *decoder, void *arg), void (*fn)(OSSL_DECODER *decoder, void *arg),
void *arg) void *arg)
{ {
@ -434,7 +434,7 @@ void OSSL_DECODER_names_do_all(const OSSL_DECODER *decoder,
return; return;
if (decoder->base.prov != NULL) { if (decoder->base.prov != NULL) {
OPENSSL_CTX *libctx = ossl_provider_library_context(decoder->base.prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(decoder->base.prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, decoder->base.id, fn, data); ossl_namemap_doall_names(namemap, decoder->base.id, fn, data);

@ -257,7 +257,7 @@ static void collect_decoder(OSSL_DECODER *decoder, void *arg)
int ossl_decoder_ctx_setup_for_EVP_PKEY(OSSL_DECODER_CTX *ctx, int ossl_decoder_ctx_setup_for_EVP_PKEY(OSSL_DECODER_CTX *ctx,
EVP_PKEY **pkey, const char *keytype, EVP_PKEY **pkey, const char *keytype,
OPENSSL_CTX *libctx, OSSL_LIB_CTX *libctx,
const char *propquery) const char *propquery)
{ {
struct collected_data_st *data = NULL; struct collected_data_st *data = NULL;
@ -326,7 +326,7 @@ int ossl_decoder_ctx_setup_for_EVP_PKEY(OSSL_DECODER_CTX *ctx,
OSSL_DECODER_CTX * OSSL_DECODER_CTX *
OSSL_DECODER_CTX_new_by_EVP_PKEY(EVP_PKEY **pkey, OSSL_DECODER_CTX_new_by_EVP_PKEY(EVP_PKEY **pkey,
const char *input_type, const char *keytype, const char *input_type, const char *keytype,
OPENSSL_CTX *libctx, const char *propquery) OSSL_LIB_CTX *libctx, const char *propquery)
{ {
OSSL_DECODER_CTX *ctx = NULL; OSSL_DECODER_CTX *ctx = NULL;

@ -235,7 +235,7 @@ int OSSL_ENCODER_CTX_add_encoder(OSSL_ENCODER_CTX *ctx, OSSL_ENCODER *encoder)
} }
int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx, int OSSL_ENCODER_CTX_add_extra(OSSL_ENCODER_CTX *ctx,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
return 1; return 1;
} }

@ -69,20 +69,20 @@ static void encoder_store_free(void *vstore)
ossl_method_store_free(vstore); ossl_method_store_free(vstore);
} }
static void *encoder_store_new(OPENSSL_CTX *ctx) static void *encoder_store_new(OSSL_LIB_CTX *ctx)
{ {
return ossl_method_store_new(ctx); return ossl_method_store_new(ctx);
} }
static const OPENSSL_CTX_METHOD encoder_store_method = { static const OSSL_LIB_CTX_METHOD encoder_store_method = {
encoder_store_new, encoder_store_new,
encoder_store_free, encoder_store_free,
}; };
/* Data to be passed through ossl_method_construct() */ /* Data to be passed through ossl_method_construct() */
struct encoder_data_st { struct encoder_data_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
OSSL_METHOD_CONSTRUCT_METHOD *mcm; OSSL_METHOD_CONSTRUCT_METHOD *mcm;
int id; /* For get_encoder_from_store() */ int id; /* For get_encoder_from_store() */
const char *names; /* For get_encoder_from_store() */ const char *names; /* For get_encoder_from_store() */
@ -95,7 +95,7 @@ struct encoder_data_st {
*/ */
/* Temporary encoder method store, constructor and destructor */ /* Temporary encoder method store, constructor and destructor */
static void *alloc_tmp_encoder_store(OPENSSL_CTX *ctx) static void *alloc_tmp_encoder_store(OSSL_LIB_CTX *ctx)
{ {
return ossl_method_store_new(ctx); return ossl_method_store_new(ctx);
} }
@ -107,14 +107,14 @@ static void dealloc_tmp_encoder_store(void *store)
} }
/* Get the permanent encoder store */ /* Get the permanent encoder store */
static OSSL_METHOD_STORE *get_encoder_store(OPENSSL_CTX *libctx) static OSSL_METHOD_STORE *get_encoder_store(OSSL_LIB_CTX *libctx)
{ {
return openssl_ctx_get_data(libctx, OPENSSL_CTX_ENCODER_STORE_INDEX, return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_ENCODER_STORE_INDEX,
&encoder_store_method); &encoder_store_method);
} }
/* Get encoder methods from a store, or put one in */ /* Get encoder methods from a store, or put one in */
static void *get_encoder_from_store(OPENSSL_CTX *libctx, void *store, static void *get_encoder_from_store(OSSL_LIB_CTX *libctx, void *store,
void *data) void *data)
{ {
struct encoder_data_st *methdata = data; struct encoder_data_st *methdata = data;
@ -136,7 +136,7 @@ static void *get_encoder_from_store(OPENSSL_CTX *libctx, void *store,
return method; return method;
} }
static int put_encoder_in_store(OPENSSL_CTX *libctx, void *store, static int put_encoder_in_store(OSSL_LIB_CTX *libctx, void *store,
void *method, const OSSL_PROVIDER *prov, void *method, const OSSL_PROVIDER *prov,
int operation_id, const char *names, int operation_id, const char *names,
const char *propdef, void *unused) const char *propdef, void *unused)
@ -257,7 +257,7 @@ static void *construct_encoder(const OSSL_ALGORITHM *algodef,
* namemap entry, this is it. Should the name already exist there, we * namemap entry, this is it. Should the name already exist there, we
* know that ossl_namemap_add() will return its corresponding number. * know that ossl_namemap_add() will return its corresponding number.
*/ */
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *names = algodef->algorithm_names; const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR); int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@ -286,7 +286,7 @@ static void free_encoder(void *method)
} }
/* Fetching support. Can fetch by numeric identity or by name */ /* Fetching support. Can fetch by numeric identity or by name */
static OSSL_ENCODER *inner_ossl_encoder_fetch(OPENSSL_CTX *libctx, static OSSL_ENCODER *inner_ossl_encoder_fetch(OSSL_LIB_CTX *libctx,
int id, const char *name, int id, const char *name,
const char *properties) const char *properties)
{ {
@ -343,13 +343,13 @@ static OSSL_ENCODER *inner_ossl_encoder_fetch(OPENSSL_CTX *libctx,
return method; return method;
} }
OSSL_ENCODER *OSSL_ENCODER_fetch(OPENSSL_CTX *libctx, const char *name, OSSL_ENCODER *OSSL_ENCODER_fetch(OSSL_LIB_CTX *libctx, const char *name,
const char *properties) const char *properties)
{ {
return inner_ossl_encoder_fetch(libctx, 0, name, properties); return inner_ossl_encoder_fetch(libctx, 0, name, properties);
} }
OSSL_ENCODER *ossl_encoder_fetch_by_number(OPENSSL_CTX *libctx, int id, OSSL_ENCODER *ossl_encoder_fetch_by_number(OSSL_LIB_CTX *libctx, int id,
const char *properties) const char *properties)
{ {
return inner_ossl_encoder_fetch(libctx, id, NULL, properties); return inner_ossl_encoder_fetch(libctx, id, NULL, properties);
@ -392,7 +392,7 @@ int OSSL_ENCODER_number(const OSSL_ENCODER *encoder)
int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name) int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name)
{ {
if (encoder->base.prov != NULL) { if (encoder->base.prov != NULL) {
OPENSSL_CTX *libctx = ossl_provider_library_context(encoder->base.prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
return ossl_namemap_name2num(namemap, name) == encoder->base.id; return ossl_namemap_name2num(namemap, name) == encoder->base.id;
@ -410,7 +410,7 @@ static void encoder_do_one(OSSL_PROVIDER *provider,
int no_store, void *vdata) int no_store, void *vdata)
{ {
struct encoder_do_all_data_st *data = vdata; struct encoder_do_all_data_st *data = vdata;
OPENSSL_CTX *libctx = ossl_provider_library_context(provider); OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *names = algodef->algorithm_names; const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR); int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@ -426,7 +426,7 @@ static void encoder_do_one(OSSL_PROVIDER *provider,
} }
} }
void OSSL_ENCODER_do_all_provided(OPENSSL_CTX *libctx, void OSSL_ENCODER_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(OSSL_ENCODER *encoder, void *arg), void (*fn)(OSSL_ENCODER *encoder, void *arg),
void *arg) void *arg)
{ {
@ -451,7 +451,7 @@ void OSSL_ENCODER_names_do_all(const OSSL_ENCODER *encoder,
return; return;
if (encoder->base.prov != NULL) { if (encoder->base.prov != NULL) {
OPENSSL_CTX *libctx = ossl_provider_library_context(encoder->base.prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(encoder->base.prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, encoder->base.id, fn, data); ossl_namemap_doall_names(namemap, encoder->base.id, fn, data);

@ -206,7 +206,7 @@ static void encoder_destruct_EVP_PKEY(void *arg)
static int ossl_encoder_ctx_setup_for_EVP_PKEY(OSSL_ENCODER_CTX *ctx, static int ossl_encoder_ctx_setup_for_EVP_PKEY(OSSL_ENCODER_CTX *ctx,
const EVP_PKEY *pkey, const EVP_PKEY *pkey,
int selection, int selection,
OPENSSL_CTX *libctx, OSSL_LIB_CTX *libctx,
const char *propquery) const char *propquery)
{ {
struct construct_data_st *data = NULL; struct construct_data_st *data = NULL;
@ -337,7 +337,7 @@ static int ossl_encoder_ctx_setup_for_EVP_PKEY(OSSL_ENCODER_CTX *ctx,
OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey, OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
const char *output_type, const char *output_type,
int selection, int selection,
OPENSSL_CTX *libctx, OSSL_LIB_CTX *libctx,
const char *propquery) const char *propquery)
{ {
OSSL_ENCODER_CTX *ctx = NULL; OSSL_ENCODER_CTX *ctx = NULL;

@ -405,7 +405,7 @@ OSSL_PROVIDER *EVP_ASYM_CIPHER_provider(const EVP_ASYM_CIPHER *cipher)
return cipher->prov; return cipher->prov;
} }
EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OPENSSL_CTX *ctx, const char *algorithm, EVP_ASYM_CIPHER *EVP_ASYM_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(ctx, OSSL_OP_ASYM_CIPHER, algorithm, properties, return evp_generic_fetch(ctx, OSSL_OP_ASYM_CIPHER, algorithm, properties,
@ -424,7 +424,7 @@ int EVP_ASYM_CIPHER_number(const EVP_ASYM_CIPHER *cipher)
return cipher->name_id; return cipher->name_id;
} }
void EVP_ASYM_CIPHER_do_all_provided(OPENSSL_CTX *libctx, void EVP_ASYM_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_ASYM_CIPHER *cipher, void (*fn)(EVP_ASYM_CIPHER *cipher,
void *arg), void *arg),
void *arg) void *arg)

@ -83,7 +83,7 @@ int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id, EVP_MD_CTX *evp_md_ctx_new_ex(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
EVP_MD_CTX *ctx; EVP_MD_CTX *ctx;
EVP_PKEY_CTX *pctx = NULL; EVP_PKEY_CTX *pctx = NULL;
@ -954,7 +954,7 @@ static void evp_md_free(void *md)
EVP_MD_free(md); EVP_MD_free(md);
} }
EVP_MD *EVP_MD_fetch(OPENSSL_CTX *ctx, const char *algorithm, EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties) const char *properties)
{ {
EVP_MD *md = EVP_MD *md =
@ -987,7 +987,7 @@ void EVP_MD_free(EVP_MD *md)
OPENSSL_free(md); OPENSSL_free(md);
} }
void EVP_MD_do_all_provided(OPENSSL_CTX *libctx, void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_MD *mac, void *arg), void (*fn)(EVP_MD *mac, void *arg),
void *arg) void *arg)
{ {

@ -1174,7 +1174,7 @@ const OSSL_PARAM *EVP_CIPHER_gettable_ctx_params(const EVP_CIPHER *cipher)
} }
#ifndef FIPS_MODULE #ifndef FIPS_MODULE
static OPENSSL_CTX *EVP_CIPHER_CTX_get_libctx(EVP_CIPHER_CTX *ctx) static OSSL_LIB_CTX *EVP_CIPHER_CTX_get_libctx(EVP_CIPHER_CTX *ctx)
{ {
const EVP_CIPHER *cipher = ctx->cipher; const EVP_CIPHER *cipher = ctx->cipher;
const OSSL_PROVIDER *prov; const OSSL_PROVIDER *prov;
@ -1197,7 +1197,7 @@ int EVP_CIPHER_CTX_rand_key(EVP_CIPHER_CTX *ctx, unsigned char *key)
#else #else
{ {
int kl; int kl;
OPENSSL_CTX *libctx = EVP_CIPHER_CTX_get_libctx(ctx); OSSL_LIB_CTX *libctx = EVP_CIPHER_CTX_get_libctx(ctx);
kl = EVP_CIPHER_CTX_key_length(ctx); kl = EVP_CIPHER_CTX_key_length(ctx);
if (kl <= 0 || RAND_priv_bytes_ex(libctx, key, kl) <= 0) if (kl <= 0 || RAND_priv_bytes_ex(libctx, key, kl) <= 0)
@ -1456,7 +1456,7 @@ static void evp_cipher_free(void *cipher)
EVP_CIPHER_free(cipher); EVP_CIPHER_free(cipher);
} }
EVP_CIPHER *EVP_CIPHER_fetch(OPENSSL_CTX *ctx, const char *algorithm, EVP_CIPHER *EVP_CIPHER_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties) const char *properties)
{ {
EVP_CIPHER *cipher = EVP_CIPHER *cipher =
@ -1494,7 +1494,7 @@ void EVP_CIPHER_free(EVP_CIPHER *cipher)
OPENSSL_free(cipher); OPENSSL_free(cipher);
} }
void EVP_CIPHER_do_all_provided(OPENSSL_CTX *libctx, void EVP_CIPHER_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_CIPHER *mac, void *arg), void (*fn)(EVP_CIPHER *mac, void *arg),
void *arg) void *arg)
{ {

@ -28,20 +28,20 @@ static void evp_method_store_free(void *vstore)
ossl_method_store_free(vstore); ossl_method_store_free(vstore);
} }
static void *evp_method_store_new(OPENSSL_CTX *ctx) static void *evp_method_store_new(OSSL_LIB_CTX *ctx)
{ {
return ossl_method_store_new(ctx); return ossl_method_store_new(ctx);
} }
static const OPENSSL_CTX_METHOD evp_method_store_method = { static const OSSL_LIB_CTX_METHOD evp_method_store_method = {
evp_method_store_new, evp_method_store_new,
evp_method_store_free, evp_method_store_free,
}; };
/* Data to be passed through ossl_method_construct() */ /* Data to be passed through ossl_method_construct() */
struct evp_method_data_st { struct evp_method_data_st {
OPENSSL_CTX *libctx; OSSL_LIB_CTX *libctx;
OSSL_METHOD_CONSTRUCT_METHOD *mcm; OSSL_METHOD_CONSTRUCT_METHOD *mcm;
int operation_id; /* For get_evp_method_from_store() */ int operation_id; /* For get_evp_method_from_store() */
int name_id; /* For get_evp_method_from_store() */ int name_id; /* For get_evp_method_from_store() */
@ -59,7 +59,7 @@ struct evp_method_data_st {
/* /*
* Generic routines to fetch / create EVP methods with ossl_method_construct() * Generic routines to fetch / create EVP methods with ossl_method_construct()
*/ */
static void *alloc_tmp_evp_method_store(OPENSSL_CTX *ctx) static void *alloc_tmp_evp_method_store(OSSL_LIB_CTX *ctx)
{ {
return ossl_method_store_new(ctx); return ossl_method_store_new(ctx);
} }
@ -70,10 +70,10 @@ static void *alloc_tmp_evp_method_store(OPENSSL_CTX *ctx)
ossl_method_store_free(store); ossl_method_store_free(store);
} }
static OSSL_METHOD_STORE *get_evp_method_store(OPENSSL_CTX *libctx) static OSSL_METHOD_STORE *get_evp_method_store(OSSL_LIB_CTX *libctx)
{ {
return openssl_ctx_get_data(libctx, OPENSSL_CTX_EVP_METHOD_STORE_INDEX, return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX,
&evp_method_store_method); &evp_method_store_method);
} }
/* /*
@ -95,7 +95,7 @@ static uint32_t evp_method_id(int name_id, unsigned int operation_id)
return ((name_id << 8) & 0xFFFFFF00) | (operation_id & 0x000000FF); return ((name_id << 8) & 0xFFFFFF00) | (operation_id & 0x000000FF);
} }
static void *get_evp_method_from_store(OPENSSL_CTX *libctx, void *store, static void *get_evp_method_from_store(OSSL_LIB_CTX *libctx, void *store,
void *data) void *data)
{ {
struct evp_method_data_st *methdata = data; struct evp_method_data_st *methdata = data;
@ -133,7 +133,7 @@ static void *get_evp_method_from_store(OPENSSL_CTX *libctx, void *store,
return method; return method;
} }
static int put_evp_method_in_store(OPENSSL_CTX *libctx, void *store, static int put_evp_method_in_store(OSSL_LIB_CTX *libctx, void *store,
void *method, const OSSL_PROVIDER *prov, void *method, const OSSL_PROVIDER *prov,
int operation_id, const char *names, int operation_id, const char *names,
const char *propdef, void *data) const char *propdef, void *data)
@ -185,7 +185,7 @@ static void *construct_evp_method(const OSSL_ALGORITHM *algodef,
* number. * number.
*/ */
struct evp_method_data_st *methdata = data; struct evp_method_data_st *methdata = data;
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
const char *names = algodef->algorithm_names; const char *names = algodef->algorithm_names;
int name_id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR); int name_id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
@ -215,21 +215,21 @@ static void destruct_evp_method(void *method, void *data)
methdata->destruct_method(method); methdata->destruct_method(method);
} }
static const char *libctx_descriptor(OPENSSL_CTX *libctx) static const char *libctx_descriptor(OSSL_LIB_CTX *libctx)
{ {
#ifdef FIPS_MODULE #ifdef FIPS_MODULE
return "FIPS internal library context"; return "FIPS internal library context";
#else #else
if (openssl_ctx_is_global_default(libctx)) if (ossl_lib_ctx_is_global_default(libctx))
return "Global default library context"; return "Global default library context";
if (openssl_ctx_is_default(libctx)) if (ossl_lib_ctx_is_default(libctx))
return "Thread-local default library context"; return "Thread-local default library context";
return "Non-default library context"; return "Non-default library context";
#endif #endif
} }
static void * static void *
inner_evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id, inner_evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id,
int name_id, const char *name, int name_id, const char *name,
const char *properties, const char *properties,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
@ -352,7 +352,7 @@ inner_evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
return method; return method;
} }
void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id, void *evp_generic_fetch(OSSL_LIB_CTX *libctx, int operation_id,
const char *name, const char *properties, const char *name, const char *properties,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns, const OSSL_DISPATCH *fns,
@ -372,7 +372,7 @@ void *evp_generic_fetch(OPENSSL_CTX *libctx, int operation_id,
* This is meant to be used when one method needs to fetch an associated * This is meant to be used when one method needs to fetch an associated
* other method. * other method.
*/ */
void *evp_generic_fetch_by_number(OPENSSL_CTX *libctx, int operation_id, void *evp_generic_fetch_by_number(OSSL_LIB_CTX *libctx, int operation_id,
int name_id, const char *properties, int name_id, const char *properties,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns, const OSSL_DISPATCH *fns,
@ -386,7 +386,7 @@ void *evp_generic_fetch_by_number(OPENSSL_CTX *libctx, int operation_id,
free_method); free_method);
} }
void evp_method_store_flush(OPENSSL_CTX *libctx) void evp_method_store_flush(OSSL_LIB_CTX *libctx)
{ {
OSSL_METHOD_STORE *store = get_evp_method_store(libctx); OSSL_METHOD_STORE *store = get_evp_method_store(libctx);
@ -394,7 +394,7 @@ void evp_method_store_flush(OPENSSL_CTX *libctx)
ossl_method_store_flush_cache(store, 1); ossl_method_store_flush_cache(store, 1);
} }
static int evp_set_parsed_default_properties(OPENSSL_CTX *libctx, static int evp_set_parsed_default_properties(OSSL_LIB_CTX *libctx,
OSSL_PROPERTY_LIST *def_prop, OSSL_PROPERTY_LIST *def_prop,
int loadconfig) int loadconfig)
{ {
@ -412,7 +412,7 @@ static int evp_set_parsed_default_properties(OPENSSL_CTX *libctx,
return 0; return 0;
} }
int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq, int evp_set_default_properties_int(OSSL_LIB_CTX *libctx, const char *propq,
int loadconfig) int loadconfig)
{ {
OSSL_PROPERTY_LIST *pl = NULL; OSSL_PROPERTY_LIST *pl = NULL;
@ -424,12 +424,12 @@ int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq,
return evp_set_parsed_default_properties(libctx, pl, loadconfig); return evp_set_parsed_default_properties(libctx, pl, loadconfig);
} }
int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq) int EVP_set_default_properties(OSSL_LIB_CTX *libctx, const char *propq)
{ {
return evp_set_default_properties_int(libctx, propq, 1); return evp_set_default_properties_int(libctx, propq, 1);
} }
static int evp_default_properties_merge(OPENSSL_CTX *libctx, const char *propq) static int evp_default_properties_merge(OSSL_LIB_CTX *libctx, const char *propq)
{ {
OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1); OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
OSSL_PROPERTY_LIST *pl1, *pl2; OSSL_PROPERTY_LIST *pl1, *pl2;
@ -451,7 +451,7 @@ static int evp_default_properties_merge(OPENSSL_CTX *libctx, const char *propq)
return evp_set_parsed_default_properties(libctx, pl2, 0); return evp_set_parsed_default_properties(libctx, pl2, 0);
} }
static int evp_default_property_is_enabled(OPENSSL_CTX *libctx, static int evp_default_property_is_enabled(OSSL_LIB_CTX *libctx,
const char *prop_name) const char *prop_name)
{ {
OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1); OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
@ -459,12 +459,12 @@ static int evp_default_property_is_enabled(OPENSSL_CTX *libctx,
return plp != NULL && ossl_property_is_enabled(libctx, prop_name, *plp); return plp != NULL && ossl_property_is_enabled(libctx, prop_name, *plp);
} }
int EVP_default_properties_is_fips_enabled(OPENSSL_CTX *libctx) int EVP_default_properties_is_fips_enabled(OSSL_LIB_CTX *libctx)
{ {
return evp_default_property_is_enabled(libctx, "fips"); return evp_default_property_is_enabled(libctx, "fips");
} }
int EVP_default_properties_enable_fips(OPENSSL_CTX *libctx, int enable) int EVP_default_properties_enable_fips(OSSL_LIB_CTX *libctx, int enable)
{ {
const char *query = (enable != 0) ? "fips=yes" : "-fips"; const char *query = (enable != 0) ? "fips=yes" : "-fips";
@ -484,7 +484,7 @@ static void do_one(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo,
int no_store, void *vdata) int no_store, void *vdata)
{ {
struct do_all_data_st *data = vdata; struct do_all_data_st *data = vdata;
OPENSSL_CTX *libctx = ossl_provider_library_context(provider); OSSL_LIB_CTX *libctx = ossl_provider_library_context(provider);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
int name_id = ossl_namemap_add_names(namemap, 0, algo->algorithm_names, int name_id = ossl_namemap_add_names(namemap, 0, algo->algorithm_names,
NAME_SEPARATOR); NAME_SEPARATOR);
@ -499,7 +499,7 @@ static void do_one(OSSL_PROVIDER *provider, const OSSL_ALGORITHM *algo,
} }
} }
void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id, void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id,
void (*user_fn)(void *method, void *arg), void (*user_fn)(void *method, void *arg),
void *user_arg, void *user_arg,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
@ -524,7 +524,7 @@ void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id,
const char *evp_first_name(const OSSL_PROVIDER *prov, int name_id) const char *evp_first_name(const OSSL_PROVIDER *prov, int name_id)
{ {
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
return ossl_namemap_num2name(namemap, name_id, 0); return ossl_namemap_num2name(namemap, name_id, 0);
@ -536,7 +536,7 @@ int evp_is_a(OSSL_PROVIDER *prov, int number,
/* /*
* For a |prov| that is NULL, the library context will be NULL * For a |prov| that is NULL, the library context will be NULL
*/ */
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
if (prov == NULL) if (prov == NULL)
@ -548,7 +548,7 @@ void evp_names_do_all(OSSL_PROVIDER *prov, int number,
void (*fn)(const char *name, void *data), void (*fn)(const char *name, void *data),
void *data) void *data)
{ {
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx); OSSL_NAMEMAP *namemap = ossl_namemap_stored(libctx);
ossl_namemap_doall_names(namemap, number, fn, data); ossl_namemap_doall_names(namemap, number, fn, data);

@ -232,21 +232,21 @@ int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);
#include <openssl/types.h> #include <openssl/types.h>
#include <openssl/core.h> #include <openssl/core.h>
void *evp_generic_fetch(OPENSSL_CTX *ctx, int operation_id, void *evp_generic_fetch(OSSL_LIB_CTX *ctx, int operation_id,
const char *name, const char *properties, const char *name, const char *properties,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns, const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov), OSSL_PROVIDER *prov),
int (*up_ref_method)(void *), int (*up_ref_method)(void *),
void (*free_method)(void *)); void (*free_method)(void *));
void *evp_generic_fetch_by_number(OPENSSL_CTX *ctx, int operation_id, void *evp_generic_fetch_by_number(OSSL_LIB_CTX *ctx, int operation_id,
int name_id, const char *properties, int name_id, const char *properties,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns, const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov), OSSL_PROVIDER *prov),
int (*up_ref_method)(void *), int (*up_ref_method)(void *),
void (*free_method)(void *)); void (*free_method)(void *));
void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id, void evp_generic_do_all(OSSL_LIB_CTX *libctx, int operation_id,
void (*user_fn)(void *method, void *arg), void (*user_fn)(void *method, void *arg),
void *user_arg, void *user_arg,
void *(*new_method)(int name_id, void *(*new_method)(int name_id,
@ -255,7 +255,7 @@ void evp_generic_do_all(OPENSSL_CTX *libctx, int operation_id,
void (*free_method)(void *)); void (*free_method)(void *));
/* Internal fetchers for method types that are to be combined with others */ /* Internal fetchers for method types that are to be combined with others */
EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OPENSSL_CTX *ctx, int name_id, EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id,
const char *properties); const char *properties);
/* Internal structure constructors for fetched methods */ /* Internal structure constructors for fetched methods */

@ -18,7 +18,7 @@
/* Extract a private key from a PKCS8 structure */ /* Extract a private key from a PKCS8 structure */
EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OPENSSL_CTX *libctx, EVP_PKEY *EVP_PKCS82PKEY_ex(const PKCS8_PRIV_KEY_INFO *p8, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
EVP_PKEY *pkey = NULL; EVP_PKEY *pkey = NULL;

@ -263,7 +263,7 @@ static void *evp_rand_from_dispatch(int name_id,
return rand; return rand;
} }
EVP_RAND *EVP_RAND_fetch(OPENSSL_CTX *libctx, const char *algorithm, EVP_RAND *EVP_RAND_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties, return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties,
@ -447,7 +447,7 @@ const OSSL_PARAM *EVP_RAND_settable_ctx_params(const EVP_RAND *rand)
ossl_provider_ctx(EVP_RAND_provider(rand))); ossl_provider_ctx(EVP_RAND_provider(rand)));
} }
void EVP_RAND_do_all_provided(OPENSSL_CTX *libctx, void EVP_RAND_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_RAND *rand, void *arg), void (*fn)(EVP_RAND *rand, void *arg),
void *arg) void *arg)
{ {

@ -166,7 +166,7 @@ OSSL_PROVIDER *EVP_KEYEXCH_provider(const EVP_KEYEXCH *exchange)
return exchange->prov; return exchange->prov;
} }
EVP_KEYEXCH *EVP_KEYEXCH_fetch(OPENSSL_CTX *ctx, const char *algorithm, EVP_KEYEXCH *EVP_KEYEXCH_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties, return evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties,
@ -457,7 +457,7 @@ int EVP_KEYEXCH_is_a(const EVP_KEYEXCH *keyexch, const char *name)
return evp_is_a(keyexch->prov, keyexch->name_id, NULL, name); return evp_is_a(keyexch->prov, keyexch->name_id, NULL, name);
} }
void EVP_KEYEXCH_do_all_provided(OPENSSL_CTX *libctx, void EVP_KEYEXCH_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_KEYEXCH *keyexch, void *arg), void (*fn)(EVP_KEYEXCH *keyexch, void *arg),
void *arg) void *arg)
{ {

@ -147,7 +147,7 @@ static void *evp_kdf_from_dispatch(int name_id,
return kdf; return kdf;
} }
EVP_KDF *EVP_KDF_fetch(OPENSSL_CTX *libctx, const char *algorithm, EVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(libctx, OSSL_OP_KDF, algorithm, properties, return evp_generic_fetch(libctx, OSSL_OP_KDF, algorithm, properties,
@ -186,7 +186,7 @@ const OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf)
return kdf->settable_ctx_params(ossl_provider_ctx(EVP_KDF_provider(kdf))); return kdf->settable_ctx_params(ossl_provider_ctx(EVP_KDF_provider(kdf)));
} }
void EVP_KDF_do_all_provided(OPENSSL_CTX *libctx, void EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_KDF *kdf, void *arg), void (*fn)(EVP_KDF *kdf, void *arg),
void *arg) void *arg)
{ {

@ -321,7 +321,7 @@ OSSL_PROVIDER *EVP_KEM_provider(const EVP_KEM *kem)
return kem->prov; return kem->prov;
} }
EVP_KEM *EVP_KEM_fetch(OPENSSL_CTX *ctx, const char *algorithm, EVP_KEM *EVP_KEM_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties, return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties,
@ -340,7 +340,7 @@ int EVP_KEM_number(const EVP_KEM *kem)
return kem->name_id; return kem->name_id;
} }
void EVP_KEM_do_all_provided(OPENSSL_CTX *libctx, void EVP_KEM_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_KEM *kem, void *arg), void (*fn)(EVP_KEM *kem, void *arg),
void *arg) void *arg)
{ {

@ -197,7 +197,7 @@ static void *keymgmt_from_dispatch(int name_id,
return keymgmt; return keymgmt;
} }
EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OPENSSL_CTX *ctx, int name_id, EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OSSL_LIB_CTX *ctx, int name_id,
const char *properties) const char *properties)
{ {
return evp_generic_fetch_by_number(ctx, return evp_generic_fetch_by_number(ctx,
@ -207,7 +207,7 @@ EVP_KEYMGMT *evp_keymgmt_fetch_by_number(OPENSSL_CTX *ctx, int name_id,
(void (*)(void *))EVP_KEYMGMT_free); (void (*)(void *))EVP_KEYMGMT_free);
} }
EVP_KEYMGMT *EVP_KEYMGMT_fetch(OPENSSL_CTX *ctx, const char *algorithm, EVP_KEYMGMT *EVP_KEYMGMT_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(ctx, OSSL_OP_KEYMGMT, algorithm, properties, return evp_generic_fetch(ctx, OSSL_OP_KEYMGMT, algorithm, properties,
@ -259,7 +259,7 @@ int EVP_KEYMGMT_is_a(const EVP_KEYMGMT *keymgmt, const char *name)
return evp_is_a(keymgmt->prov, keymgmt->name_id, NULL, name); return evp_is_a(keymgmt->prov, keymgmt->name_id, NULL, name);
} }
void EVP_KEYMGMT_do_all_provided(OPENSSL_CTX *libctx, void EVP_KEYMGMT_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_KEYMGMT *keymgmt, void *arg), void (*fn)(EVP_KEYMGMT *keymgmt, void *arg),
void *arg) void *arg)
{ {

@ -38,7 +38,7 @@ static const char *canon_mdname(const char *mdname)
static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
const EVP_MD *type, const char *mdname, const EVP_MD *type, const char *mdname,
OPENSSL_CTX *libctx, const char *props, OSSL_LIB_CTX *libctx, const char *props,
ENGINE *e, EVP_PKEY *pkey, int ver) ENGINE *e, EVP_PKEY *pkey, int ver)
{ {
EVP_PKEY_CTX *locpctx = NULL; EVP_PKEY_CTX *locpctx = NULL;
@ -311,7 +311,7 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
} }
int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, int EVP_DigestSignInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
const char *mdname, OPENSSL_CTX *libctx, const char *mdname, OSSL_LIB_CTX *libctx,
const char *props, EVP_PKEY *pkey) const char *props, EVP_PKEY *pkey)
{ {
return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 0); return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 0);
@ -324,7 +324,7 @@ int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
} }
int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, int EVP_DigestVerifyInit_ex(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
const char *mdname, OPENSSL_CTX *libctx, const char *mdname, OSSL_LIB_CTX *libctx,
const char *props, EVP_PKEY *pkey) const char *props, EVP_PKEY *pkey)
{ {
return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 1); return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 1);

@ -149,7 +149,7 @@ static void *evp_mac_from_dispatch(int name_id,
return mac; return mac;
} }
EVP_MAC *EVP_MAC_fetch(OPENSSL_CTX *libctx, const char *algorithm, EVP_MAC *EVP_MAC_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
const char *properties) const char *properties)
{ {
return evp_generic_fetch(libctx, OSSL_OP_MAC, algorithm, properties, return evp_generic_fetch(libctx, OSSL_OP_MAC, algorithm, properties,
@ -193,7 +193,7 @@ const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac)
return mac->settable_ctx_params(ossl_provider_ctx(EVP_MAC_provider(mac))); return mac->settable_ctx_params(ossl_provider_ctx(EVP_MAC_provider(mac)));
} }
void EVP_MAC_do_all_provided(OPENSSL_CTX *libctx, void EVP_MAC_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_MAC *mac, void *arg), void (*fn)(EVP_MAC *mac, void *arg),
void *arg) void *arg)
{ {

@ -72,7 +72,8 @@ const EVP_CIPHER *EVP_get_cipherbyname(const char *name)
return evp_get_cipherbyname_ex(NULL, name); return evp_get_cipherbyname_ex(NULL, name);
} }
const EVP_CIPHER *evp_get_cipherbyname_ex(OPENSSL_CTX *libctx, const char *name) const EVP_CIPHER *evp_get_cipherbyname_ex(OSSL_LIB_CTX *libctx,
const char *name)
{ {
const EVP_CIPHER *cp; const EVP_CIPHER *cp;
OSSL_NAMEMAP *namemap; OSSL_NAMEMAP *namemap;
@ -117,7 +118,7 @@ const EVP_MD *EVP_get_digestbyname(const char *name)
return evp_get_digestbyname_ex(NULL, name); return evp_get_digestbyname_ex(NULL, name);
} }
const EVP_MD *evp_get_digestbyname_ex(OPENSSL_CTX *libctx, const char *name) const EVP_MD *evp_get_digestbyname_ex(OSSL_LIB_CTX *libctx, const char *name)
{ {
const EVP_MD *dp; const EVP_MD *dp;
OSSL_NAMEMAP *namemap; OSSL_NAMEMAP *namemap;

@ -22,7 +22,7 @@
int pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen, int pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen,
const unsigned char *salt, int saltlen, int iter, const unsigned char *salt, int saltlen, int iter,
const EVP_MD *digest, int keylen, unsigned char *out, const EVP_MD *digest, int keylen, unsigned char *out,
OPENSSL_CTX *libctx, const char *propq) OSSL_LIB_CTX *libctx, const char *propq)
{ {
const char *empty = ""; const char *empty = "";
int rv = 1, mode = 1; int rv = 1, mode = 1;

@ -335,7 +335,7 @@ int EVP_PKEY_eq(const EVP_PKEY *a, const EVP_PKEY *b)
} }
static EVP_PKEY *new_raw_key_int(OPENSSL_CTX *libctx, static EVP_PKEY *new_raw_key_int(OSSL_LIB_CTX *libctx,
const char *strtype, const char *strtype,
const char *propq, const char *propq,
int nidtype, int nidtype,
@ -450,7 +450,7 @@ static EVP_PKEY *new_raw_key_int(OPENSSL_CTX *libctx,
return pkey; return pkey;
} }
EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OPENSSL_CTX *libctx, EVP_PKEY *EVP_PKEY_new_raw_private_key_ex(OSSL_LIB_CTX *libctx,
const char *keytype, const char *keytype,
const char *propq, const char *propq,
const unsigned char *priv, size_t len) const unsigned char *priv, size_t len)
@ -466,7 +466,7 @@ EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,
return new_raw_key_int(NULL, NULL, NULL, type, e, priv, len, 1); return new_raw_key_int(NULL, NULL, NULL, type, e, priv, len, 1);
} }
EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OPENSSL_CTX *libctx, EVP_PKEY *EVP_PKEY_new_raw_public_key_ex(OSSL_LIB_CTX *libctx,
const char *keytype, const char *propq, const char *keytype, const char *propq,
const unsigned char *pub, size_t len) const unsigned char *pub, size_t len)
{ {
@ -576,7 +576,8 @@ int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub,
static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len, static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
const char *cipher_name, const char *cipher_name,
const EVP_CIPHER *cipher, OPENSSL_CTX *libctx, const EVP_CIPHER *cipher,
OSSL_LIB_CTX *libctx,
const char *propq, ENGINE *e) const char *propq, ENGINE *e)
{ {
# ifndef OPENSSL_NO_CMAC # ifndef OPENSSL_NO_CMAC
@ -634,7 +635,7 @@ static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
} }
EVP_PKEY *EVP_PKEY_new_CMAC_key_ex(const unsigned char *priv, size_t len, EVP_PKEY *EVP_PKEY_new_CMAC_key_ex(const unsigned char *priv, size_t len,
const char *cipher_name, OPENSSL_CTX *libctx, const char *cipher_name, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
return new_cmac_key_int(priv, len, cipher_name, NULL, libctx, propq, NULL); return new_cmac_key_int(priv, len, cipher_name, NULL, libctx, propq, NULL);
@ -1069,7 +1070,7 @@ int EVP_PKEY_can_sign(const EVP_PKEY *pkey)
} }
} else { } else {
const OSSL_PROVIDER *prov = EVP_KEYMGMT_provider(pkey->keymgmt); const OSSL_PROVIDER *prov = EVP_KEYMGMT_provider(pkey->keymgmt);
OPENSSL_CTX *libctx = ossl_provider_library_context(prov); OSSL_LIB_CTX *libctx = ossl_provider_library_context(prov);
const char *supported_sig = const char *supported_sig =
pkey->keymgmt->query_operation_name != NULL pkey->keymgmt->query_operation_name != NULL
? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE) ? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE)
@ -1171,7 +1172,7 @@ static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,
static int print_pkey(const EVP_PKEY *pkey, BIO *out, int indent, static int print_pkey(const EVP_PKEY *pkey, BIO *out, int indent,
int selection /* For provided encoding */, int selection /* For provided encoding */,
OPENSSL_CTX *libctx /* For provided encoding */, OSSL_LIB_CTX *libctx /* For provided encoding */,
const char *propquery /* For provided encoding */, const char *propquery /* For provided encoding */,
int (*legacy_print)(BIO *out, const EVP_PKEY *pkey, int (*legacy_print)(BIO *out, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx), int indent, ASN1_PCTX *pctx),
@ -1687,7 +1688,7 @@ int EVP_PKEY_size(const EVP_PKEY *pkey)
return size; return size;
} }
void *evp_pkey_export_to_provider(EVP_PKEY *pk, OPENSSL_CTX *libctx, void *evp_pkey_export_to_provider(EVP_PKEY *pk, OSSL_LIB_CTX *libctx,
EVP_KEYMGMT **keymgmt, EVP_KEYMGMT **keymgmt,
const char *propquery) const char *propquery)
{ {
@ -1884,7 +1885,7 @@ int evp_pkey_copy_downgraded(EVP_PKEY **dest, const EVP_PKEY *src)
* We perform the export in the same libctx as the keymgmt * We perform the export in the same libctx as the keymgmt
* that we are using. * that we are using.
*/ */
OPENSSL_CTX *libctx = OSSL_LIB_CTX *libctx =
ossl_provider_library_context(keymgmt->prov); ossl_provider_library_context(keymgmt->prov);
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX *pctx =
EVP_PKEY_CTX_new_from_pkey(libctx, *dest, NULL); EVP_PKEY_CTX_new_from_pkey(libctx, *dest, NULL);

@ -15,7 +15,7 @@
#include "crypto/evp.h" #include "crypto/evp.h"
int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *sigret, int EVP_SignFinal_ex(EVP_MD_CTX *ctx, unsigned char *sigret,
unsigned int *siglen, EVP_PKEY *pkey, OPENSSL_CTX *libctx, unsigned int *siglen, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
unsigned char m[EVP_MAX_MD_SIZE]; unsigned char m[EVP_MAX_MD_SIZE];

@ -15,7 +15,7 @@
#include "crypto/evp.h" #include "crypto/evp.h"
int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf, int EVP_VerifyFinal_ex(EVP_MD_CTX *ctx, const unsigned char *sigbuf,
unsigned int siglen, EVP_PKEY *pkey, OPENSSL_CTX *libctx, unsigned int siglen, EVP_PKEY *pkey, OSSL_LIB_CTX *libctx,
const char *propq) const char *propq)
{ {
unsigned char m[EVP_MAX_MD_SIZE]; unsigned char m[EVP_MAX_MD_SIZE];

@ -62,7 +62,7 @@ int EVP_PBE_scrypt(const char *pass, size_t passlen,
if (maxmem == 0) if (maxmem == 0)
maxmem = SCRYPT_MAX_MEM; maxmem = SCRYPT_MAX_MEM;
/* Use OPENSSL_CTX_set0_default() if you need a library context */ /* Use OSSL_LIB_CTX_set0_default() if you need a library context */
kdf = EVP_KDF_fetch(NULL, OSSL_KDF_NAME_SCRYPT, NULL); kdf = EVP_KDF_fetch(NULL, OSSL_KDF_NAME_SCRYPT, NULL);
kctx = EVP_KDF_CTX_new(kdf); kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf); EVP_KDF_free(kdf);

@ -172,7 +172,7 @@ static int get_legacy_alg_type_from_keymgmt(const EVP_KEYMGMT *keymgmt)
} }
#endif /* FIPS_MODULE */ #endif /* FIPS_MODULE */
static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx, static EVP_PKEY_CTX *int_ctx_new(OSSL_LIB_CTX *libctx,
EVP_PKEY *pkey, ENGINE *e, EVP_PKEY *pkey, ENGINE *e,
const char *keytype, const char *propquery, const char *keytype, const char *propquery,
int id) int id)
@ -338,14 +338,14 @@ static EVP_PKEY_CTX *int_ctx_new(OPENSSL_CTX *libctx,
/*- All methods below can also be used in FIPS_MODULE */ /*- All methods below can also be used in FIPS_MODULE */
EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OPENSSL_CTX *libctx, EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OSSL_LIB_CTX *libctx,
const char *name, const char *name,
const char *propquery) const char *propquery)
{ {
return int_ctx_new(libctx, NULL, NULL, name, propquery, -1); return int_ctx_new(libctx, NULL, NULL, name, propquery, -1);
} }
EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OPENSSL_CTX *libctx, EVP_PKEY *pkey, EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx, EVP_PKEY *pkey,
const char *propquery) const char *propquery)
{ {
return int_ctx_new(libctx, pkey, NULL, NULL, propquery, -1); return int_ctx_new(libctx, pkey, NULL, NULL, propquery, -1);
@ -1762,7 +1762,7 @@ int evp_pkey_ctx_use_cached_data(EVP_PKEY_CTX *ctx)
return ret; return ret;
} }
OPENSSL_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx) OSSL_LIB_CTX *EVP_PKEY_CTX_get0_libctx(EVP_PKEY_CTX *ctx)
{ {
return ctx->libctx; return ctx->libctx;
} }

Some files were not shown because too many files have changed in this diff Show More