提交 a6465b3f 编写于 作者: P Pauli

Avoid SEGV when giving X509_sign a NULL private key.

Put a NULL check back in to avoid dereferencing the NULL pointer.
Reviewed-by: NTim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7146)
上级 82eba370
...@@ -106,6 +106,8 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) ...@@ -106,6 +106,8 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
const EVP_PKEY_METHOD *pmeth; const EVP_PKEY_METHOD *pmeth;
if (id == -1) { if (id == -1) {
if (pkey == NULL)
return 0;
id = pkey->type; id = pkey->type;
} }
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
...@@ -151,7 +153,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) ...@@ -151,7 +153,7 @@ static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
ret->pmeth = pmeth; ret->pmeth = pmeth;
ret->operation = EVP_PKEY_OP_UNDEFINED; ret->operation = EVP_PKEY_OP_UNDEFINED;
ret->pkey = pkey; ret->pkey = pkey;
if (pkey) if (pkey != NULL)
EVP_PKEY_up_ref(pkey); EVP_PKEY_up_ref(pkey);
if (pmeth->init) { if (pmeth->init) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册