diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2013-11-13 22:57:11 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2013-11-13 23:48:35 +0000 |
commit | 629b640bbc5391c6ac727aaa8465c5c5f99a5708 (patch) | |
tree | 8381a3ff67166b544185f87ebbe7d2294b8cade8 /ssl/ssl_cert.c | |
parent | 7b6b246fd393cbe07bc1f0d456140efdff59f971 (diff) |
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.
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r-- | ssl/ssl_cert.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 9d77ef79a2..005d82d630 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -602,6 +602,8 @@ int ssl_cert_add1_chain_cert(CERT *c, X509 *x) int ssl_cert_select_current(CERT *c, X509 *x) { int i; + if (x == NULL) + return 0; for (i = 0; i < SSL_PKEY_NUM; i++) { if (c->pkeys[i].x509 == x) @@ -610,6 +612,15 @@ int ssl_cert_select_current(CERT *c, X509 *x) 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; } |