2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2005-2008 Florian Westphal (fw@strlen.de).
4 * Copyright (c)2008-2014 Alexander Barton (alex@barton.de) and Contributors.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 * Please read the file COPYING, README and AUTHORS for more information.
17 * SSL wrapper functions
34 #include "conn-func.h"
40 extern struct SSLOptions Conf_SSLOptions;
43 #include <openssl/err.h>
44 #include <openssl/rand.h>
46 static SSL_CTX * ssl_ctx;
49 static bool ConnSSL_LoadServerKey_openssl PARAMS(( SSL_CTX *c ));
53 #include <sys/types.h>
57 #include <gnutls/x509.h>
60 #define DH_BITS_MIN 1024
62 #define MAX_HASH_SIZE 64 /* from gnutls-int.h */
64 static gnutls_certificate_credentials_t x509_cred;
65 static gnutls_dh_params_t dh_params;
66 static gnutls_priority_t priorities_cache;
67 static bool ConnSSL_LoadServerKey_gnutls PARAMS(( void ));
70 #define SHA256_STRING_LEN (32 * 2 + 1)
72 static bool ConnSSL_Init_SSL PARAMS(( CONNECTION *c ));
73 static int ConnectAccept PARAMS(( CONNECTION *c, bool connect ));
74 static int ConnSSL_HandleError PARAMS(( CONNECTION *c, const int code, const char *fname ));
77 static char * openreadclose(const char *name, size_t *len)
82 int fd = open(name, O_RDONLY);
84 Log(LOG_ERR, "Could not open %s: %s", name, strerror(errno));
88 Log(LOG_ERR, "Could not fstat %s: %s", name, strerror(errno));
91 if (!S_ISREG(s.st_mode)) {
92 Log(LOG_ERR, "%s: Not a regular file", name);
96 Log(LOG_ERR, "%s: invalid file length (size %ld <= 0)", name, (long) s.st_size);
99 buf = malloc(s.st_size);
101 Log(LOG_ERR, "Could not malloc %lu bytes for file %s: %s", s.st_size, name, strerror(errno));
104 br = read(fd, buf, s.st_size);
105 if (br != (ssize_t)s.st_size) {
106 Log(LOG_ERR, "Could not read file %s: read returned %ld, expected %ld: %s",
107 name, (long) br, (long) s.st_size, br == -1 ? strerror(errno):"short read?!");
108 memset(buf, 0, s.st_size);
123 * Log OpenSSL error message.
125 * @param msg The error message.
126 * @param info Additional information text or NULL.
129 LogOpenSSLError(const char *error, const char *info)
131 unsigned long err = ERR_get_error();
133 ? ERR_error_string(err, NULL)
134 : "Unable to determine error";
136 assert(error != NULL);
139 Log(LOG_ERR, "%s: %s (%s)", error, info, errmsg);
141 Log(LOG_ERR, "%s: %s", error, errmsg);
146 pem_passwd_cb(char *buf, int size, int rwflag, void *password)
148 array *pass = password;
151 (void)rwflag; /* rwflag is unused if DEBUG is not set. */
152 assert(rwflag == 0); /* 0 -> callback used for decryption.
153 * See SSL_CTX_set_default_passwd_cb(3) */
155 passlen = (int) array_bytes(pass);
157 LogDebug("pem_passwd_cb buf size %d, array size %d", size, passlen);
158 assert(passlen >= 0);
160 Log(LOG_ERR, "PEM password required but not set [in pem_passwd_cb()]!");
163 size = passlen > size ? size : passlen;
164 memcpy(buf, (char *)(array_start(pass)), size);
170 Verify_openssl(UNUSED int preverify_ok, UNUSED X509_STORE_CTX *x509_ctx)
184 if (!Conf_SSLOptions.DHFile) {
185 Log(LOG_NOTICE, "Configuration option \"DHFile\" not set!");
188 fp = fopen(Conf_SSLOptions.DHFile, "r");
190 Log(LOG_ERR, "%s: %s", Conf_SSLOptions.DHFile, strerror(errno));
193 dh_params = PEM_read_DHparams(fp, NULL, NULL, NULL);
195 Log(LOG_ERR, "%s: Failed to read SSL DH parameters!",
196 Conf_SSLOptions.DHFile);
202 #ifdef HAVE_LIBGNUTLS
203 bool need_dhgenerate = true;
205 gnutls_dh_params_t tmp_dh_params;
207 err = gnutls_dh_params_init(&tmp_dh_params);
209 Log(LOG_ERR, "Failed to initialize SSL DH parameters: %s",
210 gnutls_strerror(err));
213 if (Conf_SSLOptions.DHFile) {
214 gnutls_datum_t dhparms;
216 dhparms.data = (unsigned char *) openreadclose(Conf_SSLOptions.DHFile, &size);
219 err = gnutls_dh_params_import_pkcs3(tmp_dh_params, &dhparms, GNUTLS_X509_FMT_PEM);
221 need_dhgenerate = false;
224 "Failed to initialize SSL DH parameters: %s",
225 gnutls_strerror(err));
227 memset(dhparms.data, 0, size);
231 if (need_dhgenerate) {
233 "DHFile not set, generating %u bit DH parameters. This may take a while ...",
235 err = gnutls_dh_params_generate2(tmp_dh_params, DH_BITS);
237 Log(LOG_ERR, "Failed to generate SSL DH parameters: %s",
238 gnutls_strerror(err));
242 dh_params = tmp_dh_params;
248 void ConnSSL_Free(CONNECTION *c)
251 SSL *ssl = c->ssl_state.ssl;
255 c->ssl_state.ssl = NULL;
256 if (c->ssl_state.fingerprint) {
257 free(c->ssl_state.fingerprint);
258 c->ssl_state.fingerprint = NULL;
262 #ifdef HAVE_LIBGNUTLS
263 gnutls_session_t sess = c->ssl_state.gnutls_session;
264 if (Conn_OPTION_ISSET(c, CONN_SSL)) {
265 gnutls_bye(sess, GNUTLS_SHUT_RDWR);
269 assert(Conn_OPTION_ISSET(c, CONN_SSL));
270 /* can't just set bitmask to 0 -- there are other, non-ssl related flags, e.g. CONN_ZIP. */
271 Conn_OPTION_DEL(c, CONN_SSL_FLAGS_ALL);
276 ConnSSL_InitLibrary( void )
278 if (!Conf_SSLInUse()) {
279 LogDebug("SSL not in use, skipping initialization.");
286 #if OPENSSL_API_COMPAT < 0x10100000L
289 SSL_load_error_strings();
293 if (!RAND_status()) {
294 Log(LOG_ERR, "OpenSSL PRNG not seeded: /dev/urandom missing?");
296 * it is probably best to fail and let the user install EGD or
297 * a similar program if no kernel random device is available.
298 * According to OpenSSL RAND_egd(3): "The automatic query of
299 * /var/run/egd-pool et al was added in OpenSSL 0.9.7";
300 * so it makes little sense to deal with PRNGD seeding ourselves.
302 array_free(&Conf_SSLOptions.ListenPorts);
306 newctx = SSL_CTX_new(SSLv23_method());
308 LogOpenSSLError("Failed to create SSL context", NULL);
309 array_free(&Conf_SSLOptions.ListenPorts);
313 if (!ConnSSL_LoadServerKey_openssl(newctx))
316 if (SSL_CTX_set_cipher_list(newctx, Conf_SSLOptions.CipherList) == 0) {
317 Log(LOG_ERR, "Failed to apply OpenSSL cipher list \"%s\"!",
318 Conf_SSLOptions.CipherList);
322 SSL_CTX_set_session_id_context(newctx, (unsigned char *)"ngircd", 6);
323 SSL_CTX_set_options(newctx, SSL_OP_SINGLE_DH_USE|SSL_OP_NO_SSLv2);
324 SSL_CTX_set_mode(newctx, SSL_MODE_ENABLE_PARTIAL_WRITE);
325 SSL_CTX_set_verify(newctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE,
327 SSL_CTX_free(ssl_ctx);
329 Log(LOG_INFO, "%s initialized.", SSLeay_version(SSLEAY_VERSION));
332 SSL_CTX_free(newctx);
333 array_free(&Conf_SSLOptions.ListenPorts);
336 #ifdef HAVE_LIBGNUTLS
338 static bool initialized;
341 /* TODO: cannot reload gnutls keys: can't simply free x509
342 * context -- it may still be in use */
346 err = gnutls_global_init();
348 Log(LOG_ERR, "Failed to initialize GnuTLS: %s",
349 gnutls_strerror(err));
353 if (!ConnSSL_LoadServerKey_gnutls())
356 if (gnutls_priority_init(&priorities_cache, Conf_SSLOptions.CipherList,
357 NULL) != GNUTLS_E_SUCCESS) {
359 "Failed to apply GnuTLS cipher list \"%s\"!",
360 Conf_SSLOptions.CipherList);
364 Log(LOG_INFO, "GnuTLS %s initialized.", gnutls_check_version(NULL));
368 array_free(&Conf_SSLOptions.ListenPorts);
374 #ifdef HAVE_LIBGNUTLS
376 ConnSSL_LoadServerKey_gnutls(void)
379 const char *cert_file;
381 err = gnutls_certificate_allocate_credentials(&x509_cred);
383 Log(LOG_ERR, "Failed to allocate certificate credentials: %s",
384 gnutls_strerror(err));
388 cert_file = Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile:Conf_SSLOptions.KeyFile;
390 Log(LOG_ERR, "No SSL server key configured!");
394 if (array_bytes(&Conf_SSLOptions.KeyFilePassword))
396 "Ignoring SSL \"KeyFilePassword\": Not supported by GnuTLS.");
398 if (!Load_DH_params())
401 gnutls_certificate_set_dh_params(x509_cred, dh_params);
402 err = gnutls_certificate_set_x509_key_file(x509_cred, cert_file, Conf_SSLOptions.KeyFile, GNUTLS_X509_FMT_PEM);
405 "Failed to set certificate key file (cert %s, key %s): %s",
407 Conf_SSLOptions.KeyFile ? Conf_SSLOptions.KeyFile : "(NULL)",
408 gnutls_strerror(err));
418 ConnSSL_LoadServerKey_openssl(SSL_CTX *ctx)
423 if (!Conf_SSLOptions.KeyFile) {
424 Log(LOG_ERR, "No SSL server key configured!");
428 SSL_CTX_set_default_passwd_cb(ctx, pem_passwd_cb);
429 SSL_CTX_set_default_passwd_cb_userdata(ctx, &Conf_SSLOptions.KeyFilePassword);
431 if (SSL_CTX_use_PrivateKey_file(ctx, Conf_SSLOptions.KeyFile, SSL_FILETYPE_PEM) != 1) {
432 array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
433 LogOpenSSLError("Failed to add private key", Conf_SSLOptions.KeyFile);
437 cert_key = Conf_SSLOptions.CertFile ? Conf_SSLOptions.CertFile:Conf_SSLOptions.KeyFile;
438 if (SSL_CTX_use_certificate_chain_file(ctx, cert_key) != 1) {
439 array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
440 LogOpenSSLError("Failed to load certificate chain", cert_key);
444 array_free_wipe(&Conf_SSLOptions.KeyFilePassword);
446 if (!SSL_CTX_check_private_key(ctx)) {
447 LogOpenSSLError("Server private key does not match certificate", NULL);
450 if (Load_DH_params()) {
451 if (SSL_CTX_set_tmp_dh(ctx, dh_params) != 1)
452 LogOpenSSLError("Error setting DH parameters", Conf_SSLOptions.DHFile);
453 /* don't return false here: the non-DH modes will still work */
463 ConnSSL_Init_SSL(CONNECTION *c)
467 LogDebug("Initializing SSL ...");
473 "Can't initialize SSL context, OpenSSL initialization failed at startup!");
476 assert(c->ssl_state.ssl == NULL);
477 assert(c->ssl_state.fingerprint == NULL);
479 c->ssl_state.ssl = SSL_new(ssl_ctx);
480 if (!c->ssl_state.ssl) {
481 LogOpenSSLError("Failed to create SSL structure", NULL);
484 Conn_OPTION_ADD(c, CONN_SSL);
486 ret = SSL_set_fd(c->ssl_state.ssl, c->sock);
488 LogOpenSSLError("Failed to set SSL file descriptor", NULL);
493 #ifdef HAVE_LIBGNUTLS
494 Conn_OPTION_ADD(c, CONN_SSL);
495 ret = gnutls_priority_set(c->ssl_state.gnutls_session, priorities_cache);
496 if (ret != GNUTLS_E_SUCCESS) {
497 Log(LOG_ERR, "Failed to set GnuTLS session priorities: %s",
498 gnutls_strerror(ret));
503 * The intermediate (long) cast is here to avoid a warning like:
504 * "cast to pointer from integer of different size" on 64-bit platforms.
505 * There doesn't seem to be an alternate GNUTLS API we could use instead, see e.g.
506 * http://www.mail-archive.com/help-gnutls@gnu.org/msg00286.html
508 gnutls_transport_set_ptr(c->ssl_state.gnutls_session,
509 (gnutls_transport_ptr_t) (long) c->sock);
510 gnutls_certificate_server_set_request(c->ssl_state.gnutls_session,
511 GNUTLS_CERT_REQUEST);
512 ret = gnutls_credentials_set(c->ssl_state.gnutls_session,
513 GNUTLS_CRD_CERTIFICATE, x509_cred);
515 Log(LOG_ERR, "Failed to set SSL credentials: %s",
516 gnutls_strerror(ret));
520 gnutls_dh_set_prime_bits(c->ssl_state.gnutls_session, DH_BITS_MIN);
527 ConnSSL_PrepareConnect(CONNECTION *c, UNUSED CONF_SERVER *s)
530 #ifdef HAVE_LIBGNUTLS
533 err = gnutls_init(&c->ssl_state.gnutls_session, GNUTLS_CLIENT);
535 Log(LOG_ERR, "Failed to initialize new SSL session: %s",
536 gnutls_strerror(err));
540 ret = ConnSSL_Init_SSL(c);
543 Conn_OPTION_ADD(c, CONN_SSL_CONNECT);
545 assert(c->ssl_state.ssl);
546 SSL_set_verify(c->ssl_state.ssl, SSL_VERIFY_NONE, NULL);
553 * Check and handle error return codes after failed calls to SSL functions.
556 * SSL_connect(), SSL_accept(), SSL_do_handshake(), SSL_read(), SSL_peek(), or
557 * SSL_write() on ssl.
560 * gnutlsssl_read(), gnutls_write() or gnutls_handshake().
562 * @param c The connection handle.
563 * @prarm code The return code.
564 * @param fname The name of the function in which the error occurred.
565 * @return -1 on fatal errors, 0 if we can try again later.
568 ConnSSL_HandleError(CONNECTION * c, const int code, const char *fname)
571 int ret = SSL_ERROR_SYSCALL;
572 unsigned long sslerr;
573 int real_errno = errno;
575 ret = SSL_get_error(c->ssl_state.ssl, code);
578 case SSL_ERROR_WANT_READ:
579 io_event_del(c->sock, IO_WANTWRITE);
580 Conn_OPTION_ADD(c, CONN_SSL_WANT_READ);
581 return 0; /* try again later */
582 case SSL_ERROR_WANT_WRITE:
583 io_event_del(c->sock, IO_WANTREAD);
584 Conn_OPTION_ADD(c, CONN_SSL_WANT_WRITE); /* fall through */
586 return 0; /* try again later */
587 case SSL_ERROR_ZERO_RETURN:
588 LogDebug("SSL connection shut down normally.");
590 case SSL_ERROR_SYSCALL:
591 /* SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT,
592 * and SSL_ERROR_WANT_X509_LOOKUP */
593 sslerr = ERR_get_error();
595 Log(LOG_ERR, "SSL error: %s [in %s()]!",
596 ERR_error_string(sslerr, NULL), fname);
598 switch (code) { /* EOF that violated protocol */
601 "SSL error, client disconnected [in %s()]!",
604 case -1: /* low level socket I/O error, check errno */
605 Log(LOG_ERR, "SSL error: %s [in %s()]!",
606 strerror(real_errno), fname);
611 LogOpenSSLError("SSL protocol error", fname);
614 Log(LOG_ERR, "Unknown SSL error %d [in %s()]!", ret, fname);
619 #ifdef HAVE_LIBGNUTLS
622 case GNUTLS_E_INTERRUPTED:
623 if (gnutls_record_get_direction(c->ssl_state.gnutls_session)) {
624 Conn_OPTION_ADD(c, CONN_SSL_WANT_WRITE);
625 io_event_del(c->sock, IO_WANTREAD);
627 Conn_OPTION_ADD(c, CONN_SSL_WANT_READ);
628 io_event_del(c->sock, IO_WANTWRITE);
633 if (gnutls_error_is_fatal(code)) {
634 Log(LOG_ERR, "SSL error: %s [%s].",
635 gnutls_strerror(code), fname);
646 ConnSSL_LogCertInfo( CONNECTION *c )
649 SSL *ssl = c->ssl_state.ssl;
653 Log(LOG_INFO, "Connection %d: initialized %s using cipher %s.",
654 c->sock, SSL_get_version(ssl), SSL_get_cipher(ssl));
656 #ifdef HAVE_LIBGNUTLS
657 gnutls_session_t sess = c->ssl_state.gnutls_session;
658 gnutls_cipher_algorithm_t cipher = gnutls_cipher_get(sess);
660 Log(LOG_INFO, "Connection %d: initialized %s using cipher %s-%s.",
662 gnutls_protocol_get_name(gnutls_protocol_get_version(sess)),
663 gnutls_cipher_get_name(cipher),
664 gnutls_mac_get_name(gnutls_mac_get(sess)));
670 Accept incoming SSL connection.
672 1: SSL Connection established
674 -1: SSL Connection not established due to fatal error.
677 ConnSSL_Accept( CONNECTION *c )
680 if (!Conn_OPTION_ISSET(c, CONN_SSL)) {
681 #ifdef HAVE_LIBGNUTLS
682 int err = gnutls_init(&c->ssl_state.gnutls_session, GNUTLS_SERVER);
684 Log(LOG_ERR, "Failed to initialize new SSL session: %s",
685 gnutls_strerror(err));
689 if (!ConnSSL_Init_SSL(c))
692 return ConnectAccept(c, false );
697 ConnSSL_Connect( CONNECTION *c )
701 assert(c->ssl_state.ssl);
703 assert(Conn_OPTION_ISSET(c, CONN_SSL));
704 return ConnectAccept(c, true);
708 ConnSSL_InitCertFp( CONNECTION *c )
710 const char hex[] = "0123456789abcdef";
714 unsigned char digest[EVP_MAX_MD_SIZE];
715 unsigned int digest_size;
718 cert = SSL_get_peer_certificate(c->ssl_state.ssl);
722 if (!X509_digest(cert, EVP_sha256(), digest, &digest_size)) {
728 #endif /* HAVE_LIBSSL */
729 #ifdef HAVE_LIBGNUTLS
730 gnutls_x509_crt_t cert;
731 unsigned int cert_list_size;
732 const gnutls_datum_t *cert_list;
733 unsigned char digest[MAX_HASH_SIZE];
736 if (gnutls_certificate_type_get(c->ssl_state.gnutls_session) !=
740 if (gnutls_x509_crt_init(&cert) != GNUTLS_E_SUCCESS)
744 cert_list = gnutls_certificate_get_peers(c->ssl_state.gnutls_session,
747 gnutls_x509_crt_deinit(cert);
751 if (gnutls_x509_crt_import(cert, &cert_list[0],
752 GNUTLS_X509_FMT_DER) != GNUTLS_E_SUCCESS) {
753 gnutls_x509_crt_deinit(cert);
757 digest_size = sizeof(digest);
758 if (gnutls_x509_crt_get_fingerprint(cert, GNUTLS_DIG_SHA256, digest,
760 gnutls_x509_crt_deinit(cert);
764 gnutls_x509_crt_deinit(cert);
765 #endif /* HAVE_LIBGNUTLS */
767 assert(c->ssl_state.fingerprint == NULL);
769 c->ssl_state.fingerprint = malloc(SHA256_STRING_LEN);
770 if (!c->ssl_state.fingerprint)
773 for (i = 0; i < (int)digest_size; i++) {
774 c->ssl_state.fingerprint[i * 2] = hex[digest[i] / 16];
775 c->ssl_state.fingerprint[i * 2 + 1] = hex[digest[i] % 16];
777 c->ssl_state.fingerprint[i * 2] = '\0';
782 /* accept/connect wrapper. if connect is true, connect to peer, otherwise wait for incoming connection */
784 ConnectAccept( CONNECTION *c, bool connect)
788 SSL *ssl = c->ssl_state.ssl;
791 ret = connect ? SSL_connect(ssl) : SSL_accept(ssl);
793 return ConnSSL_HandleError(c, ret, connect ? "SSL_connect": "SSL_accept");
795 #ifdef HAVE_LIBGNUTLS
797 ret = gnutls_handshake(c->ssl_state.gnutls_session);
799 return ConnSSL_HandleError(c, ret, "gnutls_handshake");
801 (void)ConnSSL_InitCertFp(c);
803 Conn_OPTION_DEL(c, (CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ|CONN_SSL_CONNECT));
804 ConnSSL_LogCertInfo(c);
806 Conn_StartLogin(CONNECTION2ID(c));
812 ConnSSL_Write(CONNECTION *c, const void *buf, size_t count)
816 Conn_OPTION_DEL(c, CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ);
820 bw = (ssize_t) SSL_write(c->ssl_state.ssl, buf, count);
822 #ifdef HAVE_LIBGNUTLS
823 bw = gnutls_write(c->ssl_state.gnutls_session, buf, count);
827 if (ConnSSL_HandleError( c, bw, "ConnSSL_Write") == 0)
828 errno = EAGAIN; /* try again */
834 ConnSSL_Read(CONNECTION *c, void * buf, size_t count)
838 Conn_OPTION_DEL(c, CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ);
840 br = (ssize_t) SSL_read(c->ssl_state.ssl, buf, count);
841 if (br > 0) /* on EOF we have to call ConnSSL_HandleError(), see SSL_read(3) */
844 #ifdef HAVE_LIBGNUTLS
845 br = gnutls_read(c->ssl_state.gnutls_session, buf, count);
846 if (br >= 0) /* on EOF we must _not_ call ConnSSL_HandleError, see gnutls_record_recv(3) */
849 /* error on read: switch ConnSSL_HandleError() return values -> 0 is "try again", so return -1 and set EAGAIN */
850 if (ConnSSL_HandleError(c, br, "ConnSSL_Read") == 0) {
859 ConnSSL_GetCipherInfo(CONNECTION *c, char *buf, size_t len)
863 SSL *ssl = c->ssl_state.ssl;
868 SSL_CIPHER_description(SSL_get_current_cipher(ssl), buf, len);
869 nl = strchr(buf, '\n');
874 #ifdef HAVE_LIBGNUTLS
875 if (Conn_OPTION_ISSET(c, CONN_SSL)) {
876 const char *name_cipher, *name_mac, *name_proto, *name_keyexchange;
879 gnutls_session_t sess = c->ssl_state.gnutls_session;
880 gnutls_cipher_algorithm_t cipher = gnutls_cipher_get(sess);
881 name_cipher = gnutls_cipher_get_name(cipher);
882 name_mac = gnutls_mac_get_name(gnutls_mac_get(sess));
883 keysize = gnutls_cipher_get_key_size(cipher) * 8;
884 name_proto = gnutls_protocol_get_name(gnutls_protocol_get_version(sess));
885 name_keyexchange = gnutls_kx_get_name(gnutls_kx_get(sess));
887 return snprintf(buf, len, "%s-%s%15s Kx=%s Enc=%s(%u) Mac=%s",
888 name_cipher, name_mac, name_proto, name_keyexchange, name_cipher, keysize, name_mac) > 0;
895 ConnSSL_GetCertFp(CONNECTION *c)
897 return c->ssl_state.fingerprint;
901 ConnSSL_SetCertFp(CONNECTION *c, const char *fingerprint)
904 c->ssl_state.fingerprint = strndup(fingerprint, SHA256_STRING_LEN - 1);
905 return c->ssl_state.fingerprint != NULL;
910 ConnSSL_InitLibrary(void)
915 #endif /* SSL_SUPPORT */