summaryrefslogtreecommitdiffstats
path: root/ssl/ssl_locl.h
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2017-02-13 15:40:21 +0000
committerDr. Stephen Henson <steve@openssl.org>2017-02-15 02:23:54 +0000
commit4020c0b33b25f829ca68976970d44227d115eb9e (patch)
treed8a100d98157c6e906e0ea216322a35f884a6c68 /ssl/ssl_locl.h
parent7e12cdb52e3f4beff050caeecf3634870bb9a7c4 (diff)
add ssl_has_cert
Add inline function ssl_has_cert which checks to see if a certificate and private key for a given index are not NULL. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2623)
Diffstat (limited to 'ssl/ssl_locl.h')
-rw-r--r--ssl/ssl_locl.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
index df6be646e1..23e6a67470 100644
--- a/ssl/ssl_locl.h
+++ b/ssl/ssl_locl.h
@@ -1950,6 +1950,15 @@ struct openssl_ssl_test_functions {
const char *ssl_protocol_to_string(int version);
+/* Returns true if certificate and private key for 'idx' are present */
+static ossl_inline int ssl_has_cert(const SSL *s, int idx)
+{
+ if (idx < 0 || idx >= SSL_PKEY_NUM)
+ return 0;
+ return s->cert->pkeys[idx].x509 != NULL
+ && s->cert->pkeys[idx].privatekey != NULL;
+}
+
# ifndef OPENSSL_UNIT_TEST
void ssl_clear_cipher_ctx(SSL *s);