aboutsummaryrefslogtreecommitdiff
path: root/crypto/passphrase.c
AgeCommit message (Collapse)AuthorFilesLines
2022-03-15Update copyright yearMatt Caswell1-1/+1
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2022-01-26Fix invalid malloc failures in PEM_write_bio_PKCS8PrivateKey()Darshan Sen1-1/+2
When `PEM_write_bio_PKCS8PrivateKey()` was passed an empty passphrase string, `OPENSSL_memdup()` was incorrectly getting used for 0 bytes size allocation, which resulted in malloc failures. Fixes: https://github.com/openssl/openssl/issues/17506 Signed-off-by: Darshan Sen <raisinten@gmail.com> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17507) (cherry picked from commit 59ccb72cd5cec3b4e312853621e12a68dacdbc7e)
2022-01-03Compensate for UI method always adding NUL terminationTomas Mraz1-9/+24
The UI method always adds NUL termination and we need to compensate for that when using it from a pem_password_cb because the buffer used in pem_password_cb does not account for that and the returned password should be able fill the whole buffer. Fixes #16601 Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/17320) (cherry picked from commit ef65bbb96352650bf9ce4ff46c60c71d9f138d08)
2021-12-06Fix pvk encoder to properly query for the passphraseTomas Mraz1-2/+13
The passphrase callback data was not properly initialized. Fixes #17054 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17181) (cherry picked from commit baa88d9d170b95fd6f177b3e5f8d8818e024a55d)
2021-07-29Update copyright yearMatt Caswell1-1/+1
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16176)
2021-06-24ossl_pw_get_passphrase: No ui method does not necessarily mean internal errorTomas Mraz1-1/+2
Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15878)
2020-09-03CORE: Fix small bug in passphrase cachingRichard Levitte1-1/+2
Passphrase caching didn't allocate memory when it got to cache an empty string, leading to a crash. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/12587)
2020-08-24CORE: Generalise internal pass phrase prompterRichard Levitte1-0/+324
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)