提交 629b640b 编写于 作者: D Dr. Stephen Henson

Allow match selecting of current certificate.

If pointer comparison for current certificate fails check
to see if a match using X509_cmp succeeds for the current
certificate: this is useful for cases where the certificate
pointer is not available.
上级 7b6b246f
...@@ -602,6 +602,8 @@ int ssl_cert_add1_chain_cert(CERT *c, X509 *x) ...@@ -602,6 +602,8 @@ int ssl_cert_add1_chain_cert(CERT *c, X509 *x)
int ssl_cert_select_current(CERT *c, X509 *x) int ssl_cert_select_current(CERT *c, X509 *x)
{ {
int i; int i;
if (x == NULL)
return 0;
for (i = 0; i < SSL_PKEY_NUM; i++) for (i = 0; i < SSL_PKEY_NUM; i++)
{ {
if (c->pkeys[i].x509 == x) if (c->pkeys[i].x509 == x)
...@@ -610,6 +612,15 @@ int ssl_cert_select_current(CERT *c, X509 *x) ...@@ -610,6 +612,15 @@ int ssl_cert_select_current(CERT *c, X509 *x)
return 1; return 1;
} }
} }
for (i = 0; i < SSL_PKEY_NUM; i++)
{
if (c->pkeys[i].x509 && !X509_cmp(c->pkeys[i].x509, x))
{
c->key = &c->pkeys[i];
return 1;
}
}
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册