SERIALIZER: add support for serializing EVP_PKEYs
authorRichard Levitte <levitte@openssl.org>
Mon, 18 Nov 2019 00:34:26 +0000 (01:34 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 29 Nov 2019 19:55:16 +0000 (20:55 +0100)
commit866234ac35e665f20c646059b1d92c5e9eb0c7ab
tree53cbf9072506794da60fdadc02c8d97676e7f125
parent1793d270f3c6f6b859e40ef1fa7bea1fd7e447c8
SERIALIZER: add support for serializing EVP_PKEYs

The following public functions is added:

- OSSL_SERIALIZER_CTX_new_by_EVP_PKEY()
- OSSL_SERIALIZER_CTX_set_cipher()
- OSSL_SERIALIZER_CTX_set_passphrase()
- OSSL_SERIALIZER_CTX_set_passphrase_cb()
- OSSL_SERIALIZER_CTX_set_passphrase_ui()

OSSL_SERIALIZER_CTX_new_by_EVP_PKEY() selects a suitable serializer
for the given EVP_PKEY, and sets up the OSSL_SERIALIZER_CTX to
function together with OSSL_SERIALIZER_to_bio() and
OSSL_SERIALIZER_to_fp().

OSSL_SERIALIZER_CTX_set_cipher() indicates what cipher should be used
to produce an encrypted serialization of the EVP_PKEY.  This is passed
directly to the provider using OSSL_SERIALIZER_CTX_set_params().

OSSL_SERIALIZER_CTX_set_passphrase() can be used to set a pass phrase
to be used for the encryption.  This is passed directly to the
provider using OSSL_SERIALIZER_CTX_set_params().

OSSL_SERIALIZER_CTX_set_passphrase_cb() and
OSSL_SERIALIZER_CTX_set_passphrase_ui() sets up a callback to be used
to prompt for a passphrase.  This is stored in the context, and is
called via an internal intermediary at the time of serialization.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10394)
17 files changed:
crypto/err/err.c
crypto/err/openssl.txt
crypto/serializer/build.info
crypto/serializer/serializer_err.c [new file with mode: 0644]
crypto/serializer/serializer_local.h
crypto/serializer/serializer_meth.c
crypto/serializer/serializer_pkey.c [new file with mode: 0644]
doc/man3/OSSL_SERIALIZER.pod
doc/man3/OSSL_SERIALIZER_CTX_new_by_EVP_PKEY.pod [new file with mode: 0644]
doc/man7/provider-serializer.pod
include/openssl/core_names.h
include/openssl/err.h
include/openssl/serializer.h
include/openssl/serializererr.h [new file with mode: 0644]
util/libcrypto.num
util/missingcrypto.txt
util/other.syms