summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_cert.c
diff options
context:
space:
mode:
authorRob Stradling <rob.stradling@comodo.com>2013-11-11 18:04:24 +0100
committerDr. Stephen Henson <steve@openssl.org>2013-11-13 23:48:35 +0000
commit7b6b246fd393cbe07bc1f0d456140efdff59f971 (patch)
tree4639f2a48c9ac9c43859d653b6567945611b1a22 /ssl/ssl_cert.c
parent44314cf64d1e51c7493799e77b14ae4e94a4c8cf (diff)
Additional "chain_cert" functions.
PR#3169 This patch, which currently applies successfully against master and 1_0_2, adds the following functions: SSL_[CTX_]select_current_cert() - set the current certificate without disturbing the existing structure. SSL_[CTX_]get0_chain_certs() - get the current certificate's chain. SSL_[CTX_]clear_chain_certs() - clear the current certificate's chain. The patch also adds these functions to, and fixes some existing errors in, SSL_CTX_add1_chain_cert.pod.
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r--ssl/ssl_cert.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
index d442e5418f..9d77ef79a2 100644
--- a/ssl/ssl_cert.c
+++ b/ssl/ssl_cert.c
@@ -599,6 +599,20 @@ int ssl_cert_add1_chain_cert(CERT *c, X509 *x)
return 1;
}
+int ssl_cert_select_current(CERT *c, X509 *x)
+ {
+ int i;
+ for (i = 0; i < SSL_PKEY_NUM; i++)
+ {
+ if (c->pkeys[i].x509 == x)
+ {
+ c->key = &c->pkeys[i];
+ return 1;
+ }
+ }
+ return 0;
+ }
+
void ssl_cert_set_cert_cb(CERT *c, int (*cb)(SSL *ssl, void *arg), void *arg)
{
c->cert_cb = cb;