diff options
-rw-r--r-- | crypto/evp/p_lib.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 554fad927c..fa51304c97 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -2176,7 +2176,14 @@ int EVP_PKEY_get_bn_param(const EVP_PKEY *pkey, const char *key_name, goto err; ret = OSSL_PARAM_get_BN(params, bn); err: - OPENSSL_free(buf); + if (buf != NULL) { + if (OSSL_PARAM_modified(params)) + OPENSSL_clear_free(buf, buf_sz); + else + OPENSSL_free(buf); + } else if (OSSL_PARAM_modified(params)) { + OPENSSL_cleanse(buffer, params[0].data_size); + } return ret; } |