Rethink the EVP_PKEY cache of provider side keys
authorRichard Levitte <levitte@openssl.org>
Thu, 20 Feb 2020 19:26:16 +0000 (20:26 +0100)
committerRichard Levitte <levitte@openssl.org>
Sat, 29 Feb 2020 04:39:43 +0000 (05:39 +0100)
commit3c6ed9555c7735c24d5f59c8b4ab7b9c4d807c77
tree663b632b0655551629e64f860c64d8b892513449
parent49119647639b0b3ecd4db3d99b653653b41d1d20
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)
12 files changed:
crypto/asn1/i2d_pr.c
crypto/evp/exchange.c
crypto/evp/keymgmt_lib.c
crypto/evp/m_sigver.c
crypto/evp/p_lib.c
crypto/evp/pmeth_check.c
crypto/evp/pmeth_fn.c
crypto/evp/pmeth_lib.c
crypto/evp/signature.c
crypto/serializer/serializer_pkey.c
crypto/x509/x_pubkey.c
include/crypto/evp.h