aboutsummaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2019-04-30 13:41:51 +0200
committerRichard Levitte <levitte@openssl.org>2019-04-30 15:34:23 +0200
commita39eb84006ca68d38d1c7204a6135647d06b5d01 (patch)
treea39170c4d6ece3fc94ae7fc4e09a97d4b090f00f /providers
parentf79858ac4d90a450d0620d1ecb713bc35d7d9f8d (diff)
downloadopenssl-a39eb84006ca68d38d1c7204a6135647d06b5d01.tar.gz
Replumbing: give the possibility for the provider to create a context
OSSL_provider_init() gets another output parameter, holding a pointer to a provider side context. It's entirely up to the provider to define the context and what it's being used for. This pointer is passed back to other provider functions, typically the provider global get_params and set_params functions, and also the diverse algorithm context creators, and of course, the teardown function. With this, a provider can be instantiated more than once, or be re-loaded as the case may be, while maintaining instance state. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8848)
Diffstat (limited to 'providers')
-rw-r--r--providers/common/ciphers/aes.c2
-rw-r--r--providers/common/digests/sha2.c2
-rw-r--r--providers/default/defltprov.c3
-rw-r--r--providers/fips/fipsprov.c3
-rw-r--r--providers/legacy/legacyprov.c3
5 files changed, 8 insertions, 5 deletions
diff --git a/providers/common/ciphers/aes.c b/providers/common/ciphers/aes.c
index 2e93461621..8d91ff4804 100644
--- a/providers/common/ciphers/aes.c
+++ b/providers/common/ciphers/aes.c
@@ -270,7 +270,7 @@ static int aes_cipher(void *vctx,
#define IMPLEMENT_new_ctx(lcmode, UCMODE, len) \
static OSSL_OP_cipher_newctx_fn aes_##len##_##lcmode##_newctx; \
- static void *aes_##len##_##lcmode##_newctx(void) \
+ static void *aes_##len##_##lcmode##_newctx(void *provctx) \
{ \
PROV_AES_KEY *ctx = OPENSSL_zalloc(sizeof(*ctx)); \
\
diff --git a/providers/common/digests/sha2.c b/providers/common/digests/sha2.c
index c9f616db68..5b219ab783 100644
--- a/providers/common/digests/sha2.c
+++ b/providers/common/digests/sha2.c
@@ -40,7 +40,7 @@ static int sha256_final(void *ctx,
return 0;
}
-static void *sha256_newctx(void)
+static void *sha256_newctx(void *provctx)
{
SHA256_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
diff --git a/providers/default/defltprov.c b/providers/default/defltprov.c
index cba2dccf03..95b2abfdb9 100644
--- a/providers/default/defltprov.c
+++ b/providers/default/defltprov.c
@@ -106,7 +106,8 @@ OSSL_provider_init_fn ossl_default_provider_init;
int ossl_default_provider_init(const OSSL_PROVIDER *provider,
const OSSL_DISPATCH *in,
- const OSSL_DISPATCH **out)
+ const OSSL_DISPATCH **out,
+ void **provctx)
{
for (; in->function_id != 0; in++) {
switch (in->function_id) {
diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c
index d3671b5a36..1b8316388b 100644
--- a/providers/fips/fipsprov.c
+++ b/providers/fips/fipsprov.c
@@ -78,7 +78,8 @@ static const OSSL_DISPATCH fips_dispatch_table[] = {
int OSSL_provider_init(const OSSL_PROVIDER *provider,
const OSSL_DISPATCH *in,
- const OSSL_DISPATCH **out)
+ const OSSL_DISPATCH **out,
+ void **provctx)
{
for (; in->function_id != 0; in++) {
switch (in->function_id) {
diff --git a/providers/legacy/legacyprov.c b/providers/legacy/legacyprov.c
index 48e89338d4..2d42229fea 100644
--- a/providers/legacy/legacyprov.c
+++ b/providers/legacy/legacyprov.c
@@ -80,7 +80,8 @@ static const OSSL_DISPATCH legacy_dispatch_table[] = {
int OSSL_provider_init(const OSSL_PROVIDER *provider,
const OSSL_DISPATCH *in,
- const OSSL_DISPATCH **out)
+ const OSSL_DISPATCH **out,
+ void **provctx)
{
for (; in->function_id != 0; in++) {
switch (in->function_id) {