]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/lib/tls.c
Convert to pure GPL v2 license.
[bacula/bacula] / bacula / src / lib / tls.c
1 /*
2  * tls.c TLS support functions
3  *
4  * Author: Landon Fuller <landonf@threerings.net>
5  *
6  * Version $Id$
7  *
8  * This file was contributed to the Bacula project by Landon Fuller
9  * and Three Rings Design, Inc.
10  *
11  * Three Rings Design, Inc. has been granted a perpetual, worldwide,
12  * non-exclusive, no-charge, royalty-free, irrevocable copyright
13  * license to reproduce, prepare derivative works of, publicly
14  * display, publicly perform, sublicense, and distribute the original
15  * work contributed by Three Rings Design, Inc. and its employees to
16  * the Bacula project in source or object form.
17  *
18  * If you wish to license contributions from Three Rings Design, Inc,
19  * under an alternate open source license please contact
20  * Landon Fuller <landonf@threerings.net>.
21  */
22 /*
23    Bacula® - The Network Backup Solution
24
25    Copyright (C) 2005-2007 Free Software Foundation Europe e.V.
26
27    The main author of Bacula is Kern Sibbald, with contributions from
28    many others, a complete list can be found in the file AUTHORS.
29    This program is Free Software; you can redistribute it and/or
30    modify it under the terms of version two of the GNU General Public
31    License as published by the Free Software Foundation and included
32    in the file LICENSE.
33
34    This program is distributed in the hope that it will be useful, but
35    WITHOUT ANY WARRANTY; without even the implied warranty of
36    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37    General Public License for more details.
38
39    You should have received a copy of the GNU General Public License
40    along with this program; if not, write to the Free Software
41    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
42    02110-1301, USA.
43
44    Bacula® is a registered trademark of John Walker.
45    The licensor of Bacula is the Free Software Foundation Europe
46    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
47    Switzerland, email:ftf@fsfeurope.org.
48 */
49
50
51 #include "bacula.h"
52 #include <assert.h>
53
54 extern time_t watchdog_time;
55
56 #ifdef HAVE_TLS /* Is TLS enabled? */
57
58 #ifdef HAVE_OPENSSL /* How about OpenSSL? */
59
60 /* No anonymous ciphers, no <128 bit ciphers, no export ciphers, no MD5 ciphers */
61 #define TLS_DEFAULT_CIPHERS "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH"
62
63 /* TLS Context Structure */
64 struct TLS_Context {
65    SSL_CTX *openssl;
66    CRYPTO_PEM_PASSWD_CB *pem_callback;
67    const void *pem_userdata;
68    bool tls_enable;
69    bool tls_require;
70 };
71
72 struct TLS_Connection {
73    SSL *openssl;
74 };
75
76 /*
77  * OpenSSL certificate verification callback.
78  * OpenSSL has already performed internal certificate verification.
79  * We just report any errors that occured.
80  */
81 static int openssl_verify_peer(int ok, X509_STORE_CTX *store)
82 {
83    if (!ok) {
84       X509 *cert = X509_STORE_CTX_get_current_cert(store);
85       int depth = X509_STORE_CTX_get_error_depth(store);
86       int err = X509_STORE_CTX_get_error(store);
87       char issuer[256];
88       char subject[256];
89
90       X509_NAME_oneline(X509_get_issuer_name(cert), issuer, 256);
91       X509_NAME_oneline(X509_get_subject_name(cert), subject, 256);
92
93       Jmsg5(get_jcr_from_tid(), M_ERROR, 0, _("Error with certificate at depth: %d, issuer = %s,"
94                           " subject = %s, ERR=%d:%s\n"), depth, issuer,
95                           subject, err, X509_verify_cert_error_string(err));
96
97    }
98
99    return ok;
100 }
101
102 /* Dispatch user PEM encryption callbacks */
103 static int tls_pem_callback_dispatch (char *buf, int size, int rwflag, void *userdata)
104 {
105    TLS_CONTEXT *ctx = (TLS_CONTEXT *)userdata;
106    return (ctx->pem_callback(buf, size, ctx->pem_userdata));
107 }
108
109 /*
110  * Create a new TLS_CONTEXT instance.
111  *  Returns: Pointer to TLS_CONTEXT instance on success
112  *           NULL on failure;
113  */
114 TLS_CONTEXT *new_tls_context(const char *ca_certfile, const char *ca_certdir,
115                              const char *certfile, const char *keyfile,
116                              CRYPTO_PEM_PASSWD_CB *pem_callback,
117                              const void *pem_userdata, const char *dhfile,
118                              bool verify_peer)
119 {
120    TLS_CONTEXT *ctx;
121    BIO *bio;
122    DH *dh;
123
124    ctx = (TLS_CONTEXT *)malloc(sizeof(TLS_CONTEXT));
125
126    /* Allocate our OpenSSL TLSv1 Context */
127    ctx->openssl = SSL_CTX_new(TLSv1_method());
128
129    if (!ctx->openssl) {
130       openssl_post_errors(M_ERROR, _("Error initializing SSL context"));
131       goto err;
132    }
133
134    /* Set up pem encryption callback */
135    if (pem_callback) {
136       ctx->pem_callback = pem_callback;
137       ctx->pem_userdata = pem_userdata;
138    } else {
139       ctx->pem_callback = crypto_default_pem_callback;
140       ctx->pem_userdata = NULL;
141    }
142    SSL_CTX_set_default_passwd_cb(ctx->openssl, tls_pem_callback_dispatch);
143    SSL_CTX_set_default_passwd_cb_userdata(ctx->openssl, (void *) ctx);
144
145    /*
146     * Set certificate verification paths. This requires that at least one
147     * value be non-NULL
148     */
149    if (ca_certfile || ca_certdir) {
150       if (!SSL_CTX_load_verify_locations(ctx->openssl, ca_certfile, ca_certdir)) {
151          openssl_post_errors(M_ERROR, _("Error loading certificate verification stores"));
152          goto err;
153       }
154    } else if (verify_peer) {
155       /* At least one CA is required for peer verification */
156       Jmsg0(get_jcr_from_tid(), M_ERROR, 0, _("Either a certificate file or a directory must be"
157                          " specified as a verification store\n"));
158       goto err;
159    }
160
161    /*
162     * Load our certificate file, if available. This file may also contain a
163     * private key, though this usage is somewhat unusual.
164     */
165    if (certfile) {
166       if (!SSL_CTX_use_certificate_chain_file(ctx->openssl, certfile)) {
167          openssl_post_errors(M_ERROR, _("Error loading certificate file"));
168          goto err;
169       }
170    }
171
172    /* Load our private key. */
173    if (keyfile) {
174       if (!SSL_CTX_use_PrivateKey_file(ctx->openssl, keyfile, SSL_FILETYPE_PEM)) {
175          openssl_post_errors(M_ERROR, _("Error loading private key"));
176          goto err;
177       }
178    }
179
180    /* Load Diffie-Hellman Parameters. */
181    if (dhfile) {
182       if (!(bio = BIO_new_file(dhfile, "r"))) {
183          openssl_post_errors(M_ERROR, _("Unable to open DH parameters file"));
184          goto err;
185       }
186       dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL);
187       BIO_free(bio);
188       if (!dh) {
189          openssl_post_errors(M_ERROR, _("Unable to load DH parameters from specified file"));
190          goto err;
191       }
192       if (!SSL_CTX_set_tmp_dh(ctx->openssl, dh)) {
193          openssl_post_errors(M_ERROR, _("Failed to set TLS Diffie-Hellman parameters"));
194          DH_free(dh);
195          goto err;
196       }
197       /* Enable Single-Use DH for Ephemeral Keying */
198       SSL_CTX_set_options(ctx->openssl, SSL_OP_SINGLE_DH_USE);
199    }
200
201    if (SSL_CTX_set_cipher_list(ctx->openssl, TLS_DEFAULT_CIPHERS) != 1) {
202       Jmsg0(get_jcr_from_tid(), M_ERROR, 0,
203              _("Error setting cipher list, no valid ciphers available\n"));
204       goto err;
205    }
206
207    /* Verify Peer Certificate */
208    if (verify_peer) {
209       /* SSL_VERIFY_FAIL_IF_NO_PEER_CERT has no effect in client mode */
210       SSL_CTX_set_verify(ctx->openssl,
211                          SSL_VERIFY_PEER|SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
212                          openssl_verify_peer);
213    }
214
215    return ctx;
216
217 err:
218    /* Clean up after ourselves */
219    if(ctx->openssl) {
220       SSL_CTX_free(ctx->openssl);
221    }
222    free(ctx);
223    return NULL;
224 }
225
226 /*
227  * Free TLS_CONTEXT instance
228  */
229 void free_tls_context(TLS_CONTEXT *ctx)
230 {
231    SSL_CTX_free(ctx->openssl);
232    free(ctx);
233 }
234
235 bool get_tls_require(TLS_CONTEXT *ctx) 
236 {
237    return ctx->tls_require;
238 }
239
240 bool get_tls_enable(TLS_CONTEXT *ctx) 
241 {
242    return ctx->tls_enable;
243 }
244
245
246 /*
247  * Verifies a list of common names against the certificate
248  * commonName attribute.
249  *  Returns: true on success
250  *           false on failure
251  */
252 bool tls_postconnect_verify_cn(TLS_CONNECTION *tls, alist *verify_list)
253 {
254    SSL *ssl = tls->openssl;
255    X509 *cert;
256    X509_NAME *subject;
257    bool auth_success = false;
258    char data[256];
259
260    /* Check if peer provided a certificate */
261    if (!(cert = SSL_get_peer_certificate(ssl))) {
262       Jmsg0(get_jcr_from_tid(), M_ERROR, 0, _("Peer failed to present a TLS certificate\n"));
263       return false;
264    }
265
266    if ((subject = X509_get_subject_name(cert)) != NULL) {
267       if (X509_NAME_get_text_by_NID(subject, NID_commonName, data, sizeof(data)) > 0) {
268          char *cn;
269          /* NULL terminate data */
270          data[255] = 0;
271
272          /* Try all the CNs in the list */
273          foreach_alist(cn, verify_list) {
274             if (strcasecmp(data, cn) == 0) {
275                auth_success = true;
276             }
277          }
278       }
279    }
280
281    X509_free(cert);
282    return auth_success;
283 }
284
285 /*
286  * Verifies a peer's hostname against the subjectAltName and commonName
287  * attributes.
288  *  Returns: true on success
289  *           false on failure
290  */
291 bool tls_postconnect_verify_host(TLS_CONNECTION *tls, const char *host)
292 {
293    SSL *ssl = tls->openssl;
294    X509 *cert;
295    X509_NAME *subject;
296    bool auth_success = false;
297    int extensions;
298    char data[256];
299    int i, j;
300
301
302    /* Check if peer provided a certificate */
303    if (!(cert = SSL_get_peer_certificate(ssl))) {
304       Jmsg1(get_jcr_from_tid(), M_ERROR, 0, 
305             _("Peer %s failed to present a TLS certificate\n"), host);
306       return false;
307    }
308
309    /* Check subjectAltName extensions first */
310    if ((extensions = X509_get_ext_count(cert)) > 0) {
311       for (i = 0; i < extensions; i++) {
312          X509_EXTENSION *ext;
313          const char *extname;
314
315          ext = X509_get_ext(cert, i);
316          extname = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ext)));
317
318          if (strcmp(extname, "subjectAltName") == 0) {
319             X509V3_EXT_METHOD *method;
320             STACK_OF(CONF_VALUE) *val;
321             CONF_VALUE *nval;
322             void *extstr = NULL;
323 #if (OPENSSL_VERSION_NUMBER >= 0x0090800FL)
324             const unsigned char *ext_value_data;
325 #else
326             unsigned char *ext_value_data;
327 #endif
328
329             /* Get x509 extension method structure */
330             if (!(method = X509V3_EXT_get(ext))) {
331                break;
332             }
333
334             ext_value_data = ext->value->data;
335
336 #if (OPENSSL_VERSION_NUMBER > 0x00907000L)
337             if (method->it) {
338                /* New style ASN1 */
339
340                /* Decode ASN1 item in data */
341                extstr = ASN1_item_d2i(NULL, &ext_value_data, ext->value->length,
342                                       ASN1_ITEM_ptr(method->it));
343             } else {
344                /* Old style ASN1 */
345
346                /* Decode ASN1 item in data */
347                extstr = method->d2i(NULL, &ext_value_data, ext->value->length);
348             }
349
350 #else
351             extstr = method->d2i(NULL, &ext_value_data, ext->value->length);
352 #endif
353
354             /* Iterate through to find the dNSName field(s) */
355             val = method->i2v(method, extstr, NULL);
356
357             /* dNSName shortname is "DNS" */
358             for (j = 0; j < sk_CONF_VALUE_num(val); j++) {
359                nval = sk_CONF_VALUE_value(val, j);
360                if (strcmp(nval->name, "DNS") == 0) {
361                   if (strcasecmp(nval->value, host) == 0) {
362                      auth_success = true;
363                      goto success;
364                   }
365                }
366             }
367          }
368       }
369    }
370
371    /* Try verifying against the subject name */
372    if (!auth_success) {
373       if ((subject = X509_get_subject_name(cert)) != NULL) {
374          if (X509_NAME_get_text_by_NID(subject, NID_commonName, data, sizeof(data)) > 0) {
375             /* NULL terminate data */
376             data[255] = 0;
377             if (strcasecmp(data, host) == 0) {
378                auth_success = true;
379             }
380          }
381       }
382    }
383
384 success:
385    X509_free(cert);
386
387    return auth_success;
388 }
389
390 /*
391  * Create a new TLS_CONNECTION instance.
392  *
393  * Returns: Pointer to TLS_CONNECTION instance on success
394  *          NULL on failure;
395  */
396 TLS_CONNECTION *new_tls_connection(TLS_CONTEXT *ctx, int fd)
397 {
398    BIO *bio;
399
400    /*
401     * Create a new BIO and assign the fd.
402     * The caller will remain responsible for closing the associated fd
403     */
404    bio = BIO_new(BIO_s_socket());
405    if (!bio) {
406       /* Not likely, but never say never */
407       openssl_post_errors(M_ERROR, _("Error creating file descriptor-based BIO"));
408       return NULL; /* Nothing allocated, nothing to clean up */
409    }
410    BIO_set_fd(bio, fd, BIO_NOCLOSE);
411
412    /* Allocate our new tls connection */
413    TLS_CONNECTION *tls = (TLS_CONNECTION *)malloc(sizeof(TLS_CONNECTION));
414
415    /* Create the SSL object and attach the socket BIO */
416    if ((tls->openssl = SSL_new(ctx->openssl)) == NULL) {
417       /* Not likely, but never say never */
418       openssl_post_errors(M_ERROR, _("Error creating new SSL object"));
419       goto err;
420    }
421
422    SSL_set_bio(tls->openssl, bio, bio);
423
424    /* Non-blocking partial writes */
425    SSL_set_mode(tls->openssl, SSL_MODE_ENABLE_PARTIAL_WRITE|SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
426
427    return tls;
428
429 err:
430    /* Clean up */
431    BIO_free(bio);
432    SSL_free(tls->openssl);
433    free(tls);
434
435    return NULL;
436 }
437
438 /*
439  * Free TLS_CONNECTION instance
440  */
441 void free_tls_connection(TLS_CONNECTION *tls)
442 {
443    SSL_free(tls->openssl);
444    free(tls);
445 }
446
447 /* Does all the manual labor for tls_bsock_accept() and tls_bsock_connect() */
448 static inline bool openssl_bsock_session_start(BSOCK *bsock, bool server)
449 {
450    TLS_CONNECTION *tls = bsock->tls;
451    int err;
452    int fdmax, flags;
453    int stat = true;
454    fd_set fdset;
455    struct timeval tv;
456
457    /* Zero the fdset, we'll set our fd prior to each invocation of select() */
458    FD_ZERO(&fdset);
459    fdmax = bsock->m_fd + 1;
460
461    /* Ensure that socket is non-blocking */
462    flags = bnet_set_nonblocking(bsock);
463
464    /* start timer */
465    bsock->timer_start = watchdog_time;
466    bsock->m_timed_out = 0;
467
468    for (;;) { 
469       if (server) {
470          err = SSL_accept(tls->openssl);
471       } else {
472          err = SSL_connect(tls->openssl);
473       }
474
475       /* Handle errors */
476       switch (SSL_get_error(tls->openssl, err)) {
477       case SSL_ERROR_NONE:
478          stat = true;
479          goto cleanup;
480       case SSL_ERROR_ZERO_RETURN:
481          /* TLS connection was cleanly shut down */
482          openssl_post_errors(M_ERROR, _("Connect failure"));
483          stat = false;
484          goto cleanup;
485       case SSL_ERROR_WANT_READ:
486          /* If we timeout of a select, this will be unset */
487          FD_SET((unsigned) bsock->m_fd, &fdset);
488          /* Set our timeout */
489          tv.tv_sec = 10;
490          tv.tv_usec = 0;
491          /* Block until we can read */
492          select(fdmax, &fdset, NULL, &fdset, &tv);
493          break;
494       case SSL_ERROR_WANT_WRITE:
495          /* If we timeout of a select, this will be unset */
496          FD_SET((unsigned) bsock->m_fd, &fdset);
497          /* Set our timeout */
498          tv.tv_sec = 10;
499          tv.tv_usec = 0;
500          /* Block until we can write */
501          select(fdmax, NULL, &fdset, &fdset, &tv);
502          break;
503       default:
504          /* Socket Error Occured */
505          openssl_post_errors(M_ERROR, _("Connect failure"));
506          stat = false;
507          goto cleanup;
508       }
509
510       if (bsock->is_timed_out()) {
511          goto cleanup;
512       }
513    }
514
515 cleanup:
516    /* Restore saved flags */
517    bnet_restore_blocking(bsock, flags);
518    /* Clear timer */
519    bsock->timer_start = 0;
520
521    return stat;
522 }
523
524 /*
525  * Initiates a TLS connection with the server.
526  *  Returns: true on success
527  *           false on failure
528  */
529 bool tls_bsock_connect(BSOCK *bsock)
530 {
531    /* SSL_connect(bsock->tls) */
532    return (openssl_bsock_session_start(bsock, false));
533 }
534
535 /*
536  * Listens for a TLS connection from a client.
537  *  Returns: true on success
538  *           false on failure
539  */
540 bool tls_bsock_accept(BSOCK *bsock)
541 {
542    /* SSL_accept(bsock->tls) */
543    return (openssl_bsock_session_start(bsock, true));
544 }
545
546 /*
547  * Shutdown TLS_CONNECTION instance
548  */
549 void tls_bsock_shutdown(BSOCK *bsock)
550 {
551    /*
552     * SSL_shutdown must be called twice to fully complete the process -
553     * The first time to initiate the shutdown handshake, and the second to
554     * receive the peer's reply.
555     *
556     * However, it is valid to close the SSL connection after the initial
557     * shutdown notification is sent to the peer, without waiting for the
558     * peer's reply, as long as you do not plan to re-use that particular
559     * SSL connection object.
560     *
561     * Because we do not re-use SSL connection objects, I do not bother
562     * calling SSL_shutdown a second time.
563     *
564     * In addition, if the underlying socket is blocking, SSL_shutdown()
565     * will not return until the current stage of the shutdown process has
566     * completed or an error has occured. By setting the socket blocking
567     * we can avoid the ugly for()/switch()/select() loop.
568     */
569    int err;
570    int flags;
571
572    /* Set socket blocking for shutdown */
573    flags = bsock->set_blocking();
574
575    err = SSL_shutdown(bsock->tls->openssl);
576
577    switch (SSL_get_error(bsock->tls->openssl, err)) {
578       case SSL_ERROR_NONE:
579          break;
580       case SSL_ERROR_ZERO_RETURN:
581          /* TLS connection was shut down on us via a TLS protocol-level closure */
582          openssl_post_errors(M_ERROR, _("TLS shutdown failure."));
583          break;
584       default:
585          /* Socket Error Occured */
586          openssl_post_errors(M_ERROR, _("TLS shutdown failure."));
587          break;
588    }
589
590    /* Restore saved flags */
591    bsock->restore_blocking(flags);
592 }
593
594 /* Does all the manual labor for tls_bsock_readn() and tls_bsock_writen() */
595 static inline int openssl_bsock_readwrite(BSOCK *bsock, char *ptr, int nbytes, bool write)
596 {
597    TLS_CONNECTION *tls = bsock->tls;
598    int fdmax, flags;
599    fd_set fdset;
600    struct timeval tv;
601    int nleft = 0;
602    int nwritten = 0;
603
604    /* Zero the fdset, we'll set our fd prior to each invocation of select() */
605    FD_ZERO(&fdset);
606    fdmax = bsock->m_fd + 1;
607
608    /* Ensure that socket is non-blocking */
609    flags = bsock->set_nonblocking();
610
611    /* start timer */
612    bsock->timer_start = watchdog_time;
613    bsock->m_timed_out = 0;
614
615    nleft = nbytes;
616
617    while (nleft > 0) { 
618
619       if (write) {
620          nwritten = SSL_write(tls->openssl, ptr, nleft);
621       } else {
622          nwritten = SSL_read(tls->openssl, ptr, nleft);
623       }
624
625       /* Handle errors */
626       switch (SSL_get_error(tls->openssl, nwritten)) {
627       case SSL_ERROR_NONE:
628          nleft -= nwritten;
629          if (nleft) {
630             ptr += nwritten;
631          }
632          break;
633       case SSL_ERROR_ZERO_RETURN:
634          /* TLS connection was cleanly shut down */
635          openssl_post_errors(M_ERROR, _("TLS read/write failure."));
636          goto cleanup;
637       case SSL_ERROR_WANT_READ:
638          /* If we timeout of a select, this will be unset */
639          FD_SET((unsigned) bsock->m_fd, &fdset);
640          tv.tv_sec = 10;
641          tv.tv_usec = 0;
642          /* Block until we can read */
643          select(fdmax, &fdset, NULL, &fdset, &tv);
644          break;
645       case SSL_ERROR_WANT_WRITE:
646          /* If we timeout of a select, this will be unset */
647          FD_SET((unsigned) bsock->m_fd, &fdset);
648          tv.tv_sec = 10;
649          tv.tv_usec = 0;
650          /* Block until we can write */
651          select(fdmax, NULL, &fdset, &fdset, &tv);
652          break;
653       default:
654          /* Socket Error Occured */
655          openssl_post_errors(M_ERROR, _("TLS read/write failure."));
656          goto cleanup;
657       }
658
659       /* Everything done? */
660       if (nleft == 0) {
661          goto cleanup;
662       }
663
664       /* Timeout/Termination, let's take what we can get */
665       if (bsock->is_timed_out() || bsock->is_terminated()) {
666          goto cleanup;
667       }
668    }
669
670 cleanup:
671    /* Restore saved flags */
672    bsock->restore_blocking(flags);
673
674    /* Clear timer */
675    bsock->timer_start = 0;
676
677    return nbytes - nleft;
678 }
679
680
681 int tls_bsock_writen(BSOCK *bsock, char *ptr, int32_t nbytes) {
682    /* SSL_write(bsock->tls->openssl, ptr, nbytes) */
683    return (openssl_bsock_readwrite(bsock, ptr, nbytes, true));
684 }
685
686 int tls_bsock_readn(BSOCK *bsock, char *ptr, int32_t nbytes) {
687    /* SSL_read(bsock->tls->openssl, ptr, nbytes) */
688    return (openssl_bsock_readwrite(bsock, ptr, nbytes, false));
689 }
690
691 #else /* HAVE_OPENSSL */
692 # error No TLS implementation available.
693 #endif /* !HAVE_OPENSSL */
694
695 #else
696
697 /* Dummy routines */
698 TLS_CONTEXT *new_tls_context(const char *ca_certfile, const char *ca_certdir,
699                              const char *certfile, const char *keyfile,
700                              CRYPTO_PEM_PASSWD_CB *pem_callback,
701                              const void *pem_userdata, const char *dhfile,
702                              bool verify_peer)
703 {
704    return NULL;
705 }
706 void free_tls_context(TLS_CONTEXT *ctx) { }
707
708 void tls_bsock_shutdown(BSOCK *bsock) { }
709
710 void free_tls_connection(TLS_CONNECTION *tls) { }
711
712 bool get_tls_require(TLS_CONTEXT *ctx) 
713 {
714    return false;
715 }
716
717 bool get_tls_enable(TLS_CONTEXT *ctx) 
718 {
719    return false;
720 }
721
722 #endif /* HAVE_TLS */