DECODER: Add function to set an OSSL_PASSPHRASE_CALLBACK type callback
This makes it possible to use OSSL_DECODER in functions that are passed a OSSL_PASSPHRASE_CALLBACK already. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12512)master
parent
ab00ddb559
commit
4fd3978211
|
@ -36,6 +36,13 @@ int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,
|
|||
return ossl_pw_set_pem_password_cb(&ctx->pwdata, cb, cbarg);
|
||||
}
|
||||
|
||||
int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_PASSPHRASE_CALLBACK *cb,
|
||||
void *cbarg)
|
||||
{
|
||||
return ossl_pw_set_ossl_passphrase_cb(&ctx->pwdata, cb, cbarg);
|
||||
}
|
||||
|
||||
/*
|
||||
* Support for OSSL_DECODER_CTX_new_by_EVP_PKEY:
|
||||
* The construct data, and collecting keymgmt information for it
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
OSSL_DECODER_CTX_new_by_EVP_PKEY,
|
||||
OSSL_DECODER_CTX_set_passphrase,
|
||||
OSSL_DECODER_CTX_set_pem_password_cb,
|
||||
OSSL_DECODER_CTX_set_passphrase_ui
|
||||
OSSL_DECODER_CTX_set_passphrase_ui,
|
||||
OSSL_DECODER_CTX_set_passphrase_cb
|
||||
- Decoder routines to decode EVP_PKEYs
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
@ -25,6 +26,9 @@ OSSL_DECODER_CTX_set_passphrase_ui
|
|||
int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,
|
||||
const UI_METHOD *ui_method,
|
||||
void *ui_data);
|
||||
int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_PASSPHRASE_CALLBACK *cb,
|
||||
void *cbarg);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
@ -55,29 +59,26 @@ pass phrase to use when decrypting the encoded private key.
|
|||
Alternatively, a pass phrase callback may be specified with the
|
||||
following functions.
|
||||
|
||||
OSSL_DECODER_CTX_set_pem_password_cb() and
|
||||
OSSL_DECODER_CTX_set_passphrase_ui() set up a callback method that
|
||||
OSSL_DECODER_CTX_set_pem_password_cb(),
|
||||
OSSL_DECODER_CTX_set_passphrase_ui() and
|
||||
OSSL_DECODER_CTX_set_passphrase_cb() set up a callback method that
|
||||
the implementation can use to prompt for a pass phrase, giving the caller
|
||||
the choice of prefered pass phrase callback form. These are called
|
||||
indirectly, through an internal B<OSSL_PASSPHRASE_CALLBACK> function.
|
||||
|
||||
The internal B<OSSL_PASSPHRASE_CALLBACK> function caches the pass phrase, to
|
||||
be re-used in all decodings that are performed in the same
|
||||
decoding run
|
||||
The internal B<OSSL_PASSPHRASE_CALLBACK> function caches the pass phrase,
|
||||
to be re-used in all decodings that are performed in the same decoding run
|
||||
(for example, within one L<OSSL_DECODER_from_bio(3)> call).
|
||||
|
||||
=for comment the name OSSL_DECODER_CTX_set_pem_password_cb() leaves
|
||||
open the future possibility of having a function where the caller can set a
|
||||
B<OSSL_PASSPHRASE_CALLBACK> method as another option.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
OSSL_DECODER_CTX_new_by_EVP_PKEY() returns a pointer to a
|
||||
B<OSSL_DECODER_CTX>, or NULL if it couldn't be created.
|
||||
|
||||
OSSL_DECODER_CTX_set_passphrase(),
|
||||
OSSL_DECODER_CTX_set_pem_password_cb() and
|
||||
OSSL_DECODER_CTX_set_passphrase_ui()
|
||||
OSSL_DECODER_CTX_set_pem_password_cb(),
|
||||
OSSL_DECODER_CTX_set_passphrase_ui() and
|
||||
OSSL_DECODER_CTX_set_passphrase_cb()
|
||||
all return 1 on success, or 0 on failure.
|
||||
|
||||
=head1 NOTES
|
||||
|
|
|
@ -58,6 +58,9 @@ int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx,
|
|||
int OSSL_DECODER_CTX_set_pem_password_cb(OSSL_DECODER_CTX *ctx,
|
||||
pem_password_cb *cb,
|
||||
void *cbarg);
|
||||
int OSSL_DECODER_CTX_set_passphrase_cb(OSSL_DECODER_CTX *ctx,
|
||||
OSSL_PASSPHRASE_CALLBACK *cb,
|
||||
void *cbarg);
|
||||
int OSSL_DECODER_CTX_set_passphrase_ui(OSSL_DECODER_CTX *ctx,
|
||||
const UI_METHOD *ui_method,
|
||||
void *ui_data);
|
||||
|
|
|
@ -5283,3 +5283,4 @@ OSSL_STORE_LOADER_do_all_provided ? 3_0_0 EXIST::FUNCTION:
|
|||
OSSL_STORE_LOADER_names_do_all ? 3_0_0 EXIST::FUNCTION:
|
||||
OSSL_PARAM_get_utf8_string_ptr ? 3_0_0 EXIST::FUNCTION:
|
||||
OSSL_PARAM_get_octet_string_ptr ? 3_0_0 EXIST::FUNCTION:
|
||||
OSSL_DECODER_CTX_set_passphrase_cb ? 3_0_0 EXIST::FUNCTION:
|
||||
|
|
Loading…
Reference in New Issue