The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
pairs.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: 999316dc17934907073d7bbfd8bbe6d851cb7d80 $
19 *
20 * @file tls/pairs.c
21 * @brief Functions to convert certificate OIDs to attribute pairs
22 *
23 * @copyright 2021 Arran Cudbard-Bell (a.cudbardb@freeradius.org)
24 */
25RCSID("$Id: 999316dc17934907073d7bbfd8bbe6d851cb7d80 $")
26USES_APPLE_DEPRECATED_API /* OpenSSL API has been deprecated by Apple */
27
28#ifdef WITH_TLS
29#define LOG_PREFIX "tls"
30
31#include <freeradius-devel/tls/openssl_user_macros.h>
32#include <freeradius-devel/util/pair.h>
33#include <freeradius-devel/server/request.h>
34#include <freeradius-devel/server/pair.h>
35#include <freeradius-devel/der/der.h>
36
37#include "attrs.h"
38#include "bio.h"
39#include "log.h"
40#include "session.h"
41#include "utils.h"
42
43#include <openssl/x509v3.h>
44#include <openssl/ssl.h>
45
47DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */
48/** Extract session pairs from the Subject Alternate Name extension
49 *
50 */
51static bool tls_session_pairs_from_san(fr_pair_list_t *pair_list, TALLOC_CTX *ctx, request_t *request, X509_EXTENSION *ext)
52{
53 GENERAL_NAMES *names = NULL;
54 int i;
56
57 if (!(names = X509V3_EXT_d2i(ext))) return false;
58
59 for (i = 0; i < sk_GENERAL_NAME_num(names); i++) {
60 GENERAL_NAME *name = sk_GENERAL_NAME_value(names, i);
61
62 switch (name->type) {
63#ifdef GEN_EMAIL
64 case GEN_EMAIL:
68 (char const *)ASN1_STRING_get0_data(name->d.rfc822Name),
69 ASN1_STRING_length(name->d.rfc822Name), true) == 0);
70 break;
71#endif /* GEN_EMAIL */
72#ifdef GEN_DNS
73 case GEN_DNS:
77 (char const *)ASN1_STRING_get0_data(name->d.dNSName),
78 ASN1_STRING_length(name->d.dNSName), true) == 0);
79 break;
80#endif /* GEN_DNS */
81#ifdef GEN_OTHERNAME
82 case GEN_OTHERNAME:
83 /* look for a MS UPN */
84 if (NID_ms_upn != OBJ_obj2nid(name->d.otherName->type_id)) break;
85
86 /* we've got a UPN - Must be ASN1-encoded UTF8 string */
87 if (name->d.otherName->value->type == V_ASN1_UTF8STRING) {
91 (char const *)ASN1_STRING_get0_data(name->d.otherName->value->value.utf8string),
92 ASN1_STRING_length(name->d.otherName->value->value.utf8string),
93 true) == 0);
94 break;
95 }
96 RWARN("Invalid UPN in Subject Alt Name (should be UTF-8)");
97 break;
98#endif /* GEN_OTHERNAME */
99 default:
100 /* XXX TODO handle other SAN types */
101 break;
102 }
103 }
104 if (names != NULL) GENERAL_NAMES_free(names);
105
106 return true;
107}
108
109/** Extract session pairs from the X509v3-CRL-Distribution-Points extension
110 *
111 */
112static bool tls_session_pairs_from_crl(fr_pair_list_t *pair_list, TALLOC_CTX *ctx, UNUSED request_t *request, X509_EXTENSION *ext)
113{
114 ASN1_STRING *s = X509_EXTENSION_get_data(ext);
115 char unsigned const *data = ASN1_STRING_get0_data(s);
116 STACK_OF(DIST_POINT) *dps;
117 DIST_POINT *dp;
118 STACK_OF(GENERAL_NAME) *names;
119 GENERAL_NAME *name;
120 fr_pair_t *vp;
121 int i, j;
122
123 if (!(dps = d2i_CRL_DIST_POINTS(NULL, &data, ASN1_STRING_length(s)))) return false;
124
125 for (i = 0; i < sk_DIST_POINT_num(dps); i++) {
126 dp = sk_DIST_POINT_value(dps, i);
127
128 /*
129 * RFC 5280 Section 4.2.1.13 says that the distpoint is optional.
130 */
131 if (!dp->distpoint) return false;
132
133 names = dp->distpoint->name.fullname;
134
135 /*
136 * We only want CRL distribution points that cover all reasons,
137 * so ignore any where reasons are set.
138 */
139 if (dp->reasons) continue;
140
141 for (j = 0; j < sk_GENERAL_NAME_num(names); j++) {
142 name = sk_GENERAL_NAME_value(names, j);
143
144 if (name->type != GEN_URI) continue;
148 (char const *)ASN1_STRING_get0_data(name->d.uniformResourceIdentifier),
149 true) == 0);
150 }
151 }
152
153 CRL_DIST_POINTS_free(dps);
154
155 return true;
156}
157
158/** Extract attributes from an X509 certificate
159 *
160 * @param[out] pair_list to copy attributes to.
161 * @param[in] ctx to allocate attributes in.
162 * @param[in] request the current request.
163 * @param[in] cert to validate.
164 * @param[in] der_decode should the certificate be parsed with the DER decoder.
165 * @return
166 * - 1 already exists.
167 * - 0 on success.
168 * - < 0 on failure.
169 */
170int fr_tls_session_pairs_from_x509_cert(fr_pair_list_t *pair_list, TALLOC_CTX *ctx, request_t *request, X509 *cert,
171#if OPENSSL_VERSION_NUMBER >= 0x30400000L
172 bool der_decode
173#else
174 UNUSED bool der_decode
175#endif
176 )
177{
178 int loc;
179 char buff[1024];
180
181 ASN1_TIME const *asn_time;
182 time_t time;
183
184 STACK_OF(X509_EXTENSION) const *ext_list = NULL;
185
186 fr_pair_t *vp = NULL;
187 ssize_t slen;
188 bool san_found = false, crl_found = false;
189
190 /*
191 * We require OpenSSL >= 3.4 to call the DER decoder due to the stack size
192 * needed to handle the recursive calls involved in certificate decoding.
193 */
194#if OPENSSL_VERSION_NUMBER >= 0x30400000L
195 if (der_decode) {
196 uint8_t *cert_der;
197 uint8_t *cd;
198 int der_len;
199 fr_der_decode_ctx_t der_ctx;
200 fr_pair_list_t tmp_list;
201
202 der_len = i2d_X509(cert, NULL);
203 if (der_len < 0) {
204 fr_tls_log(request, "Failed retrieving certificate");
205 return -1;
206 }
207 der_ctx.tmp_ctx = talloc_new(ctx);
208 cert_der = cd = talloc_array(der_ctx.tmp_ctx, uint8_t, der_len);
209 i2d_X509(cert, &cd);
210 fr_pair_list_init(&tmp_list);
211 slen = fr_der_decode_pair_dbuff(request->session_state_ctx, &tmp_list,
212 attr_der_certificate, &FR_DBUFF_TMP(cert_der, (size_t)der_len), &der_ctx);
213 talloc_free(der_ctx.tmp_ctx);
214 if (slen < 0) {
215 fr_tls_log(request, "Failed decoding certificate");
216 fr_pair_list_free(&tmp_list);
217 return -1;
218 }
219 /*
220 * Certificates are decoded in CA .. intermediate .. client sequence
221 * so, prepend each decoded one to get the client cert first.
222 */
223 fr_pair_list_prepend(&request->session_state_pairs, &tmp_list);
224 }
225#endif
226
227 /*
228 * Subject
229 */
231 if (unlikely(X509_NAME_print_ex(fr_tls_bio_dbuff_thread_local(vp, 256, 0),
232 X509_get_subject_name(cert), 0, XN_FLAG_ONELINE) < 0)) {
233 fr_tls_bio_dbuff_thread_local_clear();
234 fr_tls_log(request, "Failed retrieving certificate subject");
235 error:
237 return -1;
238 }
239 fr_pair_value_bstrdup_buffer_shallow(vp, fr_tls_bio_dbuff_thread_local_finalise_bstr(), true);
240
241 RDEBUG3("Creating attributes for \"%pV\":", fr_box_strvalue_buffer(vp->vp_strvalue));
242
243 /*
244 * Common name
245 */
246 slen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert),
247 NID_commonName, NULL, 0);
248 if (slen > 0) {
249 char *cn;
250
252 MEM(fr_pair_value_bstr_alloc(vp, &cn, (size_t)slen, true) == 0); /* Allocs \0 byte in addition to len */
253
254 slen = X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, cn, (size_t)slen + 1);
255 if (slen < 0) {
256 fr_tls_log(request, "Failed retrieving certificate common name");
257 goto error;
258 }
259 }
260
261 /*
262 * Signature
263 */
264 {
265 ASN1_BIT_STRING const *sig;
266 X509_ALGOR const *alg;
267
268 X509_get0_signature(&sig, &alg, cert);
269
272 (uint8_t const *)ASN1_STRING_get0_data(sig),
273 ASN1_STRING_length(sig), true) == 0);
274
275 OBJ_obj2txt(buff, sizeof(buff), alg->algorithm, 0);
278 }
279
280 /*
281 * Issuer
282 */
284 if (unlikely(X509_NAME_print_ex(fr_tls_bio_dbuff_thread_local(vp, 256, 0),
285 X509_get_issuer_name(cert), 0, XN_FLAG_ONELINE) < 0)) {
286 fr_tls_bio_dbuff_thread_local_clear();
287 fr_tls_log(request, "Failed retrieving certificate issuer");
288 goto error;
289 }
290 fr_pair_value_bstrdup_buffer_shallow(vp, fr_tls_bio_dbuff_thread_local_finalise_bstr(), true);
291
292 /*
293 * Serial number
294 */
295 {
296 ASN1_INTEGER const *serial = NULL;
297 unsigned char *der;
298 int len;
299
300 serial = X509_get0_serialNumber(cert);
301 if (!serial) {
302 fr_tls_log(request, "Failed retrieving certificate serial");
303 goto error;
304 }
305
306 len = i2d_ASN1_INTEGER(serial, NULL); /* get length */
308 MEM(fr_pair_value_mem_alloc(vp, &der, len, false) == 0);
309 i2d_ASN1_INTEGER(serial, &der);
310 }
311
312 /*
313 * Not valid before
314 */
315 asn_time = X509_get0_notBefore(cert);
316
317 if (fr_tls_utils_asn1time_to_epoch(&time, asn_time) < 0) {
318 RPWDEBUG("Failed parsing certificate not-before");
319 goto error;
320 }
321
323 vp->vp_date = fr_unix_time_from_time(time);
324
325 /*
326 * Not valid after
327 */
328 asn_time = X509_get0_notAfter(cert);
329
330 if (fr_tls_utils_asn1time_to_epoch(&time, asn_time) < 0) {
331 RPWDEBUG("Failed parsing certificate not-after");
332 goto error;
333 }
334
336 vp->vp_date = fr_unix_time_from_time(time);
337
338 /*
339 * Get the RFC822 Subject Alternative Name
340 */
341 loc = X509_get_ext_by_NID(cert, NID_subject_alt_name, 0);
342 if (loc >= 0) {
343 X509_EXTENSION *ext = X509_get_ext(cert, loc);
344 if (ext) san_found = tls_session_pairs_from_san(pair_list, ctx, request, ext);
345 }
346
347 loc = X509_get_ext_by_NID(cert, NID_crl_distribution_points, 0);
348 if (loc >= 0) {
349 X509_EXTENSION *ext = X509_get_ext(cert, loc);
350 if (ext) crl_found = tls_session_pairs_from_crl(pair_list, ctx, request, ext);
351 }
352
353 /*
354 * Only add extensions for the actual client certificate
355 */
356 ext_list = X509_get0_extensions(cert);
357 if (unlikely(!ext_list)) {
358 RWDEBUG("Failed retrieving extensions");
359 goto done;
360 }
361
362 /*
363 * Grab the X509 extensions, and create attributes out of them.
364 * For laziness, we reuse the OpenSSL names
365 */
366 if (sk_X509_EXTENSION_num(ext_list) > 0) {
367 int i;
368 BIO *bio;
369 fr_tls_bio_dbuff_t *bd;
370 fr_dbuff_t *in, *out;
371
372 bio = fr_tls_bio_dbuff_alloc(&bd, NULL, NULL, 257, 4097, true);
373 in = fr_tls_bio_dbuff_in(bd);
374 out = fr_tls_bio_dbuff_out(bd);
375
376 for (i = 0; i < sk_X509_EXTENSION_num(ext_list); i++) {
377 ASN1_OBJECT *obj;
378 X509_EXTENSION *ext;
379 fr_dict_attr_t const *da;
380 char *p;
381
382 ext = sk_X509_EXTENSION_value(ext_list, i);
383
384 obj = X509_EXTENSION_get_object(ext);
385
386 /*
387 * If this is extension is Subject Alternate Name have we already
388 * handled it? If not, do that now.
389 *
390 * Some certificate encodings have been observed where the SAN extension
391 * was not found by X509_get_ext_by_NID() but then seen when the list
392 * of extensions is handled here.
393 */
394 if (OBJ_obj2nid(obj) == NID_subject_alt_name) {
395 if (!san_found) san_found = tls_session_pairs_from_san(pair_list, ctx, request, ext);
396 goto again;
397 }
398
399 if (OBJ_obj2nid(obj) == NID_crl_distribution_points) {
400 if (!crl_found) crl_found = tls_session_pairs_from_crl(pair_list, ctx, request, ext);
401 goto again;
402 }
403
404 if (i2a_ASN1_OBJECT(bio, obj) <= 0) {
405 RPWDEBUG("Skipping X509 Extension (%i) conversion to attribute. "
406 "Conversion from ASN1 failed...", i);
407 again:
408 fr_tls_bio_dbuff_reset(bd);
409 continue;
410 }
411
412 if (fr_dbuff_remaining(out) == 0) goto again; /* Nothing written ? */
413
414 /*
415 * All disallowed chars get mashed to '-'
416 */
417 for (p = (char *)fr_dbuff_current(out);
418 p < (char *)fr_dbuff_end(out);
419 p++) if (!fr_dict_attr_allowed_chars[(uint8_t)*p]) *p = '-';
420
421 /*
422 * Terminate the buffer (after char replacement,
423 * so we do don't replace the \0)
424 */
425 if (unlikely(fr_dbuff_in_bytes(in, (uint8_t)'\0') <= 0)) {
426 RWDEBUG("Attribute name too long");
427 goto again;
428 }
429
431
432 fr_dbuff_set(in, fr_dbuff_current(in) - 1); /* Ensure the \0 isn't counted in remaining */
433
434 if (!da) {
435 RWDEBUG3("Skipping attribute \"%pV\": "
436 "Add a dictionary definition if you want to access it",
439 fr_strerror_clear(); /* Don't leave spurious errors from failed resolution */
440 goto again;
441 }
442
443 fr_tls_bio_dbuff_reset(bd); /* 'free' any data used */
444
445 if (X509V3_EXT_print(bio, ext, X509V3_EXT_PARSE_UNKNOWN, 0) != 1) {
446 REDEBUG("Failed extracting data for \"%s\"", da->name);
447 goto again;
448 }
449
450 MEM(vp = fr_pair_afrom_da(ctx, da));
452 NULL, true) < 0) {
453 RPWDEBUG3("Skipping: %s += \"%pV\"",
454 da->name, fr_box_strvalue_len((char *)fr_dbuff_current(out),
457 goto again;
458 }
459 fr_tls_bio_dbuff_reset(bd); /* 'free' any data used */
460
462 }
463 talloc_free(bd);
464 }
465
466done:
467 return 0;
468}
469
470static int fr_tls_extension_decode(request_t *request, fr_pair_t *container, uint8_t const *extension,
471 size_t hlen, size_t dlen, size_t total_len, fr_dict_attr_t const *da)
472{
473 size_t i,extension_len;
474 uint8_t const *data;
475
476 fr_assert((hlen == 1) || (hlen == 2));
477 fr_assert((dlen == 1) || (dlen == 2));
478
479 if (total_len < hlen) {
480 REDEBUG("Missing length in %s extension", da->name);
481 return -1;
482 }
483
484 if (hlen == 1) {
485 fr_assert(da->type == FR_TYPE_UINT8);
486 extension_len = extension[0];
487 } else {
488 fr_assert(da->type == FR_TYPE_UINT16);
489 extension_len = (extension[0] << 8) + extension[1];
490 }
491
492 if (extension_len * dlen + hlen > total_len) {
493 REDEBUG("Invalid length in %s extension", da->name);
494 return -1;
495 }
496
497 data = extension + hlen;
498
499 for (i = 0; i < extension_len; i += dlen) {
500 fr_pair_t *vp;
501
502 MEM(fr_pair_append_by_da(container, &vp, &container->vp_group, da) >= 0);
503
504 switch (dlen) {
505 case 1:
506 vp->vp_uint8= data[0];
507 break;
508
509 case 2:
510 vp->vp_uint16 = (data[0] << 8) + data[1];
511 break;
512 }
513
514 data += dlen;
515 }
516
517 return 0;
518}
519
520/** Callback to extract pairs from a Client Hello
521 *
522 */
523int fr_tls_session_client_hello_cb(SSL *ssl, UNUSED int *al, UNUSED void *arg)
524{
525 request_t *request = SSL_get_ex_data(ssl, FR_TLS_EX_INDEX_REQUEST);
526 request_t *parent = request->parent;
527 uint8_t const *ciphers, *extension;
528 int *extensions, i;
529 size_t data_size, j;
530 STACK_OF(SSL_CIPHER) *sk;
531 SSL_CIPHER const *cipher;
532 STACK_OF(SSL_CIPHER) *scsvs;
533 uint16_t tls_version = 0;
534 fr_pair_t *container, *vp;
535
537
538 container = fr_pair_find_by_da(&parent->session_state_pairs, NULL, attr_tls_client_hello);
539 if (container) return SSL_CLIENT_HELLO_SUCCESS;
540
541 MEM(container = fr_pair_afrom_da(parent->session_state_ctx, attr_tls_client_hello));
542
543 data_size = SSL_client_hello_get0_ciphers(ssl, &ciphers);
544 if (SSL_bytes_to_cipher_list(ssl, ciphers, data_size, SSL_client_hello_isv2(ssl), &sk, &scsvs) == 0) {
545 RPEDEBUG("Failed to decode cipher list");
546 fail:
547 talloc_free(container);
548 return SSL_CLIENT_HELLO_ERROR;
549 }
550
551 for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
552 fr_pair_append_by_da(container, &vp, &container->vp_group, attr_tls_client_hello_cipher);
553 cipher = sk_SSL_CIPHER_value(sk, i);
554 fr_value_box_strdup(vp, &vp->data, NULL, SSL_CIPHER_get_name(cipher), false);
555 }
556
557 sk_SSL_CIPHER_free(sk);
558 sk_SSL_CIPHER_free(scsvs);
559
560 /*
561 * Fetch the extensions and decode the ones we know about
562 * These are the ones which are returned as simple lists
563 * of values of known length which map to enum attributes.
564 */
565 if (SSL_client_hello_get1_extensions_present(ssl, &extensions, &data_size) == 0) {
566 RPEDEBUG("Failed to fetch client hello extensions");
567 goto fail;
568 }
569
570 for (j = 0; j < data_size; j++) {
571 size_t total_len;
572
573 if (SSL_client_hello_get0_ext(ssl, extensions[j], &extension, &total_len) == 0) {
574 RPDEBUG("Failed getting client hello extension %d", extensions[j]);
575 OPENSSL_free(extensions);
576 goto fail;
577 }
578
579 switch (extensions[j]) {
580 case TLSEXT_TYPE_supported_groups: /* length[2] + 2*data */
581 if (fr_tls_extension_decode(request, container, extension, 2, 2, total_len,
583 break;
584
585 case TLSEXT_TYPE_ec_point_formats: /* length[1] + data */
586 if (fr_tls_extension_decode(request, container, extension, 1, 1, total_len,
588 break;
589
590 case TLSEXT_TYPE_signature_algorithms: /* length[2] + 2*data */
591 if (fr_tls_extension_decode(request, container, extension, 2, 2, total_len,
592 attr_tls_client_hello_sig_algo) < 0) goto fail;
593 break;
594
595 case TLSEXT_TYPE_supported_versions: /* length[1] + 2*data */
596 if (fr_tls_extension_decode(request, container, extension, 1, 2, total_len,
597 attr_tls_client_hello_tls_version) < 0) goto fail;
598 break;
599
600 case TLSEXT_TYPE_psk_kex_modes: /* length[1] + data */
601 if (fr_tls_extension_decode(request, container, extension, 1, 1, total_len,
603 break;
604 }
605 }
606
607 if (extensions) OPENSSL_free(extensions);
608
609 /*
610 * This is the version being negotiated by the client, but tops at 1.2.
611 * After that the supported_versions extension is where the real value is.
612 */
613 if (tls_version == 0) {
614 fr_pair_append_by_da(container, &vp, &container->vp_group, attr_tls_client_hello_tls_version);
615 vp->vp_uint16 = SSL_client_hello_get0_legacy_version(ssl);
616 }
617
618 fr_pair_append(&parent->session_state_pairs, container);
619
620 return SSL_CLIENT_HELLO_SUCCESS;
621}
622DIAG_ON(used-but-marked-unused)
624#endif
#define USES_APPLE_DEPRECATED_API
Definition build.h:474
#define RCSID(id)
Definition build.h:487
#define DIAG_UNKNOWN_PRAGMAS
Definition build.h:460
#define DIAG_ON(_x)
Definition build.h:462
#define unlikely(_x)
Definition build.h:383
#define UNUSED
Definition build.h:317
#define DIAG_OFF(_x)
Definition build.h:461
#define fr_dbuff_current(_dbuff_or_marker)
Return the 'current' position of a dbuff or marker.
Definition dbuff.h:921
#define fr_dbuff_set(_dst, _src)
Set the 'current' position in a dbuff or marker using another dbuff or marker, a char pointer,...
Definition dbuff.h:1014
#define fr_dbuff_end(_dbuff_or_marker)
Return the current 'end' position of a dbuff or marker.
Definition dbuff.h:948
#define fr_dbuff_remaining(_dbuff_or_marker)
Return the number of bytes remaining between the dbuff or marker and the end of the buffer.
Definition dbuff.h:753
#define fr_dbuff_in_bytes(_dbuff_or_marker,...)
Copy a byte sequence into a dbuff or marker.
Definition dbuff.h:1476
#define FR_DBUFF_TMP(_start, _len_or_end)
Creates a compound literal to pass into functions which accept a dbuff.
Definition dbuff.h:524
#define MEM(x)
Definition debug.h:36
TALLOC_CTX * tmp_ctx
ctx under which temporary data will be allocated
Definition der.h:119
bool const fr_dict_attr_allowed_chars[SBUFF_CHAR_CLASS]
Characters allowed in a single dictionary attribute name.
Definition dict_util.c:64
fr_dict_attr_t const * fr_dict_attr_by_name(fr_dict_attr_err_t *err, fr_dict_attr_t const *parent, char const *attr))
Locate a fr_dict_attr_t by its name.
Definition dict_util.c:3529
static fr_slen_t in
Definition dict.h:884
talloc_free(hp)
HIDDEN fr_dict_attr_t const * attr_tls_certificate
Attribute definitions for lib curl.
Definition base.c:36
#define RWDEBUG(fmt,...)
Definition log.h:373
#define RDEBUG3(fmt,...)
Definition log.h:355
#define RWARN(fmt,...)
Definition log.h:309
#define RPDEBUG(fmt,...)
Definition log.h:358
#define RPEDEBUG(fmt,...)
Definition log.h:388
#define RPWDEBUG3(fmt,...)
Definition log.h:380
#define RPWDEBUG(fmt,...)
Definition log.h:378
#define RWDEBUG3(fmt,...)
Definition log.h:375
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject
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_serial
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_certificate_not_after
HIDDEN fr_dict_attr_t const * attr_tls_certificate_not_before
HIDDEN fr_dict_attr_t const * attr_tls_certificate_signature_algorithm
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject_alt_name_upn
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_sig_algo
HIDDEN fr_dict_attr_t const * attr_tls_certificate_common_name
HIDDEN fr_dict_attr_t const * attr_tls_certificate_issuer
HIDDEN fr_dict_attr_t const * attr_tls_certificate_x509v3_crl_distribution_points
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_client_hello_tls_version
HIDDEN fr_dict_attr_t const * attr_tls_client_hello_cipher
HIDDEN fr_dict_attr_t const * attr_tls_certificate_subject_alt_name_email
unsigned short uint16_t
@ FR_TYPE_UINT16
16 Bit unsigned integer.
@ FR_TYPE_UINT8
8 Bit unsigned integer.
long int ssize_t
unsigned char uint8_t
static size_t used
int fr_pair_append_by_da(TALLOC_CTX *ctx, fr_pair_t **out, fr_pair_list_t *list, fr_dict_attr_t const *da)
Alloc a new fr_pair_t (and append)
Definition pair.c:1471
int fr_pair_value_memdup(fr_pair_t *vp, uint8_t const *src, size_t len, bool tainted)
Copy data into an "octets" data type.
Definition pair.c:2966
int fr_pair_value_strdup(fr_pair_t *vp, char const *src, bool tainted)
Copy data into an "string" data type.
Definition pair.c:2667
int fr_pair_value_bstrdup_buffer_shallow(fr_pair_t *vp, char const *src, bool tainted)
Assign a string to a "string" type value pair.
Definition pair.c:2887
int fr_pair_value_from_str(fr_pair_t *vp, char const *value, size_t inlen, fr_sbuff_unescape_rules_t const *uerules, UNUSED bool tainted)
Convert string value to native attribute value.
Definition pair.c:2621
fr_pair_t * fr_pair_find_by_da(fr_pair_list_t const *list, fr_pair_t const *prev, fr_dict_attr_t const *da)
Find the first pair with a matching da.
Definition pair.c:707
int fr_pair_append(fr_pair_list_t *list, fr_pair_t *to_add)
Add a VP to the end of the list.
Definition pair.c:1352
fr_pair_t * fr_pair_afrom_da(TALLOC_CTX *ctx, fr_dict_attr_t const *da)
Dynamically allocate a new attribute and assign a fr_dict_attr_t.
Definition pair.c:290
void fr_pair_list_init(fr_pair_list_t *list)
Initialise a pair list header.
Definition pair.c:46
int fr_pair_value_bstrndup(fr_pair_t *vp, char const *src, size_t len, bool tainted)
Copy data into a "string" type value pair.
Definition pair.c:2816
int fr_pair_value_bstr_alloc(fr_pair_t *vp, char **out, size_t size, bool tainted)
Pre-allocate a memory buffer for a "string" type value pair.
Definition pair.c:2763
int fr_pair_value_mem_alloc(fr_pair_t *vp, uint8_t **out, size_t size, bool tainted)
Pre-allocate a memory buffer for a "octets" type value pair.
Definition pair.c:2915
ssize_t fr_der_decode_pair_dbuff(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:2410
#define fr_assert(_expr)
Definition rad_assert.h:38
#define REDEBUG(fmt,...)
static bool done
Definition radclient.c:83
static char const * name
static char buff[sizeof("18446744073709551615")+3]
Definition size_tests.c:41
fr_pair_t * vp
Stores an attribute, a value and various bits of other data.
Definition pair.h:68
static const char * names[8]
Definition time.c:584
static fr_unix_time_t fr_unix_time_from_time(time_t time)
Convert a time_t into out internal fr_unix_time_t.
Definition time.h:536
void fr_pair_list_free(fr_pair_list_t *list)
Free memory used by a valuepair list.
void fr_pair_list_prepend(fr_pair_list_t *dst, fr_pair_list_t *src)
Move a list of fr_pair_t from a temporary list to the head of a destination list.
static fr_slen_t parent
Definition pair.h:858
void fr_strerror_clear(void)
Clears all pending messages from the talloc pools.
Definition strerror.c:576
int fr_tls_utils_asn1time_to_epoch(time_t *out, ASN1_TIME const *asn1)
Convert OpenSSL's ASN1_TIME to an epoch time.
Definition utils.c:115
int fr_value_box_strdup(TALLOC_CTX *ctx, fr_value_box_t *dst, fr_dict_attr_t const *enumv, char const *src, bool tainted)
Copy a nul terminated string to a fr_value_box_t.
Definition value.c:4634
#define fr_box_strvalue_buffer(_val)
Definition value.h:312
static fr_slen_t data
Definition value.h:1340
#define fr_box_strvalue_len(_val, _len)
Definition value.h:309
static size_t char ** out
Definition value.h:1030