lib/rsp_tlscommon.c: Include sys/types.h before netinet/in.h.
[radsecproxy.git] / lib / rsp_tlscommon.c
1 /*
2  * Copyright (C) 2006-2009 Stig Venaas <venaas@uninett.no>
3  *
4  * Permission to use, copy, modify, and distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  */
8
9 #if defined HAVE_CONFIG_H
10 #include <config.h>
11 #endif
12
13 #include <sys/types.h>
14 #if defined(RADPROT_TLS) || defined(RADPROT_DTLS)
15 #include <signal.h>
16 #include <sys/socket.h>
17 #include <netinet/in.h>
18 #include <netdb.h>
19 #include <string.h>
20 #include <unistd.h>
21 #include <limits.h>
22 #ifdef SYS_SOLARIS9
23 #include <fcntl.h>
24 #endif
25 #include <sys/time.h>
26 #include <sys/select.h>
27 #include <ctype.h>
28 #include <sys/wait.h>
29 #include <arpa/inet.h>
30 #include <regex.h>
31 #include <libgen.h>
32 #include <pthread.h>
33 #include <openssl/ssl.h>
34 #include <openssl/rand.h>
35 #include <openssl/err.h>
36 #include <openssl/md5.h>
37 #include <openssl/x509v3.h>
38 #include "rsp_debug.h"
39 #include "rsp_list.h"
40 #include "rsp_hash.h"
41 #include "rsp_util.h"
42 #include "../hostport_types.h"
43 #include "../radsecproxy.h"
44
45 static struct hash *tlsconfs = NULL;
46
47 void ssl_init(void) {
48     time_t t;
49     pid_t pid;
50
51     SSL_load_error_strings();
52     SSL_library_init();
53
54     while (!RAND_status()) {
55         t = time(NULL);
56         pid = getpid();
57         RAND_seed((unsigned char *)&t, sizeof(time_t));
58         RAND_seed((unsigned char *)&pid, sizeof(pid));
59     }
60 }
61
62 static int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata) {
63     int pwdlen = strlen(userdata);
64     if (rwflag != 0 || pwdlen > size) /* not for decryption or too large */
65         return 0;
66     memcpy(buf, userdata, pwdlen);
67     return pwdlen;
68 }
69
70 static int verify_cb(int ok, X509_STORE_CTX *ctx) {
71     char *buf = NULL;
72     X509 *err_cert;
73     int err, depth;
74
75     err_cert = X509_STORE_CTX_get_current_cert(ctx);
76     err = X509_STORE_CTX_get_error(ctx);
77     depth = X509_STORE_CTX_get_error_depth(ctx);
78
79     if (depth > MAX_CERT_DEPTH) {
80         ok = 0;
81         err = X509_V_ERR_CERT_CHAIN_TOO_LONG;
82         X509_STORE_CTX_set_error(ctx, err);
83     }
84
85     if (!ok) {
86         if (err_cert)
87             buf = X509_NAME_oneline(X509_get_subject_name(err_cert), NULL, 0);
88         debug(DBG_WARN, "verify error: num=%d:%s:depth=%d:%s", err, X509_verify_cert_error_string(err), depth, buf ? buf : "");
89         free(buf);
90         buf = NULL;
91
92         switch (err) {
93         case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
94             if (err_cert) {
95                 buf = X509_NAME_oneline(X509_get_issuer_name(err_cert), NULL, 0);
96                 if (buf) {
97                     debug(DBG_WARN, "\tIssuer=%s", buf);
98                     free(buf);
99                     buf = NULL;
100                 }
101             }
102             break;
103         case X509_V_ERR_CERT_NOT_YET_VALID:
104         case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
105             debug(DBG_WARN, "\tCertificate not yet valid");
106             break;
107         case X509_V_ERR_CERT_HAS_EXPIRED:
108             debug(DBG_WARN, "Certificate has expired");
109             break;
110         case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
111             debug(DBG_WARN, "Certificate no longer valid (after notAfter)");
112             break;
113         case X509_V_ERR_NO_EXPLICIT_POLICY:
114             debug(DBG_WARN, "No Explicit Certificate Policy");
115             break;
116         }
117     }
118     return ok;
119 }
120
121 #ifdef DEBUG
122 static void ssl_info_callback(const SSL *ssl, int where, int ret) {
123     const char *s;
124     int w;
125
126     w = where & ~SSL_ST_MASK;
127
128     if (w & SSL_ST_CONNECT)
129         s = "SSL_connect";
130     else if (w & SSL_ST_ACCEPT)
131         s = "SSL_accept";
132     else
133         s = "undefined";
134
135     if (where & SSL_CB_LOOP)
136         debug(DBG_DBG, "%s:%s\n", s, SSL_state_string_long(ssl));
137     else if (where & SSL_CB_ALERT) {
138         s = (where & SSL_CB_READ) ? "read" : "write";
139         debug(DBG_DBG, "SSL3 alert %s:%s:%s\n", s, SSL_alert_type_string_long(ret), SSL_alert_desc_string_long(ret));
140     }
141     else if (where & SSL_CB_EXIT) {
142         if (ret == 0)
143             debug(DBG_DBG, "%s:failed in %s\n", s, SSL_state_string_long(ssl));
144         else if (ret < 0)
145             debug(DBG_DBG, "%s:error in %s\n", s, SSL_state_string_long(ssl));
146     }
147 }
148 #endif
149
150 static X509_VERIFY_PARAM *createverifyparams(char **poids) {
151     X509_VERIFY_PARAM *pm;
152     ASN1_OBJECT *pobject;
153     int i;
154
155     pm = X509_VERIFY_PARAM_new();
156     if (!pm)
157         return NULL;
158
159     for (i = 0; poids[i]; i++) {
160         pobject = OBJ_txt2obj(poids[i], 0);
161         if (!pobject) {
162             X509_VERIFY_PARAM_free(pm);
163             return NULL;
164         }
165         X509_VERIFY_PARAM_add0_policy(pm, pobject);
166     }
167
168     X509_VERIFY_PARAM_set_flags(pm, X509_V_FLAG_POLICY_CHECK | X509_V_FLAG_EXPLICIT_POLICY);
169     return pm;
170 }
171
172 static int tlsaddcacrl(SSL_CTX *ctx, struct tls *conf) {
173     STACK_OF(X509_NAME) *calist;
174     X509_STORE *x509_s;
175     unsigned long error;
176
177     if (!SSL_CTX_load_verify_locations(ctx, conf->cacertfile, conf->cacertpath)) {
178         while ((error = ERR_get_error()))
179             debug(DBG_ERR, "SSL: %s", ERR_error_string(error, NULL));
180         debug(DBG_ERR, "tlsaddcacrl: Error updating TLS context %s", conf->name);
181         return 0;
182     }
183
184         calist = conf->cacertfile ? SSL_load_client_CA_file(conf->cacertfile) : NULL;
185
186     if (!conf->cacertfile || calist) {
187         if (conf->cacertpath) {
188             if (!calist)
189                 calist = sk_X509_NAME_new_null();
190             if (!SSL_add_dir_cert_subjects_to_stack(calist, conf->cacertpath)) {
191                 sk_X509_NAME_free(calist);
192                 calist = NULL;
193             }
194         }
195     }
196     if (!calist) {
197         while ((error = ERR_get_error()))
198             debug(DBG_ERR, "SSL: %s", ERR_error_string(error, NULL));
199         debug(DBG_ERR, "tlsaddcacrl: Error adding CA subjects in TLS context %s", conf->name);
200         return 0;
201     }
202     ERR_clear_error(); /* add_dir_cert_subj returns errors on success */
203     SSL_CTX_set_client_CA_list(ctx, calist);
204
205     SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_cb);
206     SSL_CTX_set_verify_depth(ctx, MAX_CERT_DEPTH + 1);
207
208     if (conf->crlcheck || conf->vpm) {
209         x509_s = SSL_CTX_get_cert_store(ctx);
210         if (conf->crlcheck)
211             X509_STORE_set_flags(x509_s, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL);
212         if (conf->vpm)
213             X509_STORE_set1_param(x509_s, conf->vpm);
214     }
215
216     debug(DBG_DBG, "tlsaddcacrl: updated TLS context %s", conf->name);
217     return 1;
218 }
219
220 static SSL_CTX *tlscreatectx(uint8_t type, struct tls *conf) {
221     SSL_CTX *ctx = NULL;
222     unsigned long error;
223
224     switch (type) {
225 #ifdef RADPROT_TLS
226     case RAD_TLS:
227         ctx = SSL_CTX_new(TLSv1_method());
228         break;
229 #endif
230 #ifdef RADPROT_DTLS
231     case RAD_DTLS:
232         ctx = SSL_CTX_new(DTLSv1_method());
233         SSL_CTX_set_read_ahead(ctx, 1);
234         break;
235 #endif
236     }
237     if (!ctx) {
238         debug(DBG_ERR, "tlscreatectx: Error initialising SSL/TLS in TLS context %s", conf->name);
239         while ((error = ERR_get_error()))
240             debug(DBG_ERR, "SSL: %s", ERR_error_string(error, NULL));
241         return NULL;
242     }
243 #ifdef DEBUG
244         SSL_CTX_set_info_callback(ctx, ssl_info_callback);
245 #endif
246
247     if (conf->certkeypwd) {
248         SSL_CTX_set_default_passwd_cb_userdata(ctx, conf->certkeypwd);
249         SSL_CTX_set_default_passwd_cb(ctx, pem_passwd_cb);
250     }
251     if (conf->certfile || conf->certkeyfile) {
252         if (!SSL_CTX_use_certificate_chain_file(ctx, conf->certfile) ||
253             !SSL_CTX_use_PrivateKey_file(ctx, conf->certkeyfile, SSL_FILETYPE_PEM) ||
254             !SSL_CTX_check_private_key(ctx)) {
255             while ((error = ERR_get_error()))
256                 debug(DBG_ERR, "SSL: %s", ERR_error_string(error, NULL));
257             debug(DBG_ERR, "tlscreatectx: Error initialising SSL/TLS (certfile issues) in TLS context %s", conf->name);
258             SSL_CTX_free(ctx);
259             return NULL;
260         }
261     }
262
263     if (conf->policyoids) {
264         if (!conf->vpm) {
265             conf->vpm = createverifyparams(conf->policyoids);
266             if (!conf->vpm) {
267                 debug(DBG_ERR, "tlscreatectx: Failed to add policyOIDs in TLS context %s", conf->name);
268                 SSL_CTX_free(ctx);
269                 return NULL;
270             }
271         }
272     }
273
274     if (!tlsaddcacrl(ctx, conf)) {
275         if (conf->vpm) {
276             X509_VERIFY_PARAM_free(conf->vpm);
277             conf->vpm = NULL;
278         }
279         SSL_CTX_free(ctx);
280         return NULL;
281     }
282
283     debug(DBG_DBG, "tlscreatectx: created TLS context %s", conf->name);
284     return ctx;
285 }
286
287 struct tls *tlsgettls(char *alt1, char *alt2) {
288     struct tls *t;
289
290     t = hash_read(tlsconfs, alt1, strlen(alt1));
291     if (!t)
292         t = hash_read(tlsconfs, alt2, strlen(alt2));
293     return t;
294 }
295
296 SSL_CTX *tlsgetctx(uint8_t type, struct tls *t) {
297     struct timeval now;
298
299     if (!t)
300         return NULL;
301     gettimeofday(&now, NULL);
302
303     switch (type) {
304 #ifdef RADPROT_TLS
305     case RAD_TLS:
306         if (t->tlsexpiry && t->tlsctx) {
307             if (t->tlsexpiry < now.tv_sec) {
308                 t->tlsexpiry = now.tv_sec + t->cacheexpiry;
309                 tlsaddcacrl(t->tlsctx, t);
310             }
311         }
312         if (!t->tlsctx) {
313             t->tlsctx = tlscreatectx(RAD_TLS, t);
314             if (t->cacheexpiry)
315                 t->tlsexpiry = now.tv_sec + t->cacheexpiry;
316         }
317         return t->tlsctx;
318 #endif
319 #ifdef RADPROT_DTLS
320     case RAD_DTLS:
321         if (t->dtlsexpiry && t->dtlsctx) {
322             if (t->dtlsexpiry < now.tv_sec) {
323                 t->dtlsexpiry = now.tv_sec + t->cacheexpiry;
324                 tlsaddcacrl(t->dtlsctx, t);
325             }
326         }
327         if (!t->dtlsctx) {
328             t->dtlsctx = tlscreatectx(RAD_DTLS, t);
329             if (t->cacheexpiry)
330                 t->dtlsexpiry = now.tv_sec + t->cacheexpiry;
331         }
332         return t->dtlsctx;
333 #endif
334     }
335     return NULL;
336 }
337
338 X509 *verifytlscert(SSL *ssl) {
339     X509 *cert;
340     unsigned long error;
341
342     if (SSL_get_verify_result(ssl) != X509_V_OK) {
343         debug(DBG_ERR, "verifytlscert: basic validation failed");
344         while ((error = ERR_get_error()))
345             debug(DBG_ERR, "verifytlscert: TLS: %s", ERR_error_string(error, NULL));
346         return NULL;
347     }
348
349     cert = SSL_get_peer_certificate(ssl);
350     if (!cert)
351         debug(DBG_ERR, "verifytlscert: failed to obtain certificate");
352     return cert;
353 }
354
355 static int subjectaltnameaddr(X509 *cert, int family, struct in6_addr *addr) {
356     int loc, i, l, n, r = 0;
357     char *v;
358     X509_EXTENSION *ex;
359     STACK_OF(GENERAL_NAME) *alt;
360     GENERAL_NAME *gn;
361
362     debug(DBG_DBG, "subjectaltnameaddr");
363
364     loc = X509_get_ext_by_NID(cert, NID_subject_alt_name, -1);
365     if (loc < 0)
366         return r;
367
368     ex = X509_get_ext(cert, loc);
369     alt = X509V3_EXT_d2i(ex);
370     if (!alt)
371         return r;
372
373     n = sk_GENERAL_NAME_num(alt);
374     for (i = 0; i < n; i++) {
375         gn = sk_GENERAL_NAME_value(alt, i);
376         if (gn->type != GEN_IPADD)
377             continue;
378         r = -1;
379         v = (char *)ASN1_STRING_data(gn->d.ia5);
380         l = ASN1_STRING_length(gn->d.ia5);
381         if (((family == AF_INET && l == sizeof(struct in_addr)) || (family == AF_INET6 && l == sizeof(struct in6_addr)))
382             && !memcmp(v, &addr, l)) {
383             r = 1;
384             break;
385         }
386     }
387     GENERAL_NAMES_free(alt);
388     return r;
389 }
390
391 static int subjectaltnameregexp(X509 *cert, int type, char *exact,  regex_t *regex) {
392     int loc, i, l, n, r = 0;
393     char *s, *v;
394     X509_EXTENSION *ex;
395     STACK_OF(GENERAL_NAME) *alt;
396     GENERAL_NAME *gn;
397
398     debug(DBG_DBG, "subjectaltnameregexp");
399
400     loc = X509_get_ext_by_NID(cert, NID_subject_alt_name, -1);
401     if (loc < 0)
402         return r;
403
404     ex = X509_get_ext(cert, loc);
405     alt = X509V3_EXT_d2i(ex);
406     if (!alt)
407         return r;
408
409     n = sk_GENERAL_NAME_num(alt);
410     for (i = 0; i < n; i++) {
411         gn = sk_GENERAL_NAME_value(alt, i);
412         if (gn->type != type)
413             continue;
414         r = -1;
415         v = (char *)ASN1_STRING_data(gn->d.ia5);
416         l = ASN1_STRING_length(gn->d.ia5);
417         if (l <= 0)
418             continue;
419 #ifdef DEBUG
420         printfchars(NULL, gn->type == GEN_DNS ? "dns" : "uri", NULL, v, l);
421 #endif
422         if (exact) {
423             if (memcmp(v, exact, l))
424                 continue;
425         } else {
426             s = stringcopy((char *)v, l);
427             if (!s) {
428                 debug(DBG_ERR, "malloc failed");
429                 continue;
430             }
431             if (regexec(regex, s, 0, NULL, 0)) {
432                 free(s);
433                 continue;
434             }
435             free(s);
436         }
437         r = 1;
438         break;
439     }
440     GENERAL_NAMES_free(alt);
441     return r;
442 }
443
444 static int cnregexp(X509 *cert, char *exact, regex_t *regex) {
445     int loc, l;
446     char *v, *s;
447     X509_NAME *nm;
448     X509_NAME_ENTRY *e;
449     ASN1_STRING *t;
450
451     nm = X509_get_subject_name(cert);
452     loc = -1;
453     for (;;) {
454         loc = X509_NAME_get_index_by_NID(nm, NID_commonName, loc);
455         if (loc == -1)
456             break;
457         e = X509_NAME_get_entry(nm, loc);
458         t = X509_NAME_ENTRY_get_data(e);
459         v = (char *) ASN1_STRING_data(t);
460         l = ASN1_STRING_length(t);
461         if (l < 0)
462             continue;
463         if (exact) {
464             if (l == strlen(exact) && !strncasecmp(exact, v, l))
465                 return 1;
466         } else {
467             s = stringcopy((char *)v, l);
468             if (!s) {
469                 debug(DBG_ERR, "malloc failed");
470                 continue;
471             }
472             if (regexec(regex, s, 0, NULL, 0)) {
473                 free(s);
474                 continue;
475             }
476             free(s);
477             return 1;
478         }
479     }
480     return 0;
481 }
482
483 /* this is a bit sloppy, should not always accept match to any */
484 int certnamecheck(X509 *cert, struct list *hostports) {
485     struct list_node *entry;
486     struct hostportres *hp;
487     int r;
488     uint8_t type = 0; /* 0 for DNS, AF_INET for IPv4, AF_INET6 for IPv6 */
489     struct in6_addr addr;
490
491     for (entry = list_first(hostports); entry; entry = list_next(entry)) {
492         hp = (struct hostportres *)entry->data;
493         if (hp->prefixlen != 255) {
494             /* we disable the check for prefixes */
495             return 1;
496         }
497         if (inet_pton(AF_INET, hp->host, &addr))
498             type = AF_INET;
499         else if (inet_pton(AF_INET6, hp->host, &addr))
500             type = AF_INET6;
501         else
502             type = 0;
503
504         r = type ? subjectaltnameaddr(cert, type, &addr) : subjectaltnameregexp(cert, GEN_DNS, hp->host, NULL);
505         if (r) {
506             if (r > 0) {
507                 debug(DBG_DBG, "certnamecheck: Found subjectaltname matching %s %s", type ? "address" : "host", hp->host);
508                 return 1;
509             }
510             debug(DBG_WARN, "certnamecheck: No subjectaltname matching %s %s", type ? "address" : "host", hp->host);
511         } else {
512             if (cnregexp(cert, hp->host, NULL)) {
513                 debug(DBG_DBG, "certnamecheck: Found cn matching host %s", hp->host);
514                 return 1;
515             }
516             debug(DBG_WARN, "certnamecheck: cn not matching host %s", hp->host);
517         }
518     }
519     return 0;
520 }
521
522 int verifyconfcert(X509 *cert, struct clsrvconf *conf) {
523     if (conf->certnamecheck) {
524         if (!certnamecheck(cert, conf->hostports)) {
525             debug(DBG_WARN, "verifyconfcert: certificate name check failed");
526             return 0;
527         }
528         debug(DBG_WARN, "verifyconfcert: certificate name check ok");
529     }
530     if (conf->certcnregex) {
531         if (cnregexp(cert, NULL, conf->certcnregex) < 1) {
532             debug(DBG_WARN, "verifyconfcert: CN not matching regex");
533             return 0;
534         }
535         debug(DBG_DBG, "verifyconfcert: CN matching regex");
536     }
537     if (conf->certuriregex) {
538         if (subjectaltnameregexp(cert, GEN_URI, NULL, conf->certuriregex) < 1) {
539             debug(DBG_WARN, "verifyconfcert: subjectaltname URI not matching regex");
540             return 0;
541         }
542         debug(DBG_DBG, "verifyconfcert: subjectaltname URI matching regex");
543     }
544     return 1;
545 }
546
547 #if 0
548 int conftls_cb(struct gconffile **cf, void *arg, char *block, char *opt, char *val) {
549     struct tls *conf;
550     long int expiry = LONG_MIN;
551
552     debug(DBG_DBG, "conftls_cb called for %s", block);
553
554     conf = malloc(sizeof(struct tls));
555     if (!conf) {
556         debug(DBG_ERR, "conftls_cb: malloc failed");
557         return 0;
558     }
559     memset(conf, 0, sizeof(struct tls));
560
561     if (!getgenericconfig(cf, block,
562                           "CACertificateFile", CONF_STR, &conf->cacertfile,
563                           "CACertificatePath", CONF_STR, &conf->cacertpath,
564                           "CertificateFile", CONF_STR, &conf->certfile,
565                           "CertificateKeyFile", CONF_STR, &conf->certkeyfile,
566                           "CertificateKeyPassword", CONF_STR, &conf->certkeypwd,
567                           "CacheExpiry", CONF_LINT, &expiry,
568                           "CRLCheck", CONF_BLN, &conf->crlcheck,
569                           "PolicyOID", CONF_MSTR, &conf->policyoids,
570                           NULL
571             )) {
572         debug(DBG_ERR, "conftls_cb: configuration error in block %s", val);
573         goto errexit;
574     }
575     if (!conf->certfile || !conf->certkeyfile) {
576         debug(DBG_ERR, "conftls_cb: TLSCertificateFile and TLSCertificateKeyFile must be specified in block %s", val);
577         goto errexit;
578     }
579     if (!conf->cacertfile && !conf->cacertpath) {
580         debug(DBG_ERR, "conftls_cb: CA Certificate file or path need to be specified in block %s", val);
581         goto errexit;
582     }
583     if (expiry != LONG_MIN) {
584         if (expiry < 0) {
585             debug(DBG_ERR, "error in block %s, value of option CacheExpiry is %ld, may not be negative", val, expiry);
586             goto errexit;
587         }
588         conf->cacheexpiry = expiry;
589     }
590
591     conf->name = stringcopy(val, 0);
592     if (!conf->name) {
593         debug(DBG_ERR, "conftls_cb: malloc failed");
594         goto errexit;
595     }
596
597     if (!tlsconfs)
598         tlsconfs = hash_create();
599     if (!hash_insert(tlsconfs, val, strlen(val), conf)) {
600         debug(DBG_ERR, "conftls_cb: malloc failed");
601         goto errexit;
602     }
603     if (!tlsgetctx(RAD_TLS, conf))
604         debug(DBG_ERR, "conftls_cb: error creating ctx for TLS block %s", val);
605     debug(DBG_DBG, "conftls_cb: added TLS block %s", val);
606     return 1;
607
608 errexit:
609     free(conf->cacertfile);
610     free(conf->cacertpath);
611     free(conf->certfile);
612     free(conf->certkeyfile);
613     free(conf->certkeypwd);
614     freegconfmstr(conf->policyoids);
615     free(conf);
616     return 0;
617 }
618 #endif
619
620 int addmatchcertattr(struct clsrvconf *conf) {
621     char *v;
622     regex_t **r;
623
624     if (!strncasecmp(conf->matchcertattr, "CN:/", 4)) {
625         r = &conf->certcnregex;
626         v = conf->matchcertattr + 4;
627     } else if (!strncasecmp(conf->matchcertattr, "SubjectAltName:URI:/", 20)) {
628         r = &conf->certuriregex;
629         v = conf->matchcertattr + 20;
630     } else
631         return 0;
632     if (!*v)
633         return 0;
634     /* regexp, remove optional trailing / if present */
635     if (v[strlen(v) - 1] == '/')
636         v[strlen(v) - 1] = '\0';
637     if (!*v)
638         return 0;
639
640     *r = malloc(sizeof(regex_t));
641     if (!*r) {
642         debug(DBG_ERR, "malloc failed");
643         return 0;
644     }
645     if (regcomp(*r, v, REG_EXTENDED | REG_ICASE | REG_NOSUB)) {
646         free(*r);
647         *r = NULL;
648         debug(DBG_ERR, "failed to compile regular expression %s", v);
649         return 0;
650     }
651     return 1;
652 }
653 #else
654 /* Just to makes file non-empty, should rather avoid compiling this file when not needed */
655 static void tlsdummy() {
656 }
657 #endif
658
659 /* Local Variables: */
660 /* c-file-style: "stroustrup" */
661 /* End: */