OSSL_provider_get_param_types_fn *get_param_types;
OSSL_provider_get_params_fn *get_params;
OSSL_provider_query_operation_fn *query_operation;
+
+ /* Provider side data */
+ void *provctx;
};
DEFINE_STACK_OF(OSSL_PROVIDER)
*/
if (ref < 2 && prov->flag_initialized) {
if (prov->teardown != NULL)
- prov->teardown();
+ prov->teardown(prov->provctx);
prov->flag_initialized = 0;
}
}
if (prov->init_function == NULL
- || !prov->init_function(prov, core_dispatch, &provider_dispatch)) {
+ || !prov->init_function(prov, core_dispatch, &provider_dispatch,
+ &prov->provctx)) {
CRYPTOerr(CRYPTO_F_PROVIDER_ACTIVATE, ERR_R_INIT_FAIL);
ERR_add_error_data(2, "name=", prov->name);
DSO_free(prov->module);
return 0;
}
+void *ossl_provider_ctx(const OSSL_PROVIDER *prov)
+{
+ return prov->provctx;
+}
+
static int provider_forall_loaded(struct provider_store_st *store,
int *found_activated,
void ossl_provider_teardown(const OSSL_PROVIDER *prov)
{
if (prov->teardown != NULL)
- prov->teardown();
+ prov->teardown(prov->provctx);
}
const OSSL_ITEM *ossl_provider_get_param_types(const OSSL_PROVIDER *prov)
{
- return prov->get_param_types == NULL ? NULL : prov->get_param_types(prov);
+ return prov->get_param_types == NULL
+ ? NULL : prov->get_param_types(prov->provctx);
}
int ossl_provider_get_params(const OSSL_PROVIDER *prov,
const OSSL_PARAM params[])
{
- return prov->get_params == NULL ? 0 : prov->get_params(prov, params);
+ return prov->get_params == NULL
+ ? 0 : prov->get_params(prov->provctx, params);
}
int operation_id,
int *no_cache)
{
- return prov->query_operation(prov, operation_id, no_cache);
+ return prov->query_operation(prov->provctx, operation_id, no_cache);
}
/*-
ossl_provider_find, ossl_provider_new, ossl_provider_upref,
ossl_provider_free, ossl_provider_add_module_location,
ossl_provider_set_fallback, ossl_provider_activate,
-ossl_provider_forall_loaded,
+ossl_provider_ctx, ossl_provider_forall_loaded,
ossl_provider_name, ossl_provider_dso,
ossl_provider_module_name, ossl_provider_module_path,
ossl_provider_teardown, ossl_provider_get_param_types,
/* Load and initialize the Provider */
int ossl_provider_activate(OSSL_PROVIDER *prov);
+ /* Return pointer to the provider's context */
+ void *ossl_provider_ctx(const OSSL_PROVIDER *prov);
+
/* Iterate over all loaded providers */
int ossl_provider_forall_loaded(OPENSSL_CTX *,
int (*cb)(OSSL_PROVIDER *provider,
=back
+ossl_provider_ctx() returns a context created by the provider.
+Outside of the provider, it's completely opaque, but it needs to be
+passed back to some of the provider functions.
+
ossl_provider_forall_loaded() iterates over all the currently
"activated" providers, and calls C<cb> for each of them.
If no providers have been "activated" yet, it tries to activate all
/* Functions provided by the provider to the Core, reserved numbers 1024-1535 */
# define OSSL_FUNC_PROVIDER_TEARDOWN 1024
-OSSL_CORE_MAKE_FUNC(void,provider_teardown,(void))
+OSSL_CORE_MAKE_FUNC(void,provider_teardown,(void *provctx))
# define OSSL_FUNC_PROVIDER_GET_PARAM_TYPES 1025
OSSL_CORE_MAKE_FUNC(const OSSL_ITEM *,
- provider_get_param_types,(const OSSL_PROVIDER *prov))
+ provider_get_param_types,(void *provctx))
# define OSSL_FUNC_PROVIDER_GET_PARAMS 1026
-OSSL_CORE_MAKE_FUNC(int,provider_get_params,(const OSSL_PROVIDER *prov,
+OSSL_CORE_MAKE_FUNC(int,provider_get_params,(void *provctx,
const OSSL_PARAM params[]))
# define OSSL_FUNC_PROVIDER_QUERY_OPERATION 1027
OSSL_CORE_MAKE_FUNC(const OSSL_ALGORITHM *,provider_query_operation,
- (const OSSL_PROVIDER *, int operation_id,
- const int *no_store))
+ (void *provctx, int operation_id, const int *no_store))
/* Digests */
# define OSSL_FUNC_DIGEST_BLOCK_SIZE 9
-OSSL_CORE_MAKE_FUNC(void *, OP_digest_newctx, (void))
-OSSL_CORE_MAKE_FUNC(int, OP_digest_init, (void *vctx))
+OSSL_CORE_MAKE_FUNC(void *, OP_digest_newctx, (void *provctx))
+OSSL_CORE_MAKE_FUNC(int, OP_digest_init, (void *dctx))
OSSL_CORE_MAKE_FUNC(int, OP_digest_update,
- (void *, const unsigned char *in, size_t inl))
+ (void *dctx, const unsigned char *in, size_t inl))
OSSL_CORE_MAKE_FUNC(int, OP_digest_final,
- (void *, unsigned char *out, size_t *outl, size_t outsz))
+ (void *dctx,
+ unsigned char *out, size_t *outl, size_t outsz))
OSSL_CORE_MAKE_FUNC(int, OP_digest_digest,
- (const unsigned char *in, size_t inl, unsigned char *out,
- size_t *out_l, size_t outsz))
+ (void *provctx, const unsigned char *in, size_t inl,
+ unsigned char *out, size_t *out_l, size_t outsz))
-OSSL_CORE_MAKE_FUNC(void, OP_digest_cleanctx, (void *vctx))
-OSSL_CORE_MAKE_FUNC(void, OP_digest_freectx, (void *vctx))
-OSSL_CORE_MAKE_FUNC(void *, OP_digest_dupctx, (void *vctx))
+OSSL_CORE_MAKE_FUNC(void, OP_digest_cleanctx, (void *dctx))
+OSSL_CORE_MAKE_FUNC(void, OP_digest_freectx, (void *dctx))
+OSSL_CORE_MAKE_FUNC(void *, OP_digest_dupctx, (void *dctx))
OSSL_CORE_MAKE_FUNC(size_t, OP_digest_size, (void))
OSSL_CORE_MAKE_FUNC(size_t, OP_digest_block_size, (void))
# define OSSL_FUNC_CIPHER_CTX_GET_PARAMS 13
# define OSSL_FUNC_CIPHER_CTX_SET_PARAMS 14
-OSSL_CORE_MAKE_FUNC(void *, OP_cipher_newctx, (void))
-OSSL_CORE_MAKE_FUNC(int, OP_cipher_encrypt_init, (void *vctx,
+OSSL_CORE_MAKE_FUNC(void *, OP_cipher_newctx, (void *provctx))
+OSSL_CORE_MAKE_FUNC(int, OP_cipher_encrypt_init, (void *cctx,
const unsigned char *key,
size_t keylen,
const unsigned char *iv,
size_t ivlen))
-OSSL_CORE_MAKE_FUNC(int, OP_cipher_decrypt_init, (void *vctx,
+OSSL_CORE_MAKE_FUNC(int, OP_cipher_decrypt_init, (void *cctx,
const unsigned char *key,
size_t keylen,
const unsigned char *iv,
size_t ivlen))
OSSL_CORE_MAKE_FUNC(int, OP_cipher_update,
- (void *, unsigned char *out, size_t *outl, size_t outsize,
+ (void *cctx,
+ unsigned char *out, size_t *outl, size_t outsize,
const unsigned char *in, size_t inl))
OSSL_CORE_MAKE_FUNC(int, OP_cipher_final,
- (void *, unsigned char *out, size_t *outl, size_t outsize))
+ (void *cctx,
+ unsigned char *out, size_t *outl, size_t outsize))
OSSL_CORE_MAKE_FUNC(int, OP_cipher_cipher,
- (void *,
+ (void *cctx,
unsigned char *out, size_t *outl, size_t outsize,
const unsigned char *in, size_t inl))
-OSSL_CORE_MAKE_FUNC(void, OP_cipher_freectx, (void *vctx))
-OSSL_CORE_MAKE_FUNC(void *, OP_cipher_dupctx, (void *vctx))
+OSSL_CORE_MAKE_FUNC(void, OP_cipher_freectx, (void *cctx))
+OSSL_CORE_MAKE_FUNC(void *, OP_cipher_dupctx, (void *cctx))
OSSL_CORE_MAKE_FUNC(size_t, OP_cipher_key_length, (void))
OSSL_CORE_MAKE_FUNC(size_t, OP_cipher_iv_length, (void))
OSSL_CORE_MAKE_FUNC(size_t, OP_cipher_block_size, (void))
OSSL_CORE_MAKE_FUNC(int, OP_cipher_get_params, (const OSSL_PARAM params[]))
-OSSL_CORE_MAKE_FUNC(int, OP_cipher_ctx_get_params, (void *vctx,
+OSSL_CORE_MAKE_FUNC(int, OP_cipher_ctx_get_params, (void *cctx,
const OSSL_PARAM params[]))
-OSSL_CORE_MAKE_FUNC(int, OP_cipher_ctx_set_params, (void *vctx,
+OSSL_CORE_MAKE_FUNC(int, OP_cipher_ctx_set_params, (void *cctx,
const OSSL_PARAM params[]))