The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
base.c
Go to the documentation of this file.
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
15 */
16
17/**
18 * $Id: cb5a425ae41344988a98bdce9f18a7c78003c9ac $
19 *
20 * @file src/lib/tls/base.c
21 * @brief Initialise OpenSSL
22 *
23 * @copyright 2001 hereUare Communications, Inc. (raghud@hereuare.com)
24 * @copyright 2003 Alan DeKok (aland@freeradius.org)
25 * @copyright 2006-2016 The FreeRADIUS server project
26 */
27RCSID("$Id: cb5a425ae41344988a98bdce9f18a7c78003c9ac $")
28USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */
29
30#ifdef WITH_TLS
31#define LOG_PREFIX "tls"
32
33#include "log.h"
34#include "bio.h"
35
36#include <sys/mman.h>
37#include <openssl/conf.h>
38#include <openssl/provider.h>
39
40#include <freeradius-devel/server/base.h>
41#include <freeradius-devel/tls/attrs.h>
42#include <freeradius-devel/tls/base.h>
43#include <freeradius-devel/tls/engine.h>
44#include <freeradius-devel/util/atexit.h>
45#include <freeradius-devel/util/debug.h>
46#include <freeradius-devel/util/math.h>
47#include <freeradius-devel/util/syserror.h>
48#include <freeradius-devel/util/md5.h>
49#include <freeradius-devel/util/md4.h>
50
51static uint32_t openssl_instance_count = 0;
52
53/** How big of a stack to allocate for aynsc fibres
54 */
55#define OPENSSL_ASYNC_STACK_SIZE 32768
56
57/** How big of a stack we allocate, taken from the default thread stack size
58 */
59static size_t openssl_stack_size;
60
61/** The context which holds any memory OpenSSL allocates
62 *
63 * This should be used to work around memory leaks in the OpenSSL.
64 */
65_Thread_local TALLOC_CTX *ssl_talloc_ctx;
66
67/** Used to control freeing of thread local OpenSSL resources
68 *
69 */
70static _Thread_local bool *async_pool_init;
71
72static OSSL_PROVIDER *openssl_default_provider = NULL;
73static OSSL_PROVIDER *openssl_legacy_provider = NULL;
74
75static uint32_t tls_instance_count = 0;
76
79fr_dict_t const *dict_tls;
80fr_dict_t const *dict_der;
81
82extern fr_dict_autoload_t tls_dict[];
83fr_dict_autoload_t tls_dict[] = {
84 { .out = &dict_freeradius, .proto = "freeradius" },
85 { .out = &dict_tls, .proto = "tls" },
86 { .out = &dict_der, .proto = "der" },
87
89};
90
93
94/*
95 * Certificate decoding attributes
96 */
114
121
127
135
137
143
145
146extern fr_dict_attr_autoload_t tls_dict_attr[];
147fr_dict_attr_autoload_t tls_dict_attr[] = {
148 { .out = &attr_allow_session_resumption, .name = "Allow-Session-Resumption", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
149 { .out = &attr_session_resumed, .name = "EAP-Session-Resumed", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
150
151 /*
152 * Certificate decoding attributes
153 */
154 { .out = &attr_tls_certificate, .name = "TLS-Certificate", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
155 { .out = &attr_tls_certificate_serial, .name = "TLS-Certificate.Serial", .type = FR_TYPE_OCTETS, .dict = &dict_freeradius },
156 { .out = &attr_tls_certificate_signature, .name = "TLS-Certificate.Signature", .type = FR_TYPE_OCTETS, .dict = &dict_freeradius },
157 { .out = &attr_tls_certificate_signature_algorithm, .name = "TLS-Certificate.Signature-Algorithm", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
158 { .out = &attr_tls_certificate_issuer, .name = "TLS-Certificate.Issuer", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
159 { .out = &attr_tls_certificate_not_before, .name = "TLS-Certificate.Not-Before", .type = FR_TYPE_DATE, .dict = &dict_freeradius },
160 { .out = &attr_tls_certificate_not_after, .name = "TLS-Certificate.Not-After", .type = FR_TYPE_DATE, .dict = &dict_freeradius },
161 { .out = &attr_tls_certificate_subject, .name = "TLS-Certificate.Subject", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
162 { .out = &attr_tls_certificate_common_name, .name = "TLS-Certificate.Common-Name", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
163 { .out = &attr_tls_certificate_subject_alt_name_dns, .name = "TLS-Certificate.Subject-Alt-Name-Dns", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
164 { .out = &attr_tls_certificate_subject_alt_name_email, .name = "TLS-Certificate.Subject-Alt-Name-Email", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
165 { .out = &attr_tls_certificate_subject_alt_name_upn, .name = "TLS-Certificate.Subject-Alt-Name-Upn", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
166 { .out = &attr_tls_certificate_x509v3_extended_key_usage, .name = "TLS-Certificate.X509v3-Extended-Key-Usage", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
167 { .out = &attr_tls_certificate_x509v3_subject_key_identifier, .name = "TLS-Certificate.X509v3-Subject-Key-Identifier", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
168 { .out = &attr_tls_certificate_x509v3_authority_key_identifier, .name = "TLS-Certificate.X509v3-Authority-Key-Identifier", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
169 { .out = &attr_tls_certificate_x509v3_basic_constraints, .name = "TLS-Certificate.X509v3-Basic-Constraints", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
170 { .out = &attr_tls_certificate_x509v3_crl_distribution_points, .name = "TLS-Certificate.X509v3-CRL-Distribution-Points", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
171
172 { .out = &attr_tls_certificate_chain_depth, .name = "TLS-Certificate-Chain-Depth", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
173 { .out = &attr_tls_client_error_code, .name = "TLS-Client-Error-Code", .type = FR_TYPE_UINT8, .dict = &dict_freeradius },
174 { .out = &attr_tls_ocsp_cert_valid, .name = "TLS-OCSP-Cert-Valid", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
175 { .out = &attr_tls_ocsp_next_update, .name = "TLS-OCSP-Next-Update", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
176 { .out = &attr_tls_ocsp_response, .name = "TLS-OCSP-Response", .type = FR_TYPE_OCTETS, .dict = &dict_freeradius },
177 { .out = &attr_tls_psk_identity, .name = "TLS-PSK-Identity", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
178
179 { .out = &attr_tls_session_cert_file, .name = "TLS-Session-Certificate-File", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
180 { .out = &attr_tls_session_require_client_cert, .name = "TLS-Session-Require-Client-Certificate", .type = FR_TYPE_BOOL, .dict = &dict_freeradius },
181 { .out = &attr_tls_session_cipher_suite, .name = "TLS-Session-Cipher-Suite", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
182 { .out = &attr_tls_session_version, .name = "TLS-Session-Version", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
183 { .out = &attr_tls_session_resume_type, .name = "TLS-Session-Resume-Type", .type = FR_TYPE_UINT32, .dict = &dict_freeradius },
184
185 { .out = &attr_tls_client_hello, .name = "TLS-Client-Hello", .type = FR_TYPE_TLV, .dict = &dict_freeradius },
186 { .out = &attr_tls_client_hello_tls_version, .name = "TLS-Client-Hello.TLS-Version", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
187 { .out = &attr_tls_client_hello_cipher, .name = "TLS-Client-Hello.Cipher", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
188 { .out = &attr_tls_client_hello_sig_algo, .name = "TLS-Client-Hello.Signature-Algorithm", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
189 { .out = &attr_tls_client_hello_supported_group, .name = "TLS-Client-Hello.Supported-Group", .type = FR_TYPE_UINT16, .dict = &dict_freeradius },
190 { .out = &attr_tls_client_hello_ec_point_format, .name = "TLS-Client-Hello.EC-Point-Format", .type = FR_TYPE_UINT8, .dict = &dict_freeradius },
191 { .out = &attr_tls_client_hello_psk_key_mode, .name = "TLS-Client-Hello.PSK-Key-Mode", .type = FR_TYPE_UINT8, .dict = &dict_freeradius },
192
193 { .out = &attr_module_failure_message, .name = "Module-Failure-Message", .type = FR_TYPE_STRING, .dict = &dict_freeradius },
194
195 /*
196 * Eventually all TLS attributes will be in the TLS dictionary
197 */
198 { .out = &attr_tls_packet_type, .name = "Packet-Type", .type = FR_TYPE_UINT32, .dict = &dict_tls },
199 { .out = &attr_tls_session_data, .name = "Session-Data", .type = FR_TYPE_OCTETS, .dict = &dict_tls },
200 { .out = &attr_tls_session_id, .name = "Session-Id", .type = FR_TYPE_OCTETS, .dict = &dict_tls },
201 { .out = &attr_tls_session_resumed, .name = "Session-Resumed", .type = FR_TYPE_BOOL, .dict = &dict_tls },
202 { .out = &attr_tls_session_ttl, .name = "Session-TTL", .type = FR_TYPE_TIME_DELTA, .dict = &dict_tls },
203
204 { .out = &attr_der_certificate, .name = "Certificate", .type = FR_TYPE_TLV, .dict = &dict_der },
205
207};
208
209/*
210 * request types
211 */
218
219/*
220 * response types
221 */
225
226/*
227 * session resumption
228 */
231
232extern fr_dict_enum_autoload_t tls_dict_enum[];
233fr_dict_enum_autoload_t tls_dict_enum[] = {
234 { .out = &enum_tls_packet_type_load_session, .name = "Load-Session", .attr = &attr_tls_packet_type },
235 { .out = &enum_tls_packet_type_store_session, .name = "Store-Session", .attr = &attr_tls_packet_type },
236 { .out = &enum_tls_packet_type_clear_session, .name = "Clear-Session", .attr = &attr_tls_packet_type },
237 { .out = &enum_tls_packet_type_verify_certificate, .name = "Verify-Certificate", .attr = &attr_tls_packet_type },
238 { .out = &enum_tls_packet_type_new_session, .name = "New-Session", .attr = &attr_tls_packet_type },
239 { .out = &enum_tls_packet_type_establish_session, .name = "Establish-Session", .attr = &attr_tls_packet_type },
240
241 { .out = &enum_tls_packet_type_success, .name = "Success", .attr = &attr_tls_packet_type },
242 { .out = &enum_tls_packet_type_failure, .name = "Failure", .attr = &attr_tls_packet_type },
243 { .out = &enum_tls_packet_type_notfound, .name = "Notfound", .attr = &attr_tls_packet_type },
244
245 { .out = &enum_tls_session_resumed_stateful, .name = "stateful", .attr = &attr_tls_session_resume_type },
246 { .out = &enum_tls_session_resumed_stateless, .name = "stateless", .attr = &attr_tls_session_resume_type },
247
249};
250
251/*
252 * Updated by threads.c in the server, and left alone for everyone else.
253 */
254int fr_tls_max_threads = 1;
255
256/** Allocate memory for OpenSSL in the NULL context
257 *
258 * @param len to alloc.
259 * @return realloc.
260 */
261static void *fr_openssl_talloc(size_t len, char const *file, NDEBUG_UNUSED int line)
262{
263 static char const *async_file;
264 void *chunk;
265
266 if (!file) {
267 chunk = talloc_array(ssl_talloc_ctx, uint8_t, len);
268
269#ifndef NDEBUG
270 talloc_set_name(chunk, "fr_openssl_talloc");
271#endif
272 return chunk;
273 }
274
275 /*
276 * Cache the filename pointer for the async_posix.c
277 * source file, so we can figure out when we're
278 * being asked for stack memory.
279 *
280 * This is terrible, we're basically guessing at the
281 * stack size. OpenSSL 3.1.0 will have proper
282 * allocation functions so we can something more
283 * sensible.
284 */
285 if (!async_file) {
286 char const *sep;
287
288 sep = strrchr(file, '/');
289 if (!sep) {
290 sep = file;
291 } else {
292 sep++;
293 }
294 if (strcmp(sep, "async_posix.c") == 0) {
295 async_file = file;
296 alloc_stack:
297 len *= 4;
298 }
299 } else if (file == async_file) goto alloc_stack;
300
301 chunk = talloc_array(ssl_talloc_ctx, uint8_t, len);
302#ifndef NDEBUG
303 talloc_set_name(chunk, "%s:%d", file, line);
304#endif
305 return chunk;
306}
307
308/** Reallocate memory for OpenSSL in the NULL context
309 *
310 * @param old memory to realloc.
311 * @param len to extend to.
312 * @return realloced memory.
313 */
314static void *fr_openssl_talloc_realloc(void *old, size_t len, NDEBUG_UNUSED char const *file, NDEBUG_UNUSED int line)
315{
316 void *chunk;
317
318 chunk = talloc_realloc_size(ssl_talloc_ctx, old, len);
319#ifndef NDEBUG
320 talloc_set_name(chunk, "%s:%d", file, line);
321#endif
322 return chunk;
323}
324
325/** Free memory allocated by OpenSSL
326 *
327 * @param to_free memory to free.
328 */
329#ifdef NDEBUG
330/*
331 * If we're not debugging, use only the filename. Otherwise the
332 * cost of snprintf() is too large.
333 */
334static void fr_openssl_talloc_free(void *to_free, char const *file, UNUSED int line)
335{
336 (void)_talloc_free(to_free, file);
337}
338#else
339static void fr_openssl_talloc_free(void *to_free, char const *file, int line)
340{
341 char buffer[256];
342
343 snprintf(buffer, sizeof(buffer), "%s:%i", file, line);
344 (void)_talloc_free(to_free, buffer);
345}
346#endif
347
348/** Cleanup async pools if the thread exits
349 *
350 */
351static int _openssl_thread_free(void *init)
352{
353 ASYNC_cleanup_thread();
354 return talloc_free(init);
355}
356
357/** Perform thread-specific initialisation for OpenSSL
358 *
359 * Async contexts are what OpenSSL uses to track
360 *
361 * @param[in] async_pool_size_init The initial number of async contexts
362 * we keep in the pool.
363 * @param[in] async_pool_size_max The maximum number of async contexts
364 * we keep in the thread-local pool.
365 * @return
366 * - 0 on success.
367 * - -1 on failure.
368 */
369int fr_openssl_thread_init(size_t async_pool_size_init, size_t async_pool_size_max)
370{
371 /*
372 * Hack to use thread local destructor code
373 */
374 if (!async_pool_init) {
375 bool *init = talloc_zero(NULL, bool);
376
377 if (ASYNC_init_thread(async_pool_size_max, async_pool_size_init) != 1) {
378 fr_tls_log(NULL, "Failed initialising OpenSSL async context pool");
379 return -1;
380 }
381
382 fr_atexit_thread_local(async_pool_init, _openssl_thread_free, init);
383 }
384
385 return 0;
386}
387
388/** Free any memory alloced by libssl
389 *
390 * OpenSSL >= 1.1.0 uses an atexit handler to automatically free
391 * memory. However, we need to call OPENSSL_cleanup manually because
392 * some of the SSL ctx is parented to the main config which will get
393 * freed before the atexit handler, causing a segfault on exit.
394 */
395void fr_openssl_free(void)
396{
397 if (--openssl_instance_count > 0) return;
398
399 fr_tls_log_free();
400
401 fr_tls_bio_free();
402
403 fr_md5_openssl_free();
404 fr_md4_openssl_free();
405}
406
407static void _openssl_provider_free(void)
408{
409 if (openssl_default_provider && !OSSL_PROVIDER_unload(openssl_default_provider)) {
410 fr_tls_log(NULL, "Failed unloading default provider");
411 }
412 openssl_default_provider = NULL;
413
414 if (openssl_legacy_provider && !OSSL_PROVIDER_unload(openssl_legacy_provider)) {
415 fr_tls_log(NULL, "Failed unloading legacy provider");
416 }
417 openssl_legacy_provider = NULL;
418}
419
420static int fr_openssl_cleanup(UNUSED void *uctx)
421{
422 OPENSSL_cleanup();
423 return 0;
424}
425
426#if OPENSSL_VERSION_NUMBER >= 0x30400000L
427
428static void *fr_openssl_stack_alloc(size_t *len)
429{
430 void *stack;
431
432 /*
433 * Use mmap to sparsely allocate the stack
434 */
435#if defined(__linux__) || defined(__FreeBSD__)
436 stack = mmap(NULL, openssl_stack_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_STACK, -1, 0);
437#else
438 stack = mmap(NULL, openssl_stack_size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0);
439#endif
440 if (stack == MAP_FAILED) {
441 fr_tls_log(NULL, "Failed allocating OpenSSL stack: %s", fr_syserror(errno));
442 return NULL;
443 }
444 *len = openssl_stack_size;
445
446 return stack;
447}
448
449static void fr_openssl_stack_free(void *stack)
450{
451 munmap(stack, openssl_stack_size);
452}
453#endif
454
455/** Add all the default ciphers and message digests to our context.
456 *
457 * This should be called exactly once from main, before reading the main config
458 * or initialising any modules.
459 */
460int fr_openssl_init(void)
461{
462 pthread_attr_t tattr;
463
464 if (openssl_instance_count > 0) {
465 openssl_instance_count++;
466 return 0;
467 }
468
469 pthread_attr_init(&tattr);
470 if (pthread_attr_getstacksize(&tattr, &openssl_stack_size) != 0) {
471 fr_tls_log(NULL, "Failed getting stack size");
472 return -1;
473 }
474
475 /*
476 * This will only fail if memory has already been allocated
477 * by OpenSSL.
478 */
479 if (CRYPTO_set_mem_functions(fr_openssl_talloc, fr_openssl_talloc_realloc, fr_openssl_talloc_free) != 1) {
480 fr_tls_log(NULL, "Failed to set OpenSSL memory allocation functions. fr_openssl_init() called too late");
481 return -1;
482 }
483
484 /*
485 * Setup custom memory allocators for allocating greenthread
486 * stacks, so we can add guard pages.
487 */
488#if OPENSSL_VERSION_NUMBER >= 0x30400000L
489 if (ASYNC_set_mem_functions(fr_openssl_stack_alloc, fr_openssl_stack_free) != 1) {
490 fr_tls_log(NULL, "Failed to set OpenSSL async stack allocation functions");
491 return -1;
492 }
493#endif
494
495 /*
496 * NO_ATEXIT has no effect if init is done after
497 * loading providers, and we need to control the
498 * exit handler as it needs to be executed last
499 * after all the EVP_MD ctx have been called, as
500 * they may unload elements of providers once all
501 * the contexts have been cleaned up.
502 */
503 if (OPENSSL_init_ssl(OPENSSL_INIT_NO_ATEXIT | OPENSSL_INIT_LOAD_CONFIG, NULL) != 1) {
504 fr_tls_log(NULL, "Failed calling OPENSSL_init_crypto()");
505 return -1;
506 }
507
508 /*
509 * Load the default provider for most algorithms
510 */
511 openssl_default_provider = OSSL_PROVIDER_load(NULL, "default");
512 if (!openssl_default_provider) {
513 fr_tls_log(NULL, "Failed loading default provider");
514 return -1;
515 }
516
517 /*
518 * Needed for MD4
519 *
520 * https://www.openssl.org/docs/man3.0/man7/migration_guide.html#Legacy-Algorithms
521 */
522 openssl_legacy_provider = OSSL_PROVIDER_load(NULL, "legacy");
523 if (!openssl_legacy_provider) {
524 fr_tls_log(NULL, "Failed loading legacy provider");
525 return -1;
526 }
527
528 /*
529 * It's best to use OpenSSL's cleanup stack
530 * as then everything is cleaned up relative
531 * to the OPENSSL_cleanup() call.
532 */
533 OPENSSL_atexit(_openssl_provider_free);
534
535 /*
536 * SHA256 is in all versions of OpenSSL, but isn't
537 * initialized by default. It's needed for WiMAX
538 * certificates.
539 */
540 EVP_add_digest(EVP_sha256());
541
542 fr_tls_log_init();
543
544 fr_tls_bio_init();
545
546 fr_md5_openssl_init();
547 fr_md4_openssl_init();
548
549 /*
550 * Use an atexit handler to try and ensure
551 * that OpenSSL gets freed last.
552 *
553 * All EVP_*ctxs need to be freed before we
554 * de-initialise the libraries else we get
555 * crashes (at least with OpenSSL 3.0.1).
556 */
557 fr_atexit_global(fr_openssl_cleanup, NULL);
558
559 openssl_instance_count++;
560
561 return 0;
562}
563
564/** Enable or disable fips mode
565 *
566 * @param[in] enabled If true enable fips mode if false disable fips mode.
567 * @return
568 * - 0 on success.
569 * - -1 on failure
570 */
571int fr_openssl_fips_mode(bool enabled)
572{
573 if (!EVP_set_default_properties(NULL, enabled ? "fips=yes" : "-fips")) {
574 fr_tls_log(NULL, "Failed %s OpenSSL FIPS mode", enabled ? "enabling" : "disabling");
575 return -1;
576 }
577
578 /*
579 * Swap the MD4 / MD5 functions as appropriate.
580 */
581 if (enabled) {
582 fr_md5_openssl_init();
583 fr_md4_openssl_init();
584 } else {
585 fr_md5_openssl_free();
586 fr_md4_openssl_free();
587 }
588
589 return 0;
590}
591
592/** Load dictionary attributes
593 *
594 * This is a separate function because of ordering issues.
595 * OpenSSL may need to be initialised before anything else
596 * including the dictionary loader.
597 *
598 * fr_openssl_free will unload both the dictionary and the
599 * OpenSSL library.
600 */
601int fr_tls_dict_init(void)
602{
603 if (tls_instance_count > 0) {
604 tls_instance_count++;
605 return 0;
606 }
607
608 tls_instance_count++;
609
610 if (fr_dict_autoload(tls_dict) < 0) {
611 PERROR("Failed initialising protocol library");
612 fail:
613 tls_instance_count--;
614 fr_openssl_free();
615 return -1;
616 }
617
618 if (fr_dict_attr_autoload(tls_dict_attr) < 0) {
619 PERROR("Failed resolving attributes");
620 goto fail;
621 }
622
623 if (fr_dict_enum_autoload(tls_dict_enum) < 0) {
624 PERROR("Failed resolving enums");
625 goto fail;
626 }
627
628 return 0;
629}
630
631void fr_tls_dict_free(void)
632{
633 if (--tls_instance_count > 0) return;
634
635 fr_dict_autofree(tls_dict);
636}
637#endif /* WITH_TLS */
static int const char char buffer[256]
Definition acutest.h:578
int const char * file
Definition acutest.h:704
int const char int line
Definition acutest.h:704
#define fr_atexit_global(_func, _uctx)
Add a free function to the global free list.
Definition atexit.h:59
#define fr_atexit_thread_local(_name, _free, _uctx)
Definition atexit.h:221
static bool init
Definition fuzzer.c:41
#define USES_APPLE_DEPRECATED_API
Definition build.h:472
#define RCSID(id)
Definition build.h:485
#define NDEBUG_UNUSED
Definition build.h:328
#define UNUSED
Definition build.h:317
int fr_dict_enum_autoload(fr_dict_enum_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
Definition dict_util.c:4399
#define fr_dict_autofree(_to_free)
Definition dict.h:918
fr_value_box_t const ** out
Enumeration value.
Definition dict.h:282
fr_dict_attr_t const ** out
Where to write a pointer to the resolved fr_dict_attr_t.
Definition dict.h:293
fr_dict_t const ** out
Where to write a pointer to the loaded/resolved fr_dict_t.
Definition dict.h:306
int fr_dict_attr_autoload(fr_dict_attr_autoload_t const *to_load)
Process a dict_attr_autoload element to load/verify a dictionary attribute.
Definition dict_util.c:4438
#define fr_dict_autoload(_to_load)
Definition dict.h:915
#define DICT_AUTOLOAD_TERMINATOR
Definition dict.h:312
Specifies an attribute which must be present for the module to function.
Definition dict.h:292
Specifies a dictionary which must be loaded/loadable for the module to function.
Definition dict.h:305
Specifies a value which must be present for the module to function.
Definition dict.h:281
static fr_dict_t const * dict_freeradius
Definition base.c:37
fr_dict_attr_t const * attr_tls_certificate
Attribute definitions for lib curl.
Definition base.c:36
fr_dict_t const * dict_tls
Definition base.c:79
fr_dict_t const * dict_radius
Definition base.c:78
static fr_dict_attr_t const * attr_module_failure_message
Definition log.c:206
#define PERROR(_fmt,...)
Definition log.h:228
fr_value_box_t const * enum_tls_packet_type_store_session
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject
HIDDEN fr_dict_attr_t const * attr_tls_certificate_x509v3_extended_key_usage
HIDDEN fr_dict_attr_t const * attr_tls_packet_type
HIDDEN fr_dict_attr_t const * attr_tls_certificate_x509v3_authority_key_identifier
HIDDEN fr_dict_attr_t const * attr_session_resumed
fr_value_box_t const * enum_tls_packet_type_failure
HIDDEN fr_dict_attr_t const * attr_tls_session_resumed
HIDDEN fr_dict_attr_t const * attr_tls_session_version
HIDDEN fr_dict_attr_t const * attr_tls_ocsp_cert_valid
HIDDEN fr_dict_attr_t const * attr_tls_client_hello
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_psk_key_mode
HIDDEN fr_dict_attr_t const * attr_tls_certificate_x509v3_basic_constraints
fr_value_box_t const * enum_tls_packet_type_success
HIDDEN fr_dict_attr_t const * attr_tls_certificate_serial
HIDDEN fr_dict_attr_t const * attr_tls_session_require_client_cert
HIDDEN fr_dict_t const * dict_der
Definition base.c:39
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject_alt_name_dns
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_supported_group
HIDDEN fr_dict_attr_t const * attr_tls_session_ttl
fr_value_box_t const * enum_tls_session_resumed_stateful
HIDDEN fr_dict_attr_t const * attr_tls_session_data
HIDDEN fr_dict_attr_t const * attr_tls_certificate_not_after
HIDDEN fr_dict_attr_t const * attr_tls_certificate_not_before
fr_value_box_t const * enum_tls_packet_type_new_session
HIDDEN fr_dict_attr_t const * attr_tls_certificate_signature_algorithm
HIDDEN fr_dict_attr_t const * attr_tls_client_error_code
fr_value_box_t const * enum_tls_packet_type_load_session
fr_value_box_t const * enum_tls_packet_type_establish_session
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject_alt_name_upn
HIDDEN fr_dict_attr_t const * attr_tls_ocsp_response
HIDDEN fr_dict_attr_t const * attr_tls_session_id
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_sig_algo
HIDDEN fr_dict_attr_t const * attr_tls_certificate_x509v3_subject_key_identifier
fr_value_box_t const * enum_tls_packet_type_clear_session
HIDDEN fr_dict_attr_t const * attr_tls_session_cipher_suite
HIDDEN fr_dict_attr_t const * attr_tls_certificate_common_name
HIDDEN fr_dict_attr_t const * attr_tls_psk_identity
HIDDEN fr_dict_attr_t const * attr_tls_certificate_issuer
fr_value_box_t const * enum_tls_session_resumed_stateless
HIDDEN fr_dict_attr_t const * attr_tls_certificate_x509v3_crl_distribution_points
fr_value_box_t const * enum_tls_packet_type_notfound
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_ec_point_format
HIDDEN fr_dict_attr_t const * attr_der_certificate
HIDDEN fr_dict_attr_t const * attr_tls_certificate_signature
HIDDEN fr_dict_attr_t const * attr_tls_session_resume_type
HIDDEN fr_dict_attr_t const * attr_tls_ocsp_next_update
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_tls_version
fr_value_box_t const * enum_tls_packet_type_verify_certificate
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_cipher
HIDDEN fr_dict_attr_t const * attr_tls_session_cert_file
HIDDEN fr_dict_attr_t const * attr_tls_certificate_chain_depth
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject_alt_name_email
HIDDEN fr_dict_attr_t const * attr_allow_session_resumption
talloc_free(reap)
static char * stack[MAX_STACK]
Definition radmin.c:159
@ FR_TYPE_TIME_DELTA
A period of time measured in nanoseconds.
@ FR_TYPE_TLV
Contains nested attributes.
@ FR_TYPE_STRING
String of printable characters.
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_DATE
Unix time stamp, always has value >2^31.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
@ FR_TYPE_UINT32
32 Bit unsigned integer.
@ FR_TYPE_BOOL
A truth value.
@ FR_TYPE_OCTETS
Raw octets.
unsigned int uint32_t
unsigned char uint8_t
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
Definition snprintf.c:689
char const * fr_syserror(int num)
Guaranteed to be thread-safe version of strerror.
Definition syserror.c:243