CORE: Generalise internal pass phrase prompter
authorRichard Levitte <levitte@openssl.org>
Sun, 2 Aug 2020 10:14:19 +0000 (12:14 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 24 Aug 2020 08:02:25 +0000 (10:02 +0200)
commita517edec0385280e31e2dc2912301501e6b0c4a3
tree78538835d6f1fcc93a7c1a637931bf1f1f23d127
parent14c8a3d118e3ec5d0179d45c7f227d29a52f7697
CORE: Generalise internal pass phrase prompter

The pass phrase prompter that's part of OSSL_ENCODER and OSSL_DECODER
is really a passphrase callback bridge between the diverse forms of
prompters that exist within OpenSSL: pem_password_cb, ui_method and
OSSL_PASSPHRASE_CALLBACK.

This can be generalised, to be re-used by other parts of OpenSSL, and
to thereby allow the users to specify whatever form of pass phrase
callback they need, while being able to pass that on to other APIs
that are called internally, in the form that those APIs demand.

Additionally, we throw in the possibility to cache pass phrases during
a "session" (we leave it to each API to define what a "session" is).
This is useful for any API that implements discovery and therefore may
need to get the same password more than once, such as OSSL_DECODER and
OSSL_STORE.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12512)
12 files changed:
crypto/build.info
crypto/encode_decode/build.info
crypto/encode_decode/decoder_lib.c
crypto/encode_decode/decoder_meth.c
crypto/encode_decode/decoder_pkey.c
crypto/encode_decode/encoder_local.h
crypto/encode_decode/encoder_meth.c
crypto/encode_decode/encoder_pkey.c
crypto/encode_decode/endecode_pass.c [deleted file]
crypto/passphrase.c [new file with mode: 0644]
include/internal/passphrase.h [new file with mode: 0644]
providers/implementations/encode_decode/decode_common.c