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)
do_cache:
if (ret && data->flag_cache_passphrase) {
- if (*pass_len > data->cached_passphrase_len) {
+ if (data->cached_passphrase == NULL
+ || *pass_len > data->cached_passphrase_len) {
void *new_cache =
OPENSSL_clear_realloc(data->cached_passphrase,
data->cached_passphrase_len,