]> git.ipfire.org Git - thirdparty/openssl.git/commit - crypto/evp/p_lib.c
Redesign the KEYMGMT libcrypto <-> provider interface - the basics
authorRichard Levitte <levitte@openssl.org>
Sun, 2 Feb 2020 17:56:07 +0000 (18:56 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 7 Feb 2020 08:37:56 +0000 (09:37 +0100)
commitb305452f69fc97c586f2f9310014e332ae1d5cd5
tree1214a4da68c682b9b4be9e43cd3607c1b5de8c2a
parent68552cdef7631191e77315e0faeb42c6893cafe3
Redesign the KEYMGMT libcrypto <-> provider interface - the basics

The KEYMGMT libcrypto <-> provider interface currently makes a few
assumptions:

1.  provider side domain parameters and key data isn't mutable. In
    other words, as soon as a key has been created in any (loaded,
    imported data, ...), it's set in stone.
2.  provider side domain parameters can be strictly separated from the
    key data.

This does work for the most part, but there are places where that's a
bit too rigid for the functionality that the EVP_PKEY API delivers.
Key data needs to be mutable to allow the flexibility that functions
like EVP_PKEY_copy_parameters promise, as well as to provide the
combinations of data that an EVP_PKEY is generally assumed to be able
to hold:

- domain parameters only
- public key only
- public key + private key
- domain parameters + public key
- domain parameters + public key + private key

To remedy all this, we:

1.  let go of the distinction between domain parameters and key
    material proper in the libcrypto <-> provider interface.

    As a consequence, functions that still need it gain a selection
    argument, which is a set of bits that indicate what parts of the
    key object are to be considered in a specific call.  This allows
    a reduction of very similar functions into one.

2.  Rework the libcrypto <-> provider interface so provider side key
    objects are created and destructed with a separate function, and
    get their data filled and extracted in through import and export.

(future work will see other key object constructors and other
functions to fill them with data)

Fixes #10979

squash! Redesign the KEYMGMT libcrypto <-> provider interface - the basics

Remedy 1 needs a rewrite:

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/11006)
32 files changed:
crypto/dh/dh_ameth.c
crypto/dsa/dsa_ameth.c
crypto/dsa/dsa_lib.c
crypto/evp/evp_local.h
crypto/evp/exchange.c
crypto/evp/keymgmt_lib.c
crypto/evp/keymgmt_meth.c
crypto/evp/m_sigver.c
crypto/evp/p_lib.c
crypto/evp/pmeth_check.c
crypto/evp/pmeth_fn.c
crypto/evp/pmeth_gn.c
crypto/evp/signature.c
crypto/rsa/rsa_ameth.c
crypto/serializer/serializer_local.h
crypto/serializer/serializer_pkey.c
doc/internal/man3/evp_keymgmt_export_to_provider.pod [deleted file]
doc/internal/man3/evp_keymgmt_freekey.pod [deleted file]
doc/internal/man3/evp_keymgmt_newdata.pod [new file with mode: 0644]
doc/internal/man3/evp_keymgmt_util_export_to_provider.pod [new file with mode: 0644]
doc/internal/man3/evp_pkey_make_provided.pod
doc/man3/EVP_PKEY_check.pod
doc/man3/EVP_PKEY_fromdata.pod
doc/man3/OSSL_SERIALIZER_CTX_new_by_EVP_PKEY.pod
doc/man3/d2i_PrivateKey.pod
doc/man7/provider-keymgmt.pod
doc/man7/provider-serializer.pod
include/crypto/asn1.h
include/crypto/evp.h
include/internal/property.h
include/openssl/core_numbers.h
include/openssl/serializer.h