summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-12-11 11:01:09 +0100
committerRichard Levitte <levitte@openssl.org>2020-12-17 12:02:08 +0100
commit6963979f5c0f95b2152ef74645faa7344e33284d (patch)
treeff97ca1102560458f90bc3e16db622055aec41fd /crypto
parente77c13f8b73ff937819d6551ddd616fe01b989d0 (diff)
DECODER: Adjust the library context of keys in our decoders
Because decoders are coupled with keymgmts from the same provider, ours need to produce provider side keys the same way. Since our keymgmts create key data with the provider library context, so must our decoders. We solve with functions to adjust the library context of decoded keys, and use them. Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13661)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/dh/dh_lib.c5
-rw-r--r--crypto/dsa/dsa_lib.c5
-rw-r--r--crypto/ec/ec_key.c6
-rw-r--r--crypto/ec/ecx_key.c5
-rw-r--r--crypto/rsa/rsa_lib.c5
5 files changed, 26 insertions, 0 deletions
diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c
index e687b04259..e8a66878ab 100644
--- a/crypto/dh/dh_lib.c
+++ b/crypto/dh/dh_lib.c
@@ -168,6 +168,11 @@ int DH_up_ref(DH *r)
return ((i > 1) ? 1 : 0);
}
+void ossl_dh_set0_libctx(DH *d, OSSL_LIB_CTX *libctx)
+{
+ d->libctx = libctx;
+}
+
#ifndef FIPS_MODULE
int DH_set_ex_data(DH *d, int idx, void *arg)
{
diff --git a/crypto/dsa/dsa_lib.c b/crypto/dsa/dsa_lib.c
index 4a9f572edd..df9dd73dfd 100644
--- a/crypto/dsa/dsa_lib.c
+++ b/crypto/dsa/dsa_lib.c
@@ -247,6 +247,11 @@ int DSA_up_ref(DSA *r)
return ((i > 1) ? 1 : 0);
}
+void ossl_dsa_set0_libctx(DSA *d, OSSL_LIB_CTX *libctx)
+{
+ d->libctx = libctx;
+}
+
void DSA_get0_pqg(const DSA *d,
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
{
diff --git a/crypto/ec/ec_key.c b/crypto/ec/ec_key.c
index da3d6f04a2..d03c75e8aa 100644
--- a/crypto/ec/ec_key.c
+++ b/crypto/ec/ec_key.c
@@ -659,6 +659,12 @@ const char *ec_key_get0_propq(const EC_KEY *key)
return key->propq;
}
+void ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx)
+{
+ key->libctx = libctx;
+ /* Do we need to propagate this to the group? */
+}
+
const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
{
return key->group;
diff --git a/crypto/ec/ecx_key.c b/crypto/ec/ecx_key.c
index db74a40c97..2b9386d522 100644
--- a/crypto/ec/ecx_key.c
+++ b/crypto/ec/ecx_key.c
@@ -73,6 +73,11 @@ void ecx_key_free(ECX_KEY *key)
OPENSSL_free(key);
}
+void ecx_key_set0_libctx(ECX_KEY *key, OSSL_LIB_CTX *libctx)
+{
+ key->libctx = libctx;
+}
+
int ecx_key_up_ref(ECX_KEY *key)
{
int i;
diff --git a/crypto/rsa/rsa_lib.c b/crypto/rsa/rsa_lib.c
index 8e7ad45608..f4e3ff423e 100644
--- a/crypto/rsa/rsa_lib.c
+++ b/crypto/rsa/rsa_lib.c
@@ -194,6 +194,11 @@ OSSL_LIB_CTX *ossl_rsa_get0_libctx(RSA *r)
return r->libctx;
}
+void ossl_rsa_set0_libctx(RSA *r, OSSL_LIB_CTX *libctx)
+{
+ r->libctx = libctx;
+}
+
#ifndef FIPS_MODULE
int RSA_set_ex_data(RSA *r, int idx, void *arg)
{