summaryrefslogtreecommitdiffstats
path: root/crypto/serializer
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-02-20 20:26:16 +0100
committerRichard Levitte <levitte@openssl.org>2020-02-29 05:39:43 +0100
commit3c6ed9555c7735c24d5f59c8b4ab7b9c4d807c77 (patch)
tree663b632b0655551629e64f860c64d8b892513449 /crypto/serializer
parentman: openssl-ocsp: separate client and server options (diff)
downloadopenssl-3c6ed9555c7735c24d5f59c8b4ab7b9c4d807c77.tar.xz
openssl-3c6ed9555c7735c24d5f59c8b4ab7b9c4d807c77.zip
Rethink the EVP_PKEY cache of provider side keys
The role of this cache was two-fold: 1. It was a cache of key copies exported to providers with which an operation was initiated. 2. If the EVP_PKEY didn't have a legacy key, item 0 of the cache was the corresponding provider side origin, while the rest was the actual cache. This dual role for item 0 made the code a bit confusing, so we now make a separate keymgmt / keydata pair outside of that cache, which is the provider side "origin" key. A hard rule is that an EVP_PKEY cannot hold a legacy "origin" and a provider side "origin" at the same time. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11148)
Diffstat (limited to 'crypto/serializer')
-rw-r--r--crypto/serializer/serializer_pkey.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/serializer/serializer_pkey.c b/crypto/serializer/serializer_pkey.c
index 3b0cc3ac86..1b6df1da53 100644
--- a/crypto/serializer/serializer_pkey.c
+++ b/crypto/serializer/serializer_pkey.c
@@ -267,8 +267,8 @@ static int serializer_write_cb(const OSSL_PARAM params[], void *arg)
static int serializer_EVP_PKEY_to_bio(OSSL_SERIALIZER_CTX *ctx, BIO *out)
{
const EVP_PKEY *pkey = ctx->object;
- void *keydata = pkey->pkeys[0].keydata;
- EVP_KEYMGMT *keymgmt = pkey->pkeys[0].keymgmt;
+ void *keydata = pkey->keydata;
+ EVP_KEYMGMT *keymgmt = pkey->keymgmt;
/*
* OSSL_SERIALIZER_CTX_new() creates a context, even when the
@@ -306,7 +306,7 @@ OSSL_SERIALIZER_CTX *OSSL_SERIALIZER_CTX_new_by_EVP_PKEY(const EVP_PKEY *pkey,
{
OSSL_SERIALIZER_CTX *ctx = NULL;
OSSL_SERIALIZER *ser = NULL;
- EVP_KEYMGMT *keymgmt = pkey->pkeys[0].keymgmt;
+ EVP_KEYMGMT *keymgmt = pkey->keymgmt;
int selection = OSSL_KEYMGMT_SELECT_ALL;
if (!ossl_assert(pkey != NULL && propquery != NULL)) {