*Rich Salz and Richard Levitte*
- * Added a library context that applications as well as other
- libraries can use to form a separate context within which libcrypto
- operations are performed.
+ * Added a library context `OSSL_LIB_CTX` that applications as well as
+ other libraries can use to form a separate context within which
+ libcrypto operations are performed.
There are two ways this can be used:
such an argument, such as `EVP_CIPHER_fetch` and similar algorithm
fetching functions.
- 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,
- apart from the functions directly related to `OPENSSL_CTX`, accept
+ All public OpenSSL functions that take an `OSSL_LIB_CTX` pointer,
+ apart from the functions directly related to `OSSL_LIB_CTX`, accept
NULL to indicate that the default library context should be used.
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.
+ _(Note: the library context was initially called `OPENSSL_CTX` and
+ renamed to `OSSL_LIB_CTX` in version 3.0.0 alpha7.)_
+
*Richard Levitte*
* Handshake now fails if Extended Master Secret extension is dropped
* Remove the `RAND_DRBG` 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.
* The X25519, X448, Ed25519, Ed448 and SHAKE256 algorithms are included in
the FIPS provider. None have the "fips=yes" property set and, as such,
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);
mock_srv_ctx *ctx = mock_srv_ctx_new();
# 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);
int ossl_cmp_mock_srv_set1_certOut(OSSL_CMP_SRV_CTX *srv_ctx, X509 *cert);
static void receipt_request_print(CMS_ContentInfo *cms);
static CMS_ReceiptRequest *make_receipt_request(
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,
STACK_OF(OPENSSL_STRING) *param);
static CMS_ContentInfo *load_content_info(int informat, BIO *in, BIO **indata,
const char *name,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx,
+ const char *propq)
{
CMS_ContentInfo *ret, *ci;
long ltmp;
const char *mime_eol = "\n";
OPTION_CHOICE o;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
if ((vpm = X509_VERIFY_PARAM_new()) == NULL)
static CMS_ReceiptRequest *make_receipt_request(
STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
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;
CMS_ReceiptRequest *rr;
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);
}
/*
#endif
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);
typedef enum OPTION_choice {
OPTION_CHOICE o;
int outformat = FORMAT_PEM, text = 0, ret = 1, rv, do_param = 0;
int private = 0;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
prog = opt_init(argc, argv, genpkey_options);
}
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;
EVP_PKEY *pkey = NULL;
int init_gen_str(EVP_PKEY_CTX **pctx,
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;
const EVP_PKEY_ASN1_METHOD *ameth;
int x509_req_ctrl_string(X509_REQ *x, const char *value);
int init_gen_str(EVP_PKEY_CTX **pctx,
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,
STACK_OF(OPENSSL_STRING) *sigopts);
int do_X509_verify(X509 *x, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *vfyopts);
extern VERIFY_CB_ARGS verify_args;
-OPENSSL_CTX *app_create_libctx(void);
-OPENSSL_CTX *app_get0_libctx(void);
+OSSL_LIB_CTX *app_create_libctx(void);
+OSSL_LIB_CTX *app_get0_libctx(void);
OSSL_PARAM *app_params_new_from_opts(STACK_OF(OPENSSL_STRING) *opts,
const OSSL_PARAM *paramdefs);
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);
-OPENSSL_CTX *app_get0_libctx(void);
+OSSL_LIB_CTX *app_get0_libctx(void);
const char *app_get0_propq(void);
#endif
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;
unsigned long mask;
} 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,
const NAME_EX_TBL * in_tbl);
return OPENSSL_strdup(tpass);
}
-OPENSSL_CTX *app_get0_libctx(void)
+OSSL_LIB_CTX *app_get0_libctx(void)
{
return app_libctx;
}
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
BIO_puts(bio_err, "Failed to create null provider\n");
return NULL;
}
- app_libctx = OPENSSL_CTX_new();
+ app_libctx = OSSL_LIB_CTX_new();
}
if (app_libctx == NULL)
BIO_puts(bio_err, "Failed to create library context\n");
{
PW_CB_DATA uidata;
OSSL_STORE_CTX *ctx = NULL;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
int ncerts = 0;
int ncrls = 0;
{
X509_STORE *store = X509_STORE_new();
X509_LOOKUP *lookup;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
if (store == NULL)
static void apps_shutdown(void)
{
app_providers_cleanup();
- OPENSSL_CTX_free(app_get0_libctx());
+ OSSL_LIB_CTX_free(app_get0_libctx());
destroy_ui_method();
}
char *infile = NULL, *outfile = NULL, *prog;
int i, print_certs = 0, text = 0, noout = 0, p7_print = 0, ret = 1;
OPTION_CHOICE o;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
prog = opt_init(argc, argv, pkcs7_options);
const char *keyfile, int keyform, int key_type,
char *passinarg, int pkey_op, ENGINE *e,
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,
ENGINE *e);
int rawin = 0;
const EVP_MD *md = NULL;
int filesize = -1;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = NULL;
prog = opt_init(argc, argv, pkeyutl_options);
char *passinarg, int pkey_op, ENGINE *e,
const int engine_impl, int rawin,
EVP_PKEY **ppkey,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *ctx = NULL;
int vpmtouched = 0, rv = 0;
ENGINE *e = NULL;
const char *mime_eol = "\n";
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
if ((vpm = X509_VERIFY_PARAM_new()) == NULL)
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search,
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 {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP, OPT_ENGINE, OPT_OUT, OPT_PASSIN,
char *alias = NULL;
OSSL_STORE_SEARCH *search = 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();
while ((o = opt_next()) != OPT_EOF) {
static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
int expected, int criterion, OSSL_STORE_SEARCH *search,
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;
int ret = 1, items = 0;
{
X509_STORE *cert_ctx = NULL;
X509_LOOKUP *lookup = NULL;
- OPENSSL_CTX *libctx = app_get0_libctx();
+ OSSL_LIB_CTX *libctx = app_get0_libctx();
const char *propq = app_get0_propq();
cert_ctx = X509_STORE_new();
int asn1_item_digest_ex(const ASN1_ITEM *it, const EVP_MD *md, void *asn,
unsigned char *data, unsigned int *len,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
int i, ret = 0;
unsigned char *str = NULL;
int ASN1_item_sign_ex(const ASN1_ITEM *it, X509_ALGOR *algor1,
X509_ALGOR *algor2, ASN1_BIT_STRING *signature,
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)
{
int rv = 0;
int ASN1_item_verify_ex(const ASN1_ITEM *it, const X509_ALGOR *alg,
const ASN1_BIT_STRING *signature, const void *data,
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;
int rv = -1;
int SMIME_write_ASN1_ex(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
int ctype_nid, int econt_nid,
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;
int i;
#include "crypto/evp.h"
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;
const unsigned char *p = *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)
{
STACK_OF(ASN1_TYPE) *inkey;
int (*func)(void *), void *args, size_t size)
{
async_ctx *ctx;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
return ASYNC_ERR;
* Restore the default libctx to what it was the last time the
* fibre ran
*/
- libctx = OPENSSL_CTX_set0_default(ctx->currjob->libctx);
+ libctx = OSSL_LIB_CTX_set0_default(ctx->currjob->libctx);
/* Resume previous job */
if (!async_fibre_swapcontext(&ctx->dispatcher,
&ctx->currjob->fibrectx, 1)) {
* again to what it was originally, 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);
continue;
}
ctx->currjob->func = func;
ctx->currjob->waitctx = wctx;
- libctx = openssl_ctx_get_concrete(NULL);
+ libctx = ossl_lib_ctx_get_concrete(NULL);
if (!async_fibre_swapcontext(&ctx->dispatcher,
&ctx->currjob->fibrectx, 1)) {
ASYNCerr(ASYNC_F_ASYNC_START_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
* 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.
*/
- ctx->currjob->libctx = OPENSSL_CTX_set0_default(libctx);
+ ctx->currjob->libctx = OSSL_LIB_CTX_set0_default(libctx);
}
err:
int ret;
int status;
ASYNC_WAIT_CTX *waitctx;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
};
struct fd_lookup_st {
/* Flags. */
int flags;
/* The library context */
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
};
#ifndef FIPS_MODULE
# define CTXDBG(str, ctx) do {} while(0)
#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;
}
#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);
return ret;
}
-OPENSSL_CTX *bn_get_lib_ctx(BN_CTX *ctx)
+OSSL_LIB_CTX *bn_get_lib_ctx(BN_CTX *ctx)
{
if (ctx == NULL)
return NULL;
{
unsigned char *buf = NULL;
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 (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
unsigned char *k_bytes = NULL;
int ret = 0;
EVP_MD *md = NULL;
- OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx);
+ OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
if (mdctx == NULL)
goto err;
* Allocates and initializes OSSL_CMP_CTX context structure with default values.
* 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));
* this structure is used to store the context for CMP sessions
*/
struct ossl_cmp_ctx_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
const char *propq;
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 */
int ossl_cmp_asn1_octet_string_set1_bytes(ASN1_OCTET_STRING **tgt,
const unsigned char *bytes, int len);
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,
STACK_OF(X509) *certs, X509 *cert);
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));
*/
/* TODO this should be of more general interest and thus be exported. */
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,
STACK_OF(X509) *certs, X509 *cert)
{
/* 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)
{
CMS_ContentInfo *cms;
/* CMS DigestedData Utilities */
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_DigestedData *dd;
#ifndef OPENSSL_NO_EC
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_CTX *pctx = NULL;
}
CMS_ContentInfo *CMS_EnvelopedData_create_ex(const EVP_CIPHER *cipher,
- OPENSSL_CTX *libctx,
+ OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
}
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)
{
CMS_ContentInfo *cms;
CMS_ReceiptRequest *CMS_ReceiptRequest_create0_ex(
unsigned char *id, int idlen, int allorfirst,
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;
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;
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 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);
typedef struct CMS_CTX_st CMS_CTX;
struct CMS_CTX_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
};
BIO *cms_content_bio(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);
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,
- OPENSSL_CTX *libctx, const char *propq);
+ OSSL_LIB_CTX *libctx,
+ const char *propq);
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);
int cms_SignedData_final(CMS_ContentInfo *cms, BIO *chain);
ASN1_INTEGER **sno);
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);
BIO *cms_CompressedData_init_bio(const CMS_ContentInfo *cms);
}
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_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)
{
CMS_ContentInfo *cms;
CMS_ContentInfo *CMS_EncryptedData_encrypt_ex(BIO *in, const EVP_CIPHER *cipher,
const unsigned char *key,
size_t keylen, unsigned int flags,
- OPENSSL_CTX *libctx,
+ OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
CMS_ContentInfo *CMS_sign_ex(X509 *signcert, EVP_PKEY *pkey,
STACK_OF(X509) *certs, BIO *data,
- unsigned int flags, OPENSSL_CTX *libctx,
+ unsigned int flags, OSSL_LIB_CTX *libctx,
const char *propq)
{
CMS_ContentInfo *cms;
CMS_ContentInfo *CMS_encrypt_ex(STACK_OF(X509) *certs, BIO *data,
const EVP_CIPHER *cipher, unsigned int flags,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
CMS_ContentInfo *cms;
int i;
* 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;
}
-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)
{
char *file = NULL;
#include "internal/thread_once.h"
#include "internal/property.h"
-struct openssl_ctx_onfree_list_st {
- openssl_ctx_onfree_fn *fn;
- struct openssl_ctx_onfree_list_st *next;
+struct ossl_lib_ctx_onfree_list_st {
+ ossl_lib_ctx_onfree_fn *fn;
+ struct ossl_lib_ctx_onfree_list_st *next;
};
-struct openssl_ctx_st {
+struct ossl_lib_ctx_st {
CRYPTO_RWLOCK *lock;
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.
*/
OSSL_EX_DATA_GLOBAL global;
/* 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 */
- CRYPTO_RWLOCK *index_locks[OPENSSL_CTX_MAX_INDEXES];
+ CRYPTO_RWLOCK *index_locks[OSSL_LIB_CTX_MAX_INDEXES];
CRYPTO_RWLOCK *oncelock;
- int run_once_done[OPENSSL_CTX_MAX_RUN_ONCE];
- int run_once_ret[OPENSSL_CTX_MAX_RUN_ONCE];
- struct openssl_ctx_onfree_list_st *onfreelist;
+ int run_once_done[OSSL_LIB_CTX_MAX_RUN_ONCE];
+ int run_once_ret[OSSL_LIB_CTX_MAX_RUN_ONCE];
+ 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;
int exdata_done = 0;
if (ctx->oncelock == NULL)
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->dyn_indexes[i] = -1;
if (ctx->index_locks[i] == NULL)
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))
goto err;
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)) {
crypto_cleanup_all_ex_data_int(ctx);
goto err;
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;
if (ctx == NULL)
onfree = onfree->next;
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);
- 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->oncelock);
#ifndef FIPS_MODULE
/* 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_THREAD_LOCAL default_context_thread_local;
&& context_init(&default_context_int);
}
-void openssl_ctx_default_deinit(void)
+void ossl_lib_ctx_default_deinit(void)
{
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))
return NULL;
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)
current_defctx = &default_context_int;
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)
defctx = NULL;
}
#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)) {
- OPENSSL_CTX_free(ctx);
+ OSSL_LIB_CTX_free(ctx);
ctx = NULL;
}
return ctx;
}
#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;
}
#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;
context_deinit(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
- OPENSSL_CTX *current_defctx;
+ OSSL_LIB_CTX *current_defctx;
if ((current_defctx = get_default_context()) != NULL
&& set_default_context(libctx))
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
if (ctx == NULL)
return ctx;
}
-int openssl_ctx_is_default(OPENSSL_CTX *ctx)
+int ossl_lib_ctx_is_default(OSSL_LIB_CTX *ctx)
{
#ifndef FIPS_MODULE
if (ctx == NULL || ctx == get_default_context())
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
- if (openssl_ctx_get_concrete(ctx) == &default_context_int)
+ if (ossl_lib_ctx_get_concrete(ctx) == &default_context_int)
return 1;
#endif
return 0;
}
-static void openssl_ctx_generic_new(void *parent_ign, void *ptr_ign,
- CRYPTO_EX_DATA *ad, int index,
- long argl_ign, void *argp)
+static void ossl_lib_ctx_generic_new(void *parent_ign, void *ptr_ign,
+ CRYPTO_EX_DATA *ad, int index,
+ long argl_ign, void *argp)
{
- const OPENSSL_CTX_METHOD *meth = argp;
- void *ptr = meth->new_func(crypto_ex_data_get_openssl_ctx(ad));
+ const OSSL_LIB_CTX_METHOD *meth = argp;
+ void *ptr = meth->new_func(crypto_ex_data_get_ossl_lib_ctx(ad));
if (ptr != NULL)
CRYPTO_set_ex_data(ad, index, ptr);
}
-static void openssl_ctx_generic_free(void *parent_ign, void *ptr,
- CRYPTO_EX_DATA *ad, int index,
- long argl_ign, void *argp)
+static void ossl_lib_ctx_generic_free(void *parent_ign, void *ptr,
+ CRYPTO_EX_DATA *ad, int index,
+ long argl_ign, void *argp)
{
- const OPENSSL_CTX_METHOD *meth = argp;
+ const OSSL_LIB_CTX_METHOD *meth = argp;
meth->free_func(ptr);
}
/* Non-static so we can use it in context_internal_test */
-static int openssl_ctx_init_index(OPENSSL_CTX *ctx, int static_index,
- const OPENSSL_CTX_METHOD *meth)
+static int ossl_lib_ctx_init_index(OSSL_LIB_CTX *ctx, int static_index,
+ const OSSL_LIB_CTX_METHOD *meth)
{
int idx;
- ctx = openssl_ctx_get_concrete(ctx);
+ ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL)
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,
- openssl_ctx_generic_new,
- NULL, openssl_ctx_generic_free);
+ ossl_lib_ctx_generic_new,
+ NULL, ossl_lib_ctx_generic_free);
if (idx < 0)
return 0;
return 1;
}
-void *openssl_ctx_get_data(OPENSSL_CTX *ctx, int index,
- const OPENSSL_CTX_METHOD *meth)
+void *ossl_lib_ctx_get_data(OSSL_LIB_CTX *ctx, int index,
+ const OSSL_LIB_CTX_METHOD *meth)
{
void *data = NULL;
int dynidx;
- ctx = openssl_ctx_get_concrete(ctx);
+ ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL)
return NULL;
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->index_locks[index]);
return NULL;
CRYPTO_THREAD_unlock(ctx->lock);
/* 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]))
data = CRYPTO_get_ex_data(&ctx->data, ctx->dyn_indexes[index]);
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)
return NULL;
return &ctx->global;
}
-int openssl_ctx_run_once(OPENSSL_CTX *ctx, unsigned int idx,
- openssl_ctx_run_once_fn run_once_fn)
+int ossl_lib_ctx_run_once(OSSL_LIB_CTX *ctx, unsigned int idx,
+ ossl_lib_ctx_run_once_fn run_once_fn)
{
int done = 0, ret = 0;
- ctx = openssl_ctx_get_concrete(ctx);
+ ctx = ossl_lib_ctx_get_concrete(ctx);
if (ctx == NULL)
return 0;
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));
if (newonfree == NULL)
#include "internal/provider.h"
struct algorithm_data_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
int operation_id; /* May be zero for finding them all */
int (*pre)(OSSL_PROVIDER *, int operation_id, void *data, int *result);
void (*fn)(OSSL_PROVIDER *, const OSSL_ALGORITHM *, int no_store,
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,
int (*pre)(OSSL_PROVIDER *, int operation_id,
void *data, int *result),
#include "internal/provider.h"
struct construct_data_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
OSSL_METHOD_STORE *store;
int operation_id;
int force_store;
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,
OSSL_METHOD_CONSTRUCT_METHOD *mcm, void *mcm_data)
{
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();
}
}
-static const OPENSSL_CTX_METHOD stored_namemap_method = {
+static const OSSL_LIB_CTX_METHOD stored_namemap_method = {
stored_namemap_new,
stored_namemap_free,
};
* ==========================
*/
-OSSL_NAMEMAP *ossl_namemap_stored(OPENSSL_CTX *libctx)
+OSSL_NAMEMAP *ossl_namemap_stored(OSSL_LIB_CTX *libctx)
{
OSSL_NAMEMAP *namemap =
- openssl_ctx_get_data(libctx, OPENSSL_CTX_NAMEMAP_INDEX,
- &stored_namemap_method);
+ ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_NAMEMAP_INDEX,
+ &stored_namemap_method);
#ifndef FIPS_MODULE
if (namemap != NULL && ossl_namemap_empty(namemap)) {
static int create_popo_signature(OSSL_CRMF_POPOSIGNINGKEY *ps,
const OSSL_CRMF_CERTREQUEST *cr,
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) {
CRMFerr(0, CRMF_R_NULL_ARGUMENT);
int OSSL_CRMF_MSG_create_popo(int meth, OSSL_CRMF_MSG *crm,
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;
ASN1_INTEGER *tag = NULL;
/* 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 rid, int acceptRAVerified,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
OSSL_CRMF_MSG *req = NULL;
X509_PUBKEY *pubkey = NULL;
*/
X509
*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)
{
X509 *cert = NULL; /* decrypted certificate */
* |macnid| e.g., NID_hmac_sha1
* 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 macnid)
{
* returns 1 on success, 0 on error
*/
/* 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 unsigned char *msg, size_t msglen,
const unsigned char *sec, size_t seclen,
* -1 on internal (malloc) failure
*/
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)
{
unsigned char *pkey_der = NULL;
/* milliseconds since epoch (to check that the SCT isn't from the future) */
uint64_t epoch_time_in_ms;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
};
/* milliseconds since epoch (to check that SCTs aren't from the future) */
uint64_t epoch_time_in_ms;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
};
/*
* 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.
*/
* Information about a CT log server.
*/
struct ctlog_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
char *name;
uint8_t log_id[CT_V1_HASHLEN];
* It takes ownership of any CTLOG instances added to it.
*/
struct ctlog_store_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
STACK_OF(CTLOG) *logs;
};
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));
* Takes ownership of the public key.
* 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)
{
CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
*/
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)
{
CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));
#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));
}
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)
{
DH *dh = from->pkey.dh;
#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;
int ok = 0;
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)
{
DH *dh = dh_new_ex(libctx);
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;
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 unsigned char *Z, size_t Zlen,
const char *cek_alg,
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;
EVP_KDF_CTX *kctx = NULL;
int nid;
const char *key_alg = NULL;
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);
if (nid == NID_undef)
#include "crypto/dh.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
int DH_set_method(DH *dh, const DH_METHOD *meth)
}
#endif /* !FIPS_MODULE */
-DH *dh_new_ex(OPENSSL_CTX *libctx)
+DH *dh_new_ex(OSSL_LIB_CTX *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));
CRYPTO_EX_DATA ex_data;
ENGINE *engine;
#endif
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
const DH_METHOD *meth;
CRYPTO_RWLOCK *lock;
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)
{
DH *ret;
}
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)
{
DSA *dsa = from->pkey.dsa;
#include "crypto/dsa.h"
#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
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));
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);
}
/* functional reference if 'meth' is ENGINE-provided */
ENGINE *engine;
CRYPTO_RWLOCK *lock;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
/* Provider data */
size_t dirty_cnt; /* If any key material changes, increment this */
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],
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
uint8_t az[SHA512_DIGEST_LENGTH];
uint8_t nonce[SHA512_DIGEST_LENGTH];
int ED25519_verify(const uint8_t *message, size_t message_len,
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;
ge_p3 A;
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)
{
uint8_t az[SHA512_DIGEST_LENGTH];
# define OSSL_CRYPTO_EC_CURVE448_LOCAL_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 *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 *context, size_t context_len, const char *propq);
* privkey (in): The private key.
*/
c448_error_t c448_ed448_derive_public_key(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t pubkey [EDDSA_448_PUBLIC_BYTES],
const uint8_t privkey [EDDSA_448_PRIVATE_BYTES],
const char *propq);
* disambiguation. For Ed448 it is safe.
*/
c448_error_t c448_ed448_sign(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
* disambiguation. For Ed448 it is safe.
*/
c448_error_t c448_ed448_sign_prehash(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
* non-prehashed messages, at least without some very careful protocol-level
* 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
signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t
* disambiguation. For Ed448 it is safe.
*/
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 pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t hash[64],
* ed (in): The EdDSA private key
*/
c448_error_t c448_ed448_convert_private_key_to_x448(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t x[X448_PRIVATE_BYTES],
const uint8_t ed[EDDSA_448_PRIVATE_BYTES],
const char *propq);
#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 char *propq)
{
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 for_prehash,
const uint8_t *context,
/* In this file because it uses the hash */
c448_error_t c448_ed448_convert_private_key_to_x448(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t x[X448_PRIVATE_BYTES],
const uint8_t ed [EDDSA_448_PRIVATE_BYTES],
const char *propq)
}
c448_error_t c448_ed448_derive_public_key(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const char *propq)
}
c448_error_t c448_ed448_sign(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
}
c448_error_t c448_ed448_sign_prehash(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t privkey[EDDSA_448_PRIVATE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
}
c448_error_t c448_ed448_verify(
- OPENSSL_CTX *ctx,
+ OSSL_LIB_CTX *ctx,
const uint8_t signature[EDDSA_448_SIGNATURE_BYTES],
const uint8_t pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t *message, size_t message_len,
}
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 pubkey[EDDSA_448_PUBLIC_BYTES],
const uint8_t hash[64], const uint8_t *context,
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],
const uint8_t private_key[57], const uint8_t *context,
size_t context_len, const char *propq)
== 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 *context, size_t context_len, const char *propq)
{
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 *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 *context, size_t context_len, const char *propq)
{
(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)
{
return c448_ed448_derive_public_key(ctx, out_public_key, private_key, propq)
}
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_GROUP *group = NULL;
int ptype, pklen;
EC_KEY *eckey = NULL;
X509_ALGOR *palg;
- OPENSSL_CTX *libctx = NULL;
+ OSSL_LIB_CTX *libctx = NULL;
const char *propq = NULL;
if (!X509_PUBKEY_get0_libctx(&libctx, &propq, pubkey)
}
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 void *pval;
static
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 EC_KEY *eckey = NULL;
}
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)
{
int ret = 0, curve_nid, encoding_flag;
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 ec_list_element curve)
{
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)
{
EC_GROUP *ret = NULL;
}
#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);
}
-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)
{
EC_KEY *ret = EC_KEY_new_ex(ctx, propq);
}
-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 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)
{
EC_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
/* 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)
{
EC_GROUP *ret;
* mathematically wrong anyway and should not be used.
*/
static EC_GROUP *ec_group_explicit_to_named(const EC_GROUP *group,
- OPENSSL_CTX *libctx,
+ OSSL_LIB_CTX *libctx,
const char *propq,
BN_CTX *ctx)
{
}
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;
const char *curve_name = NULL;
}
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;
int ok = 0;
EC_PRE_COMP *ec;
} pre_comp;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
};
CRYPTO_EX_DATA ex_data;
#endif
CRYPTO_RWLOCK *lock;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
char *propq;
/* Provider data */
* \param meth EC_METHOD to use
* \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);
#ifdef ECP_NISTZ256_ASM
#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);
int ossl_ec_key_gen(EC_KEY *eckey);
const unsigned char *Z, size_t Zlen,
const unsigned char *sinfo, size_t sinfolen,
const EVP_MD *md,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
int ret = 0;
EVP_KDF_CTX *kctx = NULL;
#include <openssl/err.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)
{
ECX_KEY *ret = OPENSSL_zalloc(sizeof(*ret));
/* Setup EVP_PKEY using public, private or generation */
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,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
ECX_KEY *key = NULL;
unsigned char *privkey, *pubkey;
}
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;
int plen;
}
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 ECX_KEY *key = from->pkey.ecx;
}
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
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);
}
-static const OPENSSL_CTX_METHOD decoder_store_method = {
+static const OSSL_LIB_CTX_METHOD decoder_store_method = {
decoder_store_new,
decoder_store_free,
};
/* Data to be passed through ossl_method_construct() */
struct decoder_data_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
OSSL_METHOD_CONSTRUCT_METHOD *mcm;
int id; /* For get_decoder_from_store() */
const char *names; /* For get_decoder_from_store() */
*/
/* 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);
}
}
/* 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,
- &decoder_store_method);
+ return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DECODER_STORE_INDEX,
+ &decoder_store_method);
}
/* 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)
{
struct decoder_data_st *methdata = data;
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,
int operation_id, const char *names,
const char *propdef, void *unused)
* namemap entry, this is it. Should the name already exist there, we
* 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);
const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
}
/* 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 *properties)
{
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)
{
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)
{
return inner_ossl_decoder_fetch(libctx, id, NULL, properties);
int OSSL_DECODER_is_a(const OSSL_DECODER *decoder, const char *name)
{
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);
return ossl_namemap_name2num(namemap, name) == decoder->base.id;
int no_store, void *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);
const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
}
}
-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 *arg)
{
return;
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_doall_names(namemap, decoder->base.id, fn, data);
int ossl_decoder_ctx_setup_for_EVP_PKEY(OSSL_DECODER_CTX *ctx,
EVP_PKEY **pkey, const char *keytype,
- OPENSSL_CTX *libctx,
+ OSSL_LIB_CTX *libctx,
const char *propquery)
{
struct collected_data_st *data = NULL;
OSSL_DECODER_CTX *
OSSL_DECODER_CTX_new_by_EVP_PKEY(EVP_PKEY **pkey,
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;
}
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;
}
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);
}
-static const OPENSSL_CTX_METHOD encoder_store_method = {
+static const OSSL_LIB_CTX_METHOD encoder_store_method = {
encoder_store_new,
encoder_store_free,
};
/* Data to be passed through ossl_method_construct() */
struct encoder_data_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
OSSL_METHOD_CONSTRUCT_METHOD *mcm;
int id; /* For get_encoder_from_store() */
const char *names; /* For get_encoder_from_store() */
*/
/* 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);
}
}
/* 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,
- &encoder_store_method);
+ return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_ENCODER_STORE_INDEX,
+ &encoder_store_method);
}
/* 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)
{
struct encoder_data_st *methdata = data;
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,
int operation_id, const char *names,
const char *propdef, void *unused)
* namemap entry, this is it. Should the name already exist there, we
* 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);
const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
}
/* 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,
const char *properties)
{
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)
{
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)
{
return inner_ossl_encoder_fetch(libctx, id, NULL, properties);
int OSSL_ENCODER_is_a(const OSSL_ENCODER *encoder, const char *name)
{
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);
return ossl_namemap_name2num(namemap, name) == encoder->base.id;
int no_store, void *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);
const char *names = algodef->algorithm_names;
int id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
}
}
-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 *arg)
{
return;
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_doall_names(namemap, encoder->base.id, fn, data);
static int ossl_encoder_ctx_setup_for_EVP_PKEY(OSSL_ENCODER_CTX *ctx,
const EVP_PKEY *pkey,
int selection,
- OPENSSL_CTX *libctx,
+ OSSL_LIB_CTX *libctx,
const char *propquery)
{
struct construct_data_st *data = NULL;
OSSL_ENCODER_CTX *OSSL_ENCODER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
const char *output_type,
int selection,
- OPENSSL_CTX *libctx,
+ OSSL_LIB_CTX *libctx,
const char *propquery)
{
OSSL_ENCODER_CTX *ctx = NULL;
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)
{
return evp_generic_fetch(ctx, OSSL_OP_ASYM_CIPHER, algorithm, properties,
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 *arg),
void *arg)
#ifndef FIPS_MODULE
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_PKEY_CTX *pctx = NULL;
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)
{
EVP_MD *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 *arg)
{
}
#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 OSSL_PROVIDER *prov;
#else
{
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);
if (kl <= 0 || RAND_priv_bytes_ex(libctx, key, kl) <= 0)
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)
{
EVP_CIPHER *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 *arg)
{
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);
}
-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_free,
};
/* Data to be passed through ossl_method_construct() */
struct evp_method_data_st {
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
OSSL_METHOD_CONSTRUCT_METHOD *mcm;
int operation_id; /* For get_evp_method_from_store() */
int name_id; /* For get_evp_method_from_store() */
/*
* 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);
}
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,
- &evp_method_store_method);
+ return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_EVP_METHOD_STORE_INDEX,
+ &evp_method_store_method);
}
/*
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)
{
struct evp_method_data_st *methdata = data;
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,
int operation_id, const char *names,
const char *propdef, void *data)
* number.
*/
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);
const char *names = algodef->algorithm_names;
int name_id = ossl_namemap_add_names(namemap, 0, names, NAME_SEPARATOR);
methdata->destruct_method(method);
}
-static const char *libctx_descriptor(OPENSSL_CTX *libctx)
+static const char *libctx_descriptor(OSSL_LIB_CTX *libctx)
{
#ifdef FIPS_MODULE
return "FIPS internal library context";
#else
- if (openssl_ctx_is_global_default(libctx))
+ if (ossl_lib_ctx_is_global_default(libctx))
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 "Non-default library context";
#endif
}
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,
const char *properties,
void *(*new_method)(int name_id,
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,
void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns,
* This is meant to be used when one method needs to fetch an associated
* 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,
void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns,
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_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,
int loadconfig)
{
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)
{
OSSL_PROPERTY_LIST *pl = NULL;
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);
}
-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 *pl1, *pl2;
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)
{
OSSL_PROPERTY_LIST **plp = ossl_ctx_global_properties(libctx, 1);
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");
}
-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";
int no_store, void *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);
int name_id = ossl_namemap_add_names(namemap, 0, algo->algorithm_names,
NAME_SEPARATOR);
}
}
-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_arg,
void *(*new_method)(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);
return ossl_namemap_num2name(namemap, name_id, 0);
/*
* 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);
if (prov == NULL)
void (*fn)(const char *name, 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_doall_names(namemap, number, fn, data);
#include <openssl/types.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,
void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov),
int (*up_ref_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,
void *(*new_method)(int name_id,
const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov),
int (*up_ref_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_arg,
void *(*new_method)(int name_id,
void (*free_method)(void *));
/* 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);
/* Internal structure constructors for fetched methods */
/* 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)
{
EVP_PKEY *pkey = NULL;
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)
{
return evp_generic_fetch(libctx, OSSL_OP_RAND, algorithm, properties,
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 *arg)
{
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)
{
return evp_generic_fetch(ctx, OSSL_OP_KEYEXCH, algorithm, properties,
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 *arg)
{
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)
{
return evp_generic_fetch(libctx, OSSL_OP_KDF, algorithm, properties,
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 *arg)
{
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)
{
return evp_generic_fetch(ctx, OSSL_OP_KEM, algorithm, properties,
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 *arg)
{
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)
{
return evp_generic_fetch_by_number(ctx,
(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)
{
return evp_generic_fetch(ctx, OSSL_OP_KEYMGMT, algorithm, properties,
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 *arg)
{
static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
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)
{
EVP_PKEY_CTX *locpctx = NULL;
}
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)
{
return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 0);
}
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)
{
return do_sigver_init(ctx, pctx, NULL, mdname, libctx, props, NULL, pkey, 1);
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)
{
return evp_generic_fetch(libctx, OSSL_OP_MAC, algorithm, properties,
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 *arg)
{
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;
OSSL_NAMEMAP *namemap;
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;
OSSL_NAMEMAP *namemap;
int pkcs5_pbkdf2_hmac_ex(const char *pass, int passlen,
const unsigned char *salt, int saltlen, int iter,
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 = "";
int rv = 1, mode = 1;
}
-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 *propq,
int nidtype,
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 *propq,
const unsigned char *priv, size_t len)
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 unsigned char *pub, size_t len)
{
static EVP_PKEY *new_cmac_key_int(const unsigned char *priv, size_t len,
const char *cipher_name,
- const EVP_CIPHER *cipher, OPENSSL_CTX *libctx,
+ const EVP_CIPHER *cipher,
+ OSSL_LIB_CTX *libctx,
const char *propq, ENGINE *e)
{
# ifndef OPENSSL_NO_CMAC
}
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)
{
return new_cmac_key_int(priv, len, cipher_name, NULL, libctx, propq, NULL);
}
} else {
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 =
pkey->keymgmt->query_operation_name != NULL
? pkey->keymgmt->query_operation_name(OSSL_OP_SIGNATURE)
static int print_pkey(const EVP_PKEY *pkey, BIO *out, int indent,
int selection /* For provided encoding */,
- OPENSSL_CTX *libctx /* For provided encoding */,
+ OSSL_LIB_CTX *libctx /* For provided encoding */,
const char *propquery /* For provided encoding */,
int (*legacy_print)(BIO *out, const EVP_PKEY *pkey,
int indent, ASN1_PCTX *pctx),
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,
const char *propquery)
{
* We perform the export in the same libctx as the keymgmt
* that we are using.
*/
- OPENSSL_CTX *libctx =
+ OSSL_LIB_CTX *libctx =
ossl_provider_library_context(keymgmt->prov);
EVP_PKEY_CTX *pctx =
EVP_PKEY_CTX_new_from_pkey(libctx, *dest, NULL);
#include "crypto/evp.h"
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)
{
unsigned char m[EVP_MAX_MD_SIZE];
#include "crypto/evp.h"
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)
{
unsigned char m[EVP_MAX_MD_SIZE];
if (maxmem == 0)
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);
kctx = EVP_KDF_CTX_new(kdf);
EVP_KDF_free(kdf);
}
#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,
const char *keytype, const char *propquery,
int id)
/*- 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 *propquery)
{
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)
{
return int_ctx_new(libctx, pkey, NULL, NULL, propquery, -1);
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 signature->prov;
}
-EVP_SIGNATURE *EVP_SIGNATURE_fetch(OPENSSL_CTX *ctx, const char *algorithm,
+EVP_SIGNATURE *EVP_SIGNATURE_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
const char *properties)
{
return evp_generic_fetch(ctx, OSSL_OP_SIGNATURE, algorithm, properties,
return signature->name_id;
}
-void EVP_SIGNATURE_do_all_provided(OPENSSL_CTX *libctx,
+void EVP_SIGNATURE_do_all_provided(OSSL_LIB_CTX *libctx,
void (*fn)(EVP_SIGNATURE *signature,
void *arg),
void *arg)
#include "crypto/cryptlib.h"
#include "internal/thread_once.h"
-int do_ex_data_init(OPENSSL_CTX *ctx)
+int do_ex_data_init(OSSL_LIB_CTX *ctx)
{
- OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
+ OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
if (global == NULL)
return 0;
* called under potential race-conditions anyway (it's for program shutdown
* after all).
*/
-void crypto_cleanup_all_ex_data_int(OPENSSL_CTX *ctx)
+void crypto_cleanup_all_ex_data_int(OSSL_LIB_CTX *ctx)
{
int i;
- OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
+ OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
if (global == NULL)
return;
return 1;
}
-int crypto_free_ex_index_ex(OPENSSL_CTX *ctx, int class_index, int idx)
+int crypto_free_ex_index_ex(OSSL_LIB_CTX *ctx, int class_index, int idx)
{
EX_CALLBACKS *ip;
EX_CALLBACK *a;
int toret = 0;
- OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
+ OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
if (global == NULL)
return 0;
/*
* Register a new index.
*/
-int crypto_get_ex_new_index_ex(OPENSSL_CTX *ctx, int class_index, long argl,
+int crypto_get_ex_new_index_ex(OSSL_LIB_CTX *ctx, int class_index, long argl,
void *argp, CRYPTO_EX_new *new_func,
CRYPTO_EX_dup *dup_func,
CRYPTO_EX_free *free_func)
int toret = -1;
EX_CALLBACK *a;
EX_CALLBACKS *ip;
- OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
+ OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
if (global == NULL)
return -1;
* in the lock, then using them outside the lock. Note this only applies
* to the global "ex_data" state (ie. class definitions), not 'ad' itself.
*/
-int crypto_new_ex_data_ex(OPENSSL_CTX *ctx, int class_index, void *obj,
+int crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj,
CRYPTO_EX_DATA *ad)
{
int mx, i;
EX_CALLBACK **storage = NULL;
EX_CALLBACK *stack[10];
EX_CALLBACKS *ip;
- OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ctx);
+ OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ctx);
if (global == NULL)
return 0;
/* Nothing to copy over */
return 1;
- global = openssl_ctx_get_ex_data_global(from->ctx);
+ global = ossl_lib_ctx_get_ex_data_global(from->ctx);
if (global == NULL)
return 0;
EX_CALLBACK *f;
EX_CALLBACK *stack[10];
EX_CALLBACK **storage = NULL;
- OSSL_EX_DATA_GLOBAL *global = openssl_ctx_get_ex_data_global(ad->ctx);
+ OSSL_EX_DATA_GLOBAL *global = ossl_lib_ctx_get_ex_data_global(ad->ctx);
if (global == NULL)
goto err;
if (curval != NULL)
return 1;
- global = openssl_ctx_get_ex_data_global(ad->ctx);
+ global = ossl_lib_ctx_get_ex_data_global(ad->ctx);
if (global == NULL)
return 0;
return sk_void_value(ad->sk, idx);
}
-OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad)
+OSSL_LIB_CTX *crypto_ex_data_get_ossl_lib_ctx(const CRYPTO_EX_DATA *ad)
{
return ad->ctx;
}
unsigned char md[EVP_MAX_MD_SIZE];
int mdsize = EVP_MD_size(evpmd);
unsigned char *pmd;
- OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx);
+ OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
/* find q */
for (;;) {
unsigned char buf2[EVP_MAX_MD_SIZE];
unsigned char md[EVP_MAX_MD_SIZE];
int i, r, ret = 0, m = *retm;
- OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx);
+ OSSL_LIB_CTX *libctx = bn_get_lib_ctx(ctx);
/* find q */
for (;;) {
* - FFC_PARAM_RET_STATUS_UNVERIFIABLE_G if the validation of G succeeded,
* but G is unverifiable.
*/
-int ossl_ffc_params_FIPS186_4_gen_verify(OPENSSL_CTX *libctx,
+int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx,
FFC_PARAMS *params, int mode, int type,
size_t L, size_t N, int *res,
BN_GENCB *cb)
}
/* Note this function is only used for verification in fips mode */
-int ossl_ffc_params_FIPS186_2_gen_verify(OPENSSL_CTX *libctx,
+int ossl_ffc_params_FIPS186_2_gen_verify(OSSL_LIB_CTX *libctx,
FFC_PARAMS *params, int mode, int type,
size_t L, size_t N, int *res,
BN_GENCB *cb)
return ok;
}
-int ossl_ffc_params_FIPS186_4_generate(OPENSSL_CTX *libctx, FFC_PARAMS *params,
+int ossl_ffc_params_FIPS186_4_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
int type, size_t L, size_t N,
int *res, BN_GENCB *cb)
{
}
/* This should no longer be used in FIPS mode */
-int ossl_ffc_params_FIPS186_2_generate(OPENSSL_CTX *libctx, FFC_PARAMS *params,
+int ossl_ffc_params_FIPS186_2_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
int type, size_t L, size_t N,
int *res, BN_GENCB *cb)
{
return 1;
}
-int ossl_ffc_params_FIPS186_4_validate(OPENSSL_CTX *libctx,
+int ossl_ffc_params_FIPS186_4_validate(OSSL_LIB_CTX *libctx,
const FFC_PARAMS *params, int type,
int *res, BN_GENCB *cb)
{
}
/* This may be used in FIPS mode to validate deprecated FIPS-186-2 Params */
-int ossl_ffc_params_FIPS186_2_validate(OPENSSL_CTX *libctx,
+int ossl_ffc_params_FIPS186_2_validate(OSSL_LIB_CTX *libctx,
const FFC_PARAMS *params, int type,
int *res, BN_GENCB *cb)
{
* extra parameters such as the digest and seed, which may not be available for
* this test.
*/
-int ossl_ffc_params_simple_validate(OPENSSL_CTX *libctx, FFC_PARAMS *params,
+int ossl_ffc_params_simple_validate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
int type)
{
int ret, res = 0;
/*
* TODO(3.0): This function needs looking at with a view to moving most/all
- * of this into onfree handlers in OPENSSL_CTX.
+ * of this into onfree handlers in OSSL_LIB_CTX.
*/
/* If we've not been inited then no need to deinit */
* - rand_cleanup_int could call an ENGINE's RAND cleanup function so
* must be called before engine_cleanup_int()
* - ENGINEs use CRYPTO_EX_DATA and therefore, must be cleaned up
- * before the ex data handlers are wiped during default openssl_ctx deinit.
+ * before the ex data handlers are wiped during default ossl_lib_ctx deinit.
* - conf_modules_free_int() can end up in ENGINE code so must be called
* before engine_cleanup_int()
* - ENGINEs and additional EVP algorithms might use added OIDs names so
ossl_store_cleanup_int();
#endif
- OSSL_TRACE(INIT, "OPENSSL_cleanup: openssl_ctx_default_deinit()\n");
- openssl_ctx_default_deinit();
+ OSSL_TRACE(INIT, "OPENSSL_cleanup: ossl_lib_ctx_default_deinit()\n");
+ ossl_lib_ctx_default_deinit();
ossl_cleanup_thread();
{
/*
* TODO(3.0): This function needs looking at with a view to moving most/all
- * of this into OPENSSL_CTX.
+ * of this into OSSL_LIB_CTX.
*/
if (stopped) {
destructor_key.sane = -1;
}
-void OPENSSL_thread_stop_ex(OPENSSL_CTX *ctx)
+void OPENSSL_thread_stop_ex(OSSL_LIB_CTX *ctx)
{
- ctx = openssl_ctx_get_concrete(ctx);
+ ctx = ossl_lib_ctx_get_concrete(ctx);
/*
* TODO(3.0). It would be nice if we could figure out a way to do this on
- * all threads that have used the OPENSSL_CTX when the OPENSSL_CTX is freed.
+ * all threads that have used the OSSL_LIB_CTX when the context is freed.
* This is currently not possible due to the use of thread local variables.
*/
ossl_ctx_thread_stop(ctx);
#else
-static void *thread_event_ossl_ctx_new(OPENSSL_CTX *libctx)
+static void *thread_event_ossl_ctx_new(OSSL_LIB_CTX *libctx)
{
THREAD_EVENT_HANDLER **hands = NULL;
CRYPTO_THREAD_LOCAL *tlocal = OPENSSL_zalloc(sizeof(*tlocal));
OPENSSL_free(tlocal);
}
-static const OPENSSL_CTX_METHOD thread_event_ossl_ctx_method = {
+static const OSSL_LIB_CTX_METHOD thread_event_ossl_ctx_method = {
thread_event_ossl_ctx_new,
thread_event_ossl_ctx_free,
};
void ossl_ctx_thread_stop(void *arg)
{
THREAD_EVENT_HANDLER **hands;
- OPENSSL_CTX *ctx = arg;
+ OSSL_LIB_CTX *ctx = arg;
CRYPTO_THREAD_LOCAL *local
- = openssl_ctx_get_data(ctx, OPENSSL_CTX_THREAD_EVENT_HANDLER_INDEX,
- &thread_event_ossl_ctx_method);
+ = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX,
+ &thread_event_ossl_ctx_method);
if (local == NULL)
return;
THREAD_EVENT_HANDLER **hands;
THREAD_EVENT_HANDLER *hand;
#ifdef FIPS_MODULE
- OPENSSL_CTX *ctx = arg;
+ OSSL_LIB_CTX *ctx = arg;
/*
* In FIPS mode the list of THREAD_EVENT_HANDLERs is unique per combination
- * of OPENSSL_CTX and thread. This is because in FIPS mode each OPENSSL_CTX
- * gets informed about thread stop events individually.
+ * of OSSL_LIB_CTX and thread. This is because in FIPS mode each
+ * OSSL_LIB_CTX gets informed about thread stop events individually.
*/
CRYPTO_THREAD_LOCAL *local
- = openssl_ctx_get_data(ctx, OPENSSL_CTX_THREAD_EVENT_HANDLER_INDEX,
- &thread_event_ossl_ctx_method);
+ = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_THREAD_EVENT_HANDLER_INDEX,
+ &thread_event_ossl_ctx_method);
#else
/*
* Outside of FIPS mode the list of THREAD_EVENT_HANDLERs is unique per
- * thread, but may hold multiple OPENSSL_CTXs. We only get told about
+ * thread, but may hold multiple OSSL_LIB_CTXs. We only get told about
* thread stop events globally, so we have to ensure all affected
- * OPENSSL_CTXs are informed.
+ * OSSL_LIB_CTXs are informed.
*/
CRYPTO_THREAD_LOCAL *local = &destructor_key.value;
#endif
*/
SIV128_CONTEXT *CRYPTO_siv128_new(const unsigned char *key, int klen,
EVP_CIPHER *cbc, EVP_CIPHER *ctr,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
SIV128_CONTEXT *ctx;
int ret;
*/
int CRYPTO_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen,
const EVP_CIPHER *cbc, const EVP_CIPHER *ctr,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
static const unsigned char zero[SIV_LEN] = { 0 };
size_t out_len = SIV_LEN;
}
int OCSP_RESPID_set_by_key_ex(OCSP_RESPID *respid, X509 *cert,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
ASN1_OCTET_STRING *byKey = NULL;
unsigned char md[SHA_DIGEST_LENGTH];
return OCSP_RESPID_set_by_key_ex(respid, cert, NULL, NULL);
}
-int OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OPENSSL_CTX *libctx,
+int OCSP_RESPID_match_ex(OCSP_RESPID *respid, X509 *cert, OSSL_LIB_CTX *libctx,
const char *propq)
{
EVP_MD *sha1 = NULL;
#ifndef OPENSSL_NO_STDIO
STACK_OF(X509_INFO)
*PEM_X509_INFO_read_ex(FILE *fp, STACK_OF(X509_INFO) *sk, pem_password_cb *cb,
- void *u, OPENSSL_CTX *libctx, const char *propq)
+ void *u, OSSL_LIB_CTX *libctx, const char *propq)
{
BIO *b;
STACK_OF(X509_INFO) *ret;
STACK_OF(X509_INFO)
*PEM_X509_INFO_read_bio_ex(BIO *bp, STACK_OF(X509_INFO) *sk,
- pem_password_cb *cb, void *u, OPENSSL_CTX *libctx,
+ pem_password_cb *cb, void *u, OSSL_LIB_CTX *libctx,
const char *propq)
{
X509_INFO *xi = NULL;
int nid, const EVP_CIPHER *enc,
const char *kstr, int klen,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq);
+ OSSL_LIB_CTX *libctx, const char *propq);
#ifndef OPENSSL_NO_STDIO
static int do_pk8pkey_fp(FILE *bp, const EVP_PKEY *x, int isder,
int nid, const EVP_CIPHER *enc,
const char *kstr, int klen,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq);
+ OSSL_LIB_CTX *libctx, const char *propq);
#endif
/*
* These functions write a private key in PKCS#8 format: it is a "drop in"
static int do_pk8pkey(BIO *bp, const EVP_PKEY *x, int isder, int nid,
const EVP_CIPHER *enc, const char *kstr, int klen,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
int ret = 0;
const char *outtype = isder ? "DER" : "PEM";
static int do_pk8pkey_fp(FILE *fp, const EVP_PKEY *x, int isder, int nid,
const EVP_CIPHER *enc, const char *kstr, int klen,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
BIO *bp;
int ret;
static EVP_PKEY *pem_read_bio_key(BIO *bp, EVP_PKEY **x,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq,
+ OSSL_LIB_CTX *libctx, const char *propq,
int expected_store_info_type,
int try_secure)
{
EVP_PKEY *PEM_read_bio_PUBKEY_ex(BIO *bp, EVP_PKEY **x,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
return pem_read_bio_key(bp, x, cb, u, libctx, propq,
OSSL_STORE_INFO_PUBKEY, 0);
#ifndef OPENSSL_NO_STDIO
EVP_PKEY *PEM_read_PUBKEY_ex(FILE *fp, EVP_PKEY **x,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
BIO *b;
EVP_PKEY *ret;
EVP_PKEY *PEM_read_bio_PrivateKey_ex(BIO *bp, EVP_PKEY **x,
pem_password_cb *cb, void *u,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
return pem_read_bio_key(bp, x, cb, u, libctx, propq,
OSSL_STORE_INFO_PKEY, 1);
}
EVP_PKEY *PEM_read_bio_Parameters_ex(BIO *bp, EVP_PKEY **x,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
return pem_read_bio_key(bp, x, NULL, NULL, libctx, propq,
OSSL_STORE_INFO_PARAMS, 0);
#ifndef OPENSSL_NO_STDIO
EVP_PKEY *PEM_read_PrivateKey_ex(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
- void *u, OPENSSL_CTX *libctx,
+ void *u, OSSL_LIB_CTX *libctx,
const char *propq)
{
BIO *b;
return (PKCS7 *)ASN1_item_new(ASN1_ITEM_rptr(PKCS7));
}
-PKCS7 *PKCS7_new_ex(OPENSSL_CTX *libctx, const char *propq)
+PKCS7 *PKCS7_new_ex(OSSL_LIB_CTX *libctx, const char *propq)
{
PKCS7 *pkcs7 = PKCS7_new();
return p7 != NULL ? &p7->ctx : NULL;
}
-OPENSSL_CTX *pkcs7_ctx_get0_libctx(const PKCS7_CTX *ctx)
+OSSL_LIB_CTX *pkcs7_ctx_get0_libctx(const PKCS7_CTX *ctx)
{
return ctx != NULL ? ctx->libctx : NULL;
}
#include "crypto/pkcs7.h"
const PKCS7_CTX *pkcs7_get0_ctx(const PKCS7 *p7);
-OPENSSL_CTX *pkcs7_ctx_get0_libctx(const PKCS7_CTX *ctx);
+OSSL_LIB_CTX *pkcs7_ctx_get0_libctx(const PKCS7_CTX *ctx);
const char *pkcs7_ctx_get0_propq(const PKCS7_CTX *ctx);
static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
PKCS7 *PKCS7_sign_ex(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
- BIO *data, int flags, OPENSSL_CTX *libctx,
+ BIO *data, int flags, OSSL_LIB_CTX *libctx,
const char *propq)
{
PKCS7 *p7;
PKCS7 *PKCS7_encrypt_ex(STACK_OF(X509) *certs, BIO *in,
const EVP_CIPHER *cipher, int flags,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
PKCS7 *p7;
BIO *p7bio = NULL;
}
}
-static void *property_defns_new(OPENSSL_CTX *ctx) {
+static void *property_defns_new(OSSL_LIB_CTX *ctx) {
return lh_PROPERTY_DEFN_ELEM_new(&property_defn_hash, &property_defn_cmp);
}
-static const OPENSSL_CTX_METHOD property_defns_method = {
+static const OSSL_LIB_CTX_METHOD property_defns_method = {
property_defns_new,
property_defns_free,
};
-OSSL_PROPERTY_LIST *ossl_prop_defn_get(OPENSSL_CTX *ctx, const char *prop)
+OSSL_PROPERTY_LIST *ossl_prop_defn_get(OSSL_LIB_CTX *ctx, const char *prop)
{
PROPERTY_DEFN_ELEM elem, *r;
LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
- property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX,
- &property_defns_method);
+ property_defns = ossl_lib_ctx_get_data(ctx,
+ OSSL_LIB_CTX_PROPERTY_DEFN_INDEX,
+ &property_defns_method);
if (property_defns == NULL)
return NULL;
return r != NULL ? r->defn : NULL;
}
-int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
+int ossl_prop_defn_set(OSSL_LIB_CTX *ctx, const char *prop,
OSSL_PROPERTY_LIST *pl)
{
PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
size_t len;
LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
- property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX,
- &property_defns_method);
+ property_defns = ossl_lib_ctx_get_data(ctx,
+ OSSL_LIB_CTX_PROPERTY_DEFN_INDEX,
+ &property_defns_method);
if (property_defns == NULL)
return 0;
} ALGORITHM;
struct ossl_method_store_st {
- OPENSSL_CTX *ctx;
+ OSSL_LIB_CTX *ctx;
size_t nelem;
SPARSE_ARRAY_OF(ALGORITHM) *algs;
int need_flush;
}
}
-static void *ossl_ctx_global_properties_new(OPENSSL_CTX *ctx)
+static void *ossl_ctx_global_properties_new(OSSL_LIB_CTX *ctx)
{
return OPENSSL_zalloc(sizeof(OSSL_PROPERTY_LIST **));
}
-static const OPENSSL_CTX_METHOD ossl_ctx_global_properties_method = {
+static const OSSL_LIB_CTX_METHOD ossl_ctx_global_properties_method = {
ossl_ctx_global_properties_new,
ossl_ctx_global_properties_free,
};
-OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OPENSSL_CTX *libctx,
+OSSL_PROPERTY_LIST **ossl_ctx_global_properties(OSSL_LIB_CTX *libctx,
int loadconfig)
{
#ifndef FIPS_MODULE
if (loadconfig && !OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, NULL))
return NULL;
#endif
- return openssl_ctx_get_data(libctx, OPENSSL_CTX_GLOBAL_PROPERTIES,
- &ossl_ctx_global_properties_method);
+ return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_GLOBAL_PROPERTIES,
+ &ossl_ctx_global_properties_method);
}
static int ossl_method_up_ref(METHOD *method)
}
/*
- * The OPENSSL_CTX param here allows access to underlying property data needed
+ * The OSSL_LIB_CTX param here allows access to underlying property data needed
* for computation
*/
-OSSL_METHOD_STORE *ossl_method_store_new(OPENSSL_CTX *ctx)
+OSSL_METHOD_STORE *ossl_method_store_new(OSSL_LIB_CTX *ctx)
{
OSSL_METHOD_STORE *res;
typedef int OSSL_PROPERTY_IDX;
/* Property string functions */
-OSSL_PROPERTY_IDX ossl_property_name(OPENSSL_CTX *ctx, const char *s,
+OSSL_PROPERTY_IDX ossl_property_name(OSSL_LIB_CTX *ctx, const char *s,
int create);
-OSSL_PROPERTY_IDX ossl_property_value(OPENSSL_CTX *ctx, const char *s,
+OSSL_PROPERTY_IDX ossl_property_value(OSSL_LIB_CTX *ctx, const char *s,
int create);
/* Property list functions */
int ossl_property_has_optional(const OSSL_PROPERTY_LIST *query);
/* Property definition cache functions */
-OSSL_PROPERTY_LIST *ossl_prop_defn_get(OPENSSL_CTX *ctx, const char *prop);
-int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
+OSSL_PROPERTY_LIST *ossl_prop_defn_get(OSSL_LIB_CTX *ctx, const char *prop);
+int ossl_prop_defn_set(OSSL_LIB_CTX *ctx, const char *prop,
OSSL_PROPERTY_LIST *pl);
/* Property cache lock / unlock */
return 0;
}
-static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
+static int parse_name(OSSL_LIB_CTX *ctx, const char *t[], int create,
OSSL_PROPERTY_IDX *idx)
{
char name[100];
return 1;
}
-static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
+static int parse_string(OSSL_LIB_CTX *ctx, const char *t[], char delim,
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
return !err;
}
-static int parse_unquoted(OPENSSL_CTX *ctx, const char *t[],
+static int parse_unquoted(OSSL_LIB_CTX *ctx, const char *t[],
PROPERTY_DEFINITION *res, const int create)
{
char v[1000];
return !err;
}
-static int parse_value(OPENSSL_CTX *ctx, const char *t[],
+static int parse_value(OSSL_LIB_CTX *ctx, const char *t[],
PROPERTY_DEFINITION *res, int create)
{
const char *s = *t;
return r;
}
-OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn)
+OSSL_PROPERTY_LIST *ossl_parse_property(OSSL_LIB_CTX *ctx, const char *defn)
{
PROPERTY_DEFINITION *prop = NULL;
OSSL_PROPERTY_LIST *res = NULL;
return res;
}
-OSSL_PROPERTY_LIST *ossl_parse_query(OPENSSL_CTX *ctx, const char *s)
+OSSL_PROPERTY_LIST *ossl_parse_query(OSSL_LIB_CTX *ctx, const char *s)
{
STACK_OF(PROPERTY_DEFINITION) *sk;
OSSL_PROPERTY_LIST *res = NULL;
return query->has_optional ? 1 : 0;
}
-int ossl_property_is_enabled(OPENSSL_CTX *ctx, const char *property_name,
+int ossl_property_is_enabled(OSSL_LIB_CTX *ctx, const char *property_name,
const OSSL_PROPERTY_LIST *prop_list)
{
int i;
return r;
}
-int ossl_property_parse_init(OPENSSL_CTX *ctx)
+int ossl_property_parse_init(OSSL_LIB_CTX *ctx)
{
static const char *const predefined_names[] = {
"provider", /* Name of provider (default, legacy, fips) */
OPENSSL_free(propdata);
}
-static void *property_string_data_new(OPENSSL_CTX *ctx) {
+static void *property_string_data_new(OSSL_LIB_CTX *ctx) {
PROPERTY_STRING_DATA *propdata = OPENSSL_zalloc(sizeof(*propdata));
if (propdata == NULL)
return NULL;
}
-static const OPENSSL_CTX_METHOD property_string_data_method = {
+static const OSSL_LIB_CTX_METHOD property_string_data_method = {
property_string_data_new,
property_string_data_free,
};
return ps != NULL ? ps->idx : 0;
}
-OSSL_PROPERTY_IDX ossl_property_name(OPENSSL_CTX *ctx, const char *s,
+OSSL_PROPERTY_IDX ossl_property_name(OSSL_LIB_CTX *ctx, const char *s,
int create)
{
PROPERTY_STRING_DATA *propdata
- = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_STRING_INDEX,
- &property_string_data_method);
+ = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_PROPERTY_STRING_INDEX,
+ &property_string_data_method);
if (propdata == NULL)
return 0;
s);
}
-OSSL_PROPERTY_IDX ossl_property_value(OPENSSL_CTX *ctx, const char *s,
+OSSL_PROPERTY_IDX ossl_property_value(OSSL_LIB_CTX *ctx, const char *s,
int create)
{
PROPERTY_STRING_DATA *propdata
- = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_STRING_INDEX,
- &property_string_data_method);
+ = ossl_lib_ctx_get_data(ctx, OSSL_LIB_CTX_PROPERTY_STRING_INDEX,
+ &property_string_data_method);
if (propdata == NULL)
return 0;
#include <openssl/core_names.h>
#include "internal/provider.h"
-OSSL_PROVIDER *OSSL_PROVIDER_try_load(OPENSSL_CTX *libctx, const char *name)
+OSSL_PROVIDER *OSSL_PROVIDER_try_load(OSSL_LIB_CTX *libctx, const char *name)
{
OSSL_PROVIDER *prov = NULL;
return prov;
}
-OSSL_PROVIDER *OSSL_PROVIDER_load(OPENSSL_CTX *libctx, const char *name)
+OSSL_PROVIDER *OSSL_PROVIDER_load(OSSL_LIB_CTX *libctx, const char *name)
{
/* Any attempt to load a provider disables auto-loading of defaults */
if (ossl_provider_disable_fallback_loading(libctx))
return 1;
}
-int OSSL_PROVIDER_available(OPENSSL_CTX *libctx, const char *name)
+int OSSL_PROVIDER_available(OSSL_LIB_CTX *libctx, const char *name)
{
OSSL_PROVIDER *prov = NULL;
int available = 0;
return ossl_provider_get_capabilities(prov, capability, cb, arg);
}
-int OSSL_PROVIDER_add_builtin(OPENSSL_CTX *libctx, const char *name,
+int OSSL_PROVIDER_add_builtin(OSSL_LIB_CTX *libctx, const char *name,
OSSL_provider_init_fn *init_fn)
{
OSSL_PROVIDER *prov = NULL;
return ossl_provider_name(prov);
}
-int OSSL_PROVIDER_do_all(OPENSSL_CTX *ctx,
+int OSSL_PROVIDER_do_all(OSSL_LIB_CTX *ctx,
int (*cb)(OSSL_PROVIDER *provider,
void *cbdata),
void *cbdata)
return ok;
}
-static int provider_conf_load(OPENSSL_CTX *libctx, const char *name,
+static int provider_conf_load(OSSL_LIB_CTX *libctx, const char *name,
const char *value, const CONF *cnf)
{
int i;
DSO *module;
OSSL_provider_init_fn *init_function;
STACK_OF(INFOPAIR) *parameters;
- OPENSSL_CTX *libctx; /* The library context this instance is in */
+ OSSL_LIB_CTX *libctx; /* The library context this instance is in */
struct provider_store_st *store; /* The store this instance belongs to */
#ifndef FIPS_MODULE
/*
OPENSSL_free(store);
}
-static void *provider_store_new(OPENSSL_CTX *ctx)
+static void *provider_store_new(OSSL_LIB_CTX *ctx)
{
struct provider_store_st *store = OPENSSL_zalloc(sizeof(*store));
const struct predefined_providers_st *p = NULL;
return store;
}
-static const OPENSSL_CTX_METHOD provider_store_method = {
+static const OSSL_LIB_CTX_METHOD provider_store_method = {
provider_store_new,
provider_store_free,
};
-static struct provider_store_st *get_provider_store(OPENSSL_CTX *libctx)
+static struct provider_store_st *get_provider_store(OSSL_LIB_CTX *libctx)
{
struct provider_store_st *store = NULL;
- store = openssl_ctx_get_data(libctx, OPENSSL_CTX_PROVIDER_STORE_INDEX,
- &provider_store_method);
+ store = ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_PROVIDER_STORE_INDEX,
+ &provider_store_method);
if (store == NULL)
CRYPTOerr(CRYPTO_F_GET_PROVIDER_STORE, ERR_R_INTERNAL_ERROR);
return store;
}
-int ossl_provider_disable_fallback_loading(OPENSSL_CTX *libctx)
+int ossl_provider_disable_fallback_loading(OSSL_LIB_CTX *libctx)
{
struct provider_store_st *store;
return 0;
}
-OSSL_PROVIDER *ossl_provider_find(OPENSSL_CTX *libctx, const char *name,
+OSSL_PROVIDER *ossl_provider_find(OSSL_LIB_CTX *libctx, const char *name,
int noconfig)
{
struct provider_store_st *store = NULL;
return ref;
}
-OSSL_PROVIDER *ossl_provider_new(OPENSSL_CTX *libctx, const char *name,
+OSSL_PROVIDER *ossl_provider_new(OSSL_LIB_CTX *libctx, const char *name,
OSSL_provider_init_fn *init_function,
int noconfig)
{
*/
static const OSSL_DISPATCH *core_dispatch; /* Define further down */
-int OSSL_PROVIDER_set_default_search_path(OPENSSL_CTX *libctx, const char *path)
+int OSSL_PROVIDER_set_default_search_path(OSSL_LIB_CTX *libctx,
+ const char *path)
{
struct provider_store_st *store;
char *p = NULL;
}
}
-int ossl_provider_forall_loaded(OPENSSL_CTX *ctx,
+int ossl_provider_forall_loaded(OSSL_LIB_CTX *ctx,
int (*cb)(OSSL_PROVIDER *provider,
void *cbdata),
void *cbdata)
return NULL;
}
-OPENSSL_CTX *ossl_provider_library_context(const OSSL_PROVIDER *prov)
+OSSL_LIB_CTX *ossl_provider_library_context(const OSSL_PROVIDER *prov)
{
/* TODO(3.0) just: return prov->libctx; */
return prov != NULL ? prov->libctx : NULL;
* the default method, then just call RAND_bytes(). Otherwise make
* sure we're instantiated and use the private DRBG.
*/
-int RAND_priv_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
+int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num)
{
EVP_RAND_CTX *rand;
const RAND_METHOD *meth = RAND_get_rand_method();
return RAND_priv_bytes_ex(NULL, buf, num);
}
-int RAND_bytes_ex(OPENSSL_CTX *ctx, unsigned char *buf, int num)
+int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num)
{
EVP_RAND_CTX *rand;
const RAND_METHOD *meth = RAND_get_rand_method();
} RAND_GLOBAL;
/*
- * Initialize the OPENSSL_CTX global DRBGs on first use.
+ * Initialize the OSSL_LIB_CTX global DRBGs on first use.
* Returns the allocated global data on success or NULL on failure.
*/
-static void *rand_ossl_ctx_new(OPENSSL_CTX *libctx)
+static void *rand_ossl_ctx_new(OSSL_LIB_CTX *libctx)
{
RAND_GLOBAL *dgbl = OPENSSL_zalloc(sizeof(*dgbl));
OPENSSL_free(dgbl);
}
-static const OPENSSL_CTX_METHOD rand_drbg_ossl_ctx_method = {
+static const OSSL_LIB_CTX_METHOD rand_drbg_ossl_ctx_method = {
rand_ossl_ctx_new,
rand_ossl_ctx_free,
};
-static RAND_GLOBAL *rand_get_global(OPENSSL_CTX *libctx)
+static RAND_GLOBAL *rand_get_global(OSSL_LIB_CTX *libctx)
{
- return openssl_ctx_get_data(libctx, OPENSSL_CTX_DRBG_INDEX,
- &rand_drbg_ossl_ctx_method);
+ return ossl_lib_ctx_get_data(libctx, OSSL_LIB_CTX_DRBG_INDEX,
+ &rand_drbg_ossl_ctx_method);
}
static void rand_delete_thread_state(void *arg)
{
- OPENSSL_CTX *ctx = arg;
+ OSSL_LIB_CTX *ctx = arg;
RAND_GLOBAL *dgbl = rand_get_global(ctx);
EVP_RAND_CTX *rand;
EVP_RAND_CTX_free(rand);
}
-static EVP_RAND_CTX *rand_new_drbg(OPENSSL_CTX *libctx, EVP_RAND_CTX *parent,
+static EVP_RAND_CTX *rand_new_drbg(OSSL_LIB_CTX *libctx, EVP_RAND_CTX *parent,
unsigned int reseed_interval,
time_t reseed_time_interval)
{
* Returns pointer to its EVP_RAND_CTX on success, NULL on failure.
*
*/
-EVP_RAND_CTX *RAND_get0_primary(OPENSSL_CTX *ctx)
+EVP_RAND_CTX *RAND_get0_primary(OSSL_LIB_CTX *ctx)
{
RAND_GLOBAL *dgbl = rand_get_global(ctx);
* Get the public random generator.
* Returns pointer to its EVP_RAND_CTX on success, NULL on failure.
*/
-EVP_RAND_CTX *RAND_get0_public(OPENSSL_CTX *ctx)
+EVP_RAND_CTX *RAND_get0_public(OSSL_LIB_CTX *ctx)
{
RAND_GLOBAL *dgbl = rand_get_global(ctx);
EVP_RAND_CTX *rand, *primary;
if (primary == NULL)
return NULL;
- ctx = openssl_ctx_get_concrete(ctx);
+ ctx = ossl_lib_ctx_get_concrete(ctx);
/*
* If the private is also NULL then this is the first time we've
* used this thread.
* Get the private random generator.
* Returns pointer to its EVP_RAND_CTX on success, NULL on failure.
*/
-EVP_RAND_CTX *RAND_get0_private(OPENSSL_CTX *ctx)
+EVP_RAND_CTX *RAND_get0_private(OSSL_LIB_CTX *ctx)
{
RAND_GLOBAL *dgbl = rand_get_global(ctx);
EVP_RAND_CTX *rand, *primary;
if (primary == NULL)
return NULL;
- ctx = openssl_ctx_get_concrete(ctx);
+ ctx = ossl_lib_ctx_get_concrete(ctx);
/*
* If the public is also NULL then this is the first time we've
* used this thread.
*/
static int rsa_int_export_to(const EVP_PKEY *from, int rsa_type,
void *to_keydata, EVP_KEYMGMT *to_keymgmt,
- OPENSSL_CTX *libctx, const char *propq)
+ OSSL_LIB_CTX *libctx, const char *propq)
{
RSA *rsa = from->pkey.rsa;
OSSL_PARAM_BLD *tmpl = OSSL_PARAM_BLD_new();
}
static int rsa_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)
{
return rsa_int_export_to(from, RSA_FLAG_TYPE_RSA, to_keydata,
}
static int rsa_pss_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)
{
return rsa_int_export_to(from, RSA_FLAG_TYPE_RSASSAPSS, to_keydata,
int ossl_rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params,
const OSSL_PARAM params[],
- OPENSSL_CTX *libctx)
+ OSSL_LIB_CTX *libctx)
{
const OSSL_PARAM *param_md, *param_mgf, *param_mgf1md, *param_saltlen;
const OSSL_PARAM *param_propq;
#include "rsa_local.h"
static int rsa_keygen_pairwise_test(RSA *rsa, OSSL_CALLBACK *cb, void *cbarg);
-static int rsa_keygen(OPENSSL_CTX *libctx, RSA *rsa, int bits, int primes,
+static int rsa_keygen(OSSL_LIB_CTX *libctx, RSA *rsa, int bits, int primes,
BIGNUM *e_value, BN_GENCB *cb, int pairwise_test);
/*
}
#endif /* FIPS_MODULE */
-static int rsa_keygen(OPENSSL_CTX *libctx, RSA *rsa, int bits, int primes,
+static int rsa_keygen(OSSL_LIB_CTX *libctx, RSA *rsa, int bits, int primes,
BIGNUM *e_value, BN_GENCB *cb, int pairwise_test)
{
int ok = 0;
#include "crypto/security_bits.h"
#include "rsa_local.h"
-static RSA *rsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx);
+static RSA *rsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx);
#ifndef FIPS_MODULE
RSA *RSA_new(void)
}
#endif
-RSA *ossl_rsa_new_with_ctx(OPENSSL_CTX *libctx)
+RSA *ossl_rsa_new_with_ctx(OSSL_LIB_CTX *libctx)
{
return rsa_new_intern(NULL, libctx);
}
-static RSA *rsa_new_intern(ENGINE *engine, OPENSSL_CTX *libctx)
+static RSA *rsa_new_intern(ENGINE *engine, OSSL_LIB_CTX *libctx)
{
RSA *ret = OPENSSL_zalloc(sizeof(*ret));
return i > 1 ? 1 : 0;
}
-OPENSSL_CTX *ossl_rsa_get0_libctx(RSA *r)
+OSSL_LIB_CTX *ossl_rsa_get0_libctx(RSA *r)
{
return r->libctx;
}
*/
int dummy_zero;
- OPENSSL_CTX *libctx;
+ OSSL_LIB_CTX *libctx;
int32_t version;
const RSA_METHOD *meth;
/* functional reference if 'meth' is ENGINE-provided */
int nbits, const BIGNUM *e, BN_CTX *ctx,
BN_GENCB *cb);
-int ossl_rsa_padding_add_SSLv23_ex(OPENSSL_CTX *libctx, unsigned char *to,
+int ossl_rsa_padding_add_SSLv23_ex(OSSL_LIB_CTX *libctx, unsigned char *to,
int tlen, const unsigned char *from,
int flen);
-int ossl_rsa_padding_add_PKCS1_type_2_ex(OPENSSL_CTX *libctx, unsigned char *to,
+int ossl_rsa_padding_add_PKCS1_type_2_ex(OSSL_LIB_CTX *libctx, unsigned char *to,
int tlen, const unsigned char *from,
int flen);
* Step numbers are included here but not in the constant time inverse below
* to avoid complicating an already difficult enough function.
*/
-int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OPENSSL_CTX *libctx,
+int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OSSL_LIB_CTX *libctx,
unsigned char *to, int tlen,
&nb