The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
der.h File Reference
#include <freeradius-devel/build.h>
#include <freeradius-devel/util/value.h>
+ Include dependency graph for der.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fr_der_attr_flags_t
 
union  fr_der_attr_flags_t.__unnamed210__
 
struct  fr_der_decode_ctx_t
 

Macros

#define DER_BOOLEAN_FALSE   0x00
 DER encoded boolean false value.
 
#define DER_BOOLEAN_TRUE   0xff
 DER encoded boolean true value.
 
#define DER_GENERALIZED_TIME_LEN_MIN   15
 Minimum length of the generalized time string.
 
#define DER_GENERALIZED_TIME_PRECISION_MAX   9
 Maximum precision of the generalized time string (nanoseconds).
 
#define DER_LEN_MULTI_BYTE   0x80
 Mask to check if the length is multi-byte.
 
#define DER_MAX_STR   16384
 
#define DER_TAG_CLASS_MASK   0xc0
 Mask to extract the class from the tag.
 
#define DER_TAG_CONSTRUCTED_MASK   0x20
 Mask to check if the tag is constructed.
 
#define DER_TAG_CONTINUATION   0x1f
 Mask to check if the tag is a continuation.
 
#define DER_TAG_NUM_MASK   0x1f
 Mask to extract the tag number from the tag.
 
#define DER_UTC_TIME_LEN   13
 Length of the UTC time string.
 
#define fr_der_flag_has_none(_flags)   ((_flags)->flag_type == FR_DER_ATTR_FLAG_NONE)
 
#define fr_der_flag_has_sequence_of(_flags)   ((_flags)->flag_type == FR_DER_ATTR_FLAG_SEQUENCE_OF)
 
#define fr_der_flag_has_set_of(_flags)   ((_flags)->flag_type == FR_DER_ATTR_FLAG_SETOF)
 
#define fr_der_flag_has_shortname(_flags)   ((_flags)->flag_type == FR_DER_ATTR_FLAG_SHORTNAME)
 
#define fr_der_flag_has_value(_flags)   ((_flags)->flag_type == FR_DER_ATTR_FLAG_DEFAULT_VALUE)
 
#define FR_DER_TAG_VALUE_MAX   (0x1f)
 tags >=max can't exist
 

Enumerations

enum  fr_der_attr_flag_type_t {
  FR_DER_ATTR_FLAG_NONE = 0 ,
  FR_DER_ATTR_FLAG_SEQUENCE_OF ,
  FR_DER_ATTR_FLAG_SETOF ,
  FR_DER_ATTR_FLAG_DEFAULT_VALUE ,
  FR_DER_ATTR_FLAG_SHORTNAME
}
 Which member of the fr_der_attr_flags_t union is in use. More...
 
enum  fr_der_tag_class_t {
  FR_DER_CLASS_UNIVERSAL = 0x00 ,
  FR_DER_CLASS_APPLICATION = 0x40 ,
  FR_DER_CLASS_CONTEXT = 0x80 ,
  FR_DER_CLASS_PRIVATE = 0xC0 ,
  FR_DER_CLASS_INVALID = 0x04
}
 
enum  fr_der_tag_constructed_t {
  FR_DER_TAG_PRIMITIVE = 0x00 ,
  FR_DER_TAG_CONSTRUCTED = 0x20
}
 
enum  fr_der_tag_t {
  FR_DER_TAG_INVALID = 0x00 ,
  FR_DER_TAG_BOOLEAN = 0x01 ,
  FR_DER_TAG_INTEGER = 0x02 ,
  FR_DER_TAG_BITSTRING = 0x03 ,
  FR_DER_TAG_OCTETSTRING = 0x04 ,
  FR_DER_TAG_NULL = 0x05 ,
  FR_DER_TAG_OID = 0x06 ,
  FR_DER_TAG_ENUMERATED = 0x0a ,
  FR_DER_TAG_UTF8_STRING = 0x0c ,
  FR_DER_TAG_SEQUENCE = 0x10 ,
  FR_DER_TAG_SET = 0x11 ,
  FR_DER_TAG_PRINTABLE_STRING = 0x13 ,
  FR_DER_TAG_T61_STRING = 0x14 ,
  FR_DER_TAG_IA5_STRING = 0x16 ,
  FR_DER_TAG_UTC_TIME = 0x17 ,
  FR_DER_TAG_GENERALIZED_TIME = 0x18 ,
  FR_DER_TAG_VISIBLE_STRING = 0x1a ,
  FR_DER_TAG_GENERAL_STRING = 0x1b ,
  FR_DER_TAG_UNIVERSAL_STRING = 0x1c ,
  FR_DER_TAG_BMP_STRING = 0x1e ,
  FR_DER_TAG_CHOICE = 0x23 ,
  FR_DER_TAG_MAX = 0x24
}
 Enumeration describing the data types in a DER encoded structure. More...
 

Functions

static fr_der_tag_class_t fr_der_attr_class (fr_dict_attr_t const *da)
 
static fr_der_tag_t fr_der_attr_der_type (fr_dict_attr_t const *da)
 
static fr_der_attr_flags_t const * fr_der_attr_flags (fr_dict_attr_t const *da)
 Return DER-specific flags for a given attribute.
 
static bool fr_der_attr_has_default_value (fr_dict_attr_t const *da)
 
static bool fr_der_attr_is_choice (fr_dict_attr_t const *da)
 
static bool fr_der_attr_is_extensions (fr_dict_attr_t const *da)
 
static bool fr_der_attr_is_oid_and_value (fr_dict_attr_t const *da)
 
static bool fr_der_attr_is_sequence_of (fr_dict_attr_t const *da)
 
static bool fr_der_attr_is_set_of (fr_dict_attr_t const *da)
 
static bool fr_der_attr_leaf (fr_dict_attr_t const *da)
 
static uint64_t fr_der_attr_max (fr_dict_attr_t const *da)
 
static uint8_t fr_der_attr_option (fr_dict_attr_t const *da)
 
static bool fr_der_attr_optional (fr_dict_attr_t const *da)
 
static fr_der_tag_t fr_der_attr_sequence_of (fr_dict_attr_t const *da)
 
static fr_der_tag_t fr_der_attr_set_of (fr_dict_attr_t const *da)
 
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)
 
char const * fr_der_dict_attr_to_shortname (fr_dict_attr_t const *da)
 
void fr_der_global_free (void)
 
int fr_der_global_init (void)
 
char const * fr_der_tag_to_str (fr_der_tag_t tag)
 
bool fr_der_tags_compatible (fr_der_tag_t tag1, fr_der_tag_t tag2)
 
fr_der_tag_t fr_type_to_der_tag_default (fr_type_t type)
 
bool fr_type_to_der_tag_valid (fr_type_t type, fr_der_tag_t tag)
 

Variables

fr_dict_protocol_t libfreeradius_der_dict_protocol
 

Data Structure Documentation

◆ fr_der_attr_flags_t

struct fr_der_attr_flags_t

Definition at line 104 of file der.h.

Data Fields
union fr_der_attr_flags_t.__unnamed210__ __unnamed__
fr_der_tag_class_t class tag Class
fr_der_tag_t der_type the DER type, which is different from the FreeRADIUS type
fr_der_attr_flag_type_t flag_type: 3 which member of the union is in use
unsigned int is_choice: 1 DER name "choice".
unsigned int is_constructed: 1 for raw attributes, the data said that the value was constructed
unsigned int is_extensions: 1 a list of X.509 extensions
unsigned int is_oid_and_value: 1 is OID+value
unsigned int is_option: 1 has an option defined
unsigned int leaf: 1 encode this OID along with its value
uint64_t max maximum count of items in a sequence, set, or string.
uint8_t min mininum count
uint8_t option an "attribute number" encoded in the tag field.
unsigned int optional: 1 optional, we MUST already have set 'option'
uint32_t restrictions for choice of options and tags - no dups allowed

◆ fr_der_attr_flags_t.__unnamed210__

union fr_der_attr_flags_t.__unnamed210__

Definition at line 111 of file der.h.

Data Fields
fr_value_box_t * default_value
fr_der_tag_t sequence_of
fr_der_tag_t set_of
char const * shortname

◆ fr_der_decode_ctx_t

struct fr_der_decode_ctx_t

Definition at line 142 of file der.h.

+ Collaboration diagram for fr_der_decode_ctx_t:
Data Fields
fr_dict_attr_t const * root where to start decoding from
TALLOC_CTX * tmp_ctx ctx under which temporary data will be allocated

Macro Definition Documentation

◆ DER_BOOLEAN_FALSE

#define DER_BOOLEAN_FALSE   0x00

DER encoded boolean false value.

Definition at line 90 of file der.h.

◆ DER_BOOLEAN_TRUE

#define DER_BOOLEAN_TRUE   0xff

DER encoded boolean true value.

Definition at line 91 of file der.h.

◆ DER_GENERALIZED_TIME_LEN_MIN

#define DER_GENERALIZED_TIME_LEN_MIN   15

Minimum length of the generalized time string.

Definition at line 79 of file der.h.

◆ DER_GENERALIZED_TIME_PRECISION_MAX

#define DER_GENERALIZED_TIME_PRECISION_MAX   9

Maximum precision of the generalized time string (nanoseconds).

Definition at line 80 of file der.h.

◆ DER_LEN_MULTI_BYTE

#define DER_LEN_MULTI_BYTE   0x80

Mask to check if the length is multi-byte.

Definition at line 88 of file der.h.

◆ DER_MAX_STR

#define DER_MAX_STR   16384

Definition at line 76 of file der.h.

◆ DER_TAG_CLASS_MASK

#define DER_TAG_CLASS_MASK   0xc0

Mask to extract the class from the tag.

Definition at line 82 of file der.h.

◆ DER_TAG_CONSTRUCTED_MASK

#define DER_TAG_CONSTRUCTED_MASK   0x20

Mask to check if the tag is constructed.

Definition at line 83 of file der.h.

◆ DER_TAG_CONTINUATION

#define DER_TAG_CONTINUATION   0x1f

Mask to check if the tag is a continuation.

Definition at line 86 of file der.h.

◆ DER_TAG_NUM_MASK

#define DER_TAG_NUM_MASK   0x1f

Mask to extract the tag number from the tag.

Definition at line 84 of file der.h.

◆ DER_UTC_TIME_LEN

#define DER_UTC_TIME_LEN   13

Length of the UTC time string.

Definition at line 78 of file der.h.

◆ fr_der_flag_has_none

#define fr_der_flag_has_none (   _flags)    ((_flags)->flag_type == FR_DER_ATTR_FLAG_NONE)

Definition at line 136 of file der.h.

◆ fr_der_flag_has_sequence_of

#define fr_der_flag_has_sequence_of (   _flags)    ((_flags)->flag_type == FR_DER_ATTR_FLAG_SEQUENCE_OF)

Definition at line 137 of file der.h.

◆ fr_der_flag_has_set_of

#define fr_der_flag_has_set_of (   _flags)    ((_flags)->flag_type == FR_DER_ATTR_FLAG_SETOF)

Definition at line 138 of file der.h.

◆ fr_der_flag_has_shortname

#define fr_der_flag_has_shortname (   _flags)    ((_flags)->flag_type == FR_DER_ATTR_FLAG_SHORTNAME)

Definition at line 140 of file der.h.

◆ fr_der_flag_has_value

#define fr_der_flag_has_value (   _flags)    ((_flags)->flag_type == FR_DER_ATTR_FLAG_DEFAULT_VALUE)

Definition at line 139 of file der.h.

◆ FR_DER_TAG_VALUE_MAX

#define FR_DER_TAG_VALUE_MAX   (0x1f)

tags >=max can't exist

Definition at line 61 of file der.h.

Enumeration Type Documentation

◆ fr_der_attr_flag_type_t

Which member of the fr_der_attr_flags_t union is in use.

Enumerator
FR_DER_ATTR_FLAG_NONE 

no member is in use

FR_DER_ATTR_FLAG_SEQUENCE_OF 

sequence_of has been defined

FR_DER_ATTR_FLAG_SETOF 

set_of has been defined

FR_DER_ATTR_FLAG_DEFAULT_VALUE 

a default value exists

FR_DER_ATTR_FLAG_SHORTNAME 

has a short name

Definition at line 96 of file der.h.

◆ fr_der_tag_class_t

Enumerator
FR_DER_CLASS_UNIVERSAL 
FR_DER_CLASS_APPLICATION 
FR_DER_CLASS_CONTEXT 
FR_DER_CLASS_PRIVATE 
FR_DER_CLASS_INVALID 

Definition at line 68 of file der.h.

◆ fr_der_tag_constructed_t

Enumerator
FR_DER_TAG_PRIMITIVE 

This is a leaf value, it contains no children.

FR_DER_TAG_CONSTRUCTED 

This is a sequence or set, it contains children.

Definition at line 63 of file der.h.

◆ fr_der_tag_t

Enumeration describing the data types in a DER encoded structure.

Enumerator
FR_DER_TAG_INVALID 

Invalid tag.

FR_DER_TAG_BOOLEAN 

Boolean true/false.

FR_DER_TAG_INTEGER 

Arbitrary width signed integer.

FR_DER_TAG_BITSTRING 

String of bits (length field specifies bits).

FR_DER_TAG_OCTETSTRING 

String of octets (length field specifies bytes).

FR_DER_TAG_NULL 

An empty value.

FR_DER_TAG_OID 

Reference to an OID based attribute.

FR_DER_TAG_ENUMERATED 

An enumerated value.

FR_DER_TAG_UTF8_STRING 

String of UTF8 chars.

FR_DER_TAG_SEQUENCE 

A sequence of DER encoded data (a structure).

FR_DER_TAG_SET 

A set of DER encoded data (a structure).

FR_DER_TAG_PRINTABLE_STRING 

String of printable chars.

FR_DER_TAG_T61_STRING 

String of T61 (8bit) chars.

FR_DER_TAG_IA5_STRING 

String of IA5 (7bit) chars.

FR_DER_TAG_UTC_TIME 

A time in UTC "YYMMDDhhmmssZ" format.

FR_DER_TAG_GENERALIZED_TIME 

A time in "YYYYMMDDHHMMSS[.fff]Z" format.

FR_DER_TAG_VISIBLE_STRING 

String of visible chars.

FR_DER_TAG_GENERAL_STRING 

String of general chars.

FR_DER_TAG_UNIVERSAL_STRING 

String of universal chars.

FR_DER_TAG_BMP_STRING 

String of BMP chars.

FR_DER_TAG_CHOICE 

A choice of types. Techically not a DER tag, but used to represent a choice.

FR_DER_TAG_MAX 

Definition at line 34 of file der.h.

Function Documentation

◆ fr_der_attr_class()

static fr_der_tag_class_t fr_der_attr_class ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 183 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_der_type()

static fr_der_tag_t fr_der_attr_der_type ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 188 of file der.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_attr_flags()

static fr_der_attr_flags_t const * fr_der_attr_flags ( fr_dict_attr_t const *  da)
inlinestatic

Return DER-specific flags for a given attribute.

Assert in debug builds when the attribute belongs to another dictionary, as the flags of one protocol say nothing about an attribute of another.

If the attribute does not carry the protocol-specific extension, then assert. Other builds log the error and return zeroed flags instead of NULL.

Definition at line 157 of file der.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_attr_has_default_value()

static bool fr_der_attr_has_default_value ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 240 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_is_choice()

static bool fr_der_attr_is_choice ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 250 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_is_extensions()

static bool fr_der_attr_is_extensions ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 235 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_is_oid_and_value()

static bool fr_der_attr_is_oid_and_value ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 230 of file der.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_attr_is_sequence_of()

static bool fr_der_attr_is_sequence_of ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 204 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_is_set_of()

static bool fr_der_attr_is_set_of ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 220 of file der.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_attr_leaf()

static bool fr_der_attr_leaf ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 245 of file der.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_attr_max()

static uint64_t fr_der_attr_max ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 225 of file der.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_attr_option()

static uint8_t fr_der_attr_option ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 173 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_optional()

static bool fr_der_attr_optional ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 178 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_sequence_of()

static fr_der_tag_t fr_der_attr_sequence_of ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 193 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_attr_set_of()

static fr_der_tag_t fr_der_attr_set_of ( fr_dict_attr_t const *  da)
inlinestatic

Definition at line 209 of file der.h.

+ Here is the call graph for this function:

◆ fr_der_decode_pair_dbuff()

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 at line 2640 of file decode.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_der_dict_attr_to_shortname()

char const * fr_der_dict_attr_to_shortname ( fr_dict_attr_t const *  da)

Definition at line 186 of file base.c.

+ Here is the call graph for this function:

◆ fr_der_global_free()

void fr_der_global_free ( void  )

Definition at line 221 of file base.c.

◆ fr_der_global_init()

int fr_der_global_init ( void  )

Definition at line 198 of file base.c.

+ Here is the call graph for this function:

◆ fr_der_tag_to_str()

char const * fr_der_tag_to_str ( fr_der_tag_t  tag)

Definition at line 79 of file base.c.

+ Here is the caller graph for this function:

◆ fr_der_tags_compatible()

bool fr_der_tags_compatible ( fr_der_tag_t  tag1,
fr_der_tag_t  tag2 
)

Definition at line 102 of file base.c.

+ Here is the caller graph for this function:

◆ fr_type_to_der_tag_default()

fr_der_tag_t fr_type_to_der_tag_default ( fr_type_t  type)

Definition at line 892 of file base.c.

+ Here is the caller graph for this function:

◆ fr_type_to_der_tag_valid()

bool fr_type_to_der_tag_valid ( fr_type_t  type,
fr_der_tag_t  tag 
)

Definition at line 178 of file base.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ libfreeradius_der_dict_protocol

fr_dict_protocol_t libfreeradius_der_dict_protocol
extern

Definition at line 1094 of file base.c.