Clean password buffer on stack for PEM_read_bio_PrivateKey
and d2i_PKCS8PrivateKey_bio before it goes out of scope. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4047)
This commit is contained in:
parent
03883e7e16
commit
02fd47c8b0
2 changed files with 2 additions and 0 deletions
|
@ -131,6 +131,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
|||
}
|
||||
p8inf = PKCS8_decrypt(p8, psbuf, klen);
|
||||
X509_SIG_free(p8);
|
||||
OPENSSL_cleanse(psbuf, klen);
|
||||
if (!p8inf)
|
||||
return NULL;
|
||||
ret = EVP_PKCS82PKEY(p8inf);
|
||||
|
|
|
@ -67,6 +67,7 @@ EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
|
|||
}
|
||||
p8inf = PKCS8_decrypt(p8, psbuf, klen);
|
||||
X509_SIG_free(p8);
|
||||
OPENSSL_cleanse(psbuf, klen);
|
||||
if (!p8inf)
|
||||
goto p8err;
|
||||
ret = EVP_PKCS82PKEY(p8inf);
|
||||
|
|
Loading…
Reference in a new issue