The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
decode.c File Reference

Functions to decode DER encoded data. More...

#include <freeradius-devel/io/test_point.h>
#include <freeradius-devel/util/dbuff.h>
#include <freeradius-devel/util/decode.h>
#include <freeradius-devel/util/dict.h>
#include <freeradius-devel/util/pair.h>
#include <freeradius-devel/util/proto.h>
#include <freeradius-devel/util/sbuff.h>
#include <freeradius-devel/util/struct.h>
#include <freeradius-devel/util/time.h>
#include <freeradius-devel/util/dict_ext.h>
#include "attrs.h"
#include "der.h"
+ Include dependency graph for decode.c:

Go to the source code of this file.

Data Structures

struct  fr_der_decode_oid_to_da_ctx_t
 
struct  fr_der_decode_oid_to_stack_ctx_t
 
struct  fr_der_tag_decode_t
 

Macros

#define fr_der_decode_enumerated   fr_der_decode_integer
 
#define IS_DER_LEN_MULTI_BYTE(_len)   (((_len) & DER_LEN_MULTI_BYTE) == DER_LEN_MULTI_BYTE)
 
#define IS_DER_TAG_CONSTRUCTED(_tag)   (((_tag) & 0x20) == 0x20)
 
#define IS_DER_TAG_CONTINUATION(_tag)   (((_tag) & DER_TAG_CONTINUATION) == DER_TAG_CONTINUATION)
 

Typedefs

typedef ssize_t(* fr_der_decode_oid_t) (uint64_t subidentifier, void *uctx, bool is_last)
 
typedef ssize_t(* fr_der_decode_t) (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)
 

Functions

static ssize_t decode_pair (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, void *decode_ctx)
 Decode a DER structure using the specific dictionary.
 
static int decode_test_ctx (void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict, UNUSED fr_dict_attr_t const *root_da)
 
static ssize_t fr_der_decode_bitstring (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)
 
static ssize_t fr_der_decode_boolean (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_choice (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)
 Decode a CHOICE type This is where the actual decoding of the CHOICE type happens.
 
static ssize_t fr_der_decode_combo_ip_addr (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_general_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_generalized_time (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_hdr (fr_dict_attr_t const *parent, fr_dbuff_t *in, uint8_t *tag, size_t *len, fr_der_tag_t expected)
 Decode the tag and length fields of a DER encoded structure.
 
static ssize_t fr_der_decode_ia5_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_integer (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_ipv4_addr (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_ipv4_prefix (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_ipv6_addr (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_ipv6_prefix (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_null (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_octetstring (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_oid (fr_dbuff_t *in, fr_der_decode_oid_t func, void *uctx)
 Decode an OID from a DER encoded buffer using a callback.
 
static ssize_t fr_der_decode_oid_and_value (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)
 Decode an OID value pair.
 
static ssize_t fr_der_decode_oid_to_da (uint64_t subidentifier, void *uctx, bool is_last)
 Decode an OID to a dictionary attribute.
 
static ssize_t fr_der_decode_oid_to_stack (uint64_t subidentifier, void *uctx, UNUSED bool is_last)
 Decode an OID to an exploded list.
 
static ssize_t fr_der_decode_oid_wrapper (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
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)
 
static ssize_t fr_der_decode_printable_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_proto (TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, void *proto_ctx)
 
static ssize_t fr_der_decode_sequence (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)
 
static ssize_t fr_der_decode_set (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)
 
static ssize_t fr_der_decode_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, bool const allowed_chars[], fr_der_decode_ctx_t *decode_ctx))
 Function signature for DER decode functions.
 
static ssize_t fr_der_decode_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, bool const allowed_chars[], UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_t61_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_universal_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_utc_time (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_utf8_string (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)
 
static ssize_t fr_der_decode_visible_string (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
 
static ssize_t fr_der_decode_x509_extensions (TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dbuff_t *in, fr_dict_attr_t const *parent, fr_der_decode_ctx_t *decode_ctx)
 Decode an X509 Extentions Field.
 

Variables

fr_test_point_pair_decode_t der_tp_decode_pair
 
fr_test_point_proto_decode_t der_tp_decode_proto
 
static const fr_der_tag_decode_t oid_and_value_func
 
static const fr_der_tag_decode_t tag_funcs [FR_DER_TAG_VALUE_MAX]
 
static const fr_der_tag_decode_t type_funcs [FR_TYPE_MAX]
 

Detailed Description

Functions to decode DER encoded data.

Id
c8db8942a1fe1b2c32ef227d196729f96a2348f3
Author
Ethan Thompson (ethan.nosp@m..tho.nosp@m.mpson.nosp@m.@ink.nosp@m.bridg.nosp@m.e.io)
Id
f83a9d18c0e27fadd31570a6d9046d053cc799fe
Author
Arran Cudbard-Bell (a.cud.nosp@m.bard.nosp@m.b@fre.nosp@m.erad.nosp@m.ius.o.nosp@m.rg)
Ethan Thompson (ethan.nosp@m..tho.nosp@m.mpson.nosp@m.@ink.nosp@m.bridg.nosp@m.e.io)

Definition in file decode.c.


Data Structure Documentation

◆ fr_der_decode_oid_to_da_ctx_t

struct fr_der_decode_oid_to_da_ctx_t

Definition at line 476 of file decode.c.

+ Collaboration diagram for fr_der_decode_oid_to_da_ctx_t:
Data Fields
TALLOC_CTX * ctx Allocation context.
fr_dict_attr_t const * parent_da Parent dictionary attribute.
fr_pair_list_t * parent_list Parent pair list.

◆ fr_der_decode_oid_to_stack_ctx_t

struct fr_der_decode_oid_to_stack_ctx_t

Definition at line 447 of file decode.c.

Data Fields
int depth
unsigned int oid[FR_DICT_MAX_TLV_STACK]

◆ fr_der_tag_decode_t

struct fr_der_tag_decode_t

Definition at line 58 of file decode.c.

+ Collaboration diagram for fr_der_tag_decode_t:
Data Fields
fr_der_tag_constructed_t constructed
fr_der_decode_t decode

Macro Definition Documentation

◆ fr_der_decode_enumerated

#define fr_der_decode_enumerated   fr_der_decode_integer

Definition at line 1383 of file decode.c.

◆ IS_DER_LEN_MULTI_BYTE

#define IS_DER_LEN_MULTI_BYTE (   _len)    (((_len) & DER_LEN_MULTI_BYTE) == DER_LEN_MULTI_BYTE)

Definition at line 46 of file decode.c.

◆ IS_DER_TAG_CONSTRUCTED

#define IS_DER_TAG_CONSTRUCTED (   _tag)    (((_tag) & 0x20) == 0x20)

Definition at line 45 of file decode.c.

◆ IS_DER_TAG_CONTINUATION

#define IS_DER_TAG_CONTINUATION (   _tag)    (((_tag) & DER_TAG_CONTINUATION) == DER_TAG_CONTINUATION)

Definition at line 44 of file decode.c.

Typedef Documentation

◆ fr_der_decode_oid_t

typedef ssize_t(* fr_der_decode_oid_t) (uint64_t subidentifier, void *uctx, bool is_last)

Definition at line 48 of file decode.c.

◆ fr_der_decode_t

typedef ssize_t(* fr_der_decode_t) (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 55 of file decode.c.

Function Documentation

◆ decode_pair()

static ssize_t decode_pair ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
uint8_t const *  data,
size_t  data_len,
void *  decode_ctx 
)
static

Decode a DER structure using the specific dictionary.

Parameters
[in]ctxto allocate new pairs in.
[in]outwhere new VPs will be added
[in]parentParent attribute. This should be the root of the dictionary we're using to decode DER data. This only specifies structures like SEQUENCES. OID based pairs are resolved using the global dictionary tree.
[in]datato decode.
[in]data_lenLength of data.
[in]decode_ctxto pass to decode function.

Definition at line 2699 of file decode.c.

+ Here is the call graph for this function:

◆ decode_test_ctx()

static int decode_test_ctx ( void **  out,
TALLOC_CTX *  ctx,
UNUSED fr_dict_t const *  dict,
UNUSED fr_dict_attr_t const *  root_da 
)
static

Definition at line 2713 of file decode.c.

◆ fr_der_decode_bitstring()

static ssize_t fr_der_decode_bitstring ( 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 
)
static

Definition at line 220 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_boolean()

static ssize_t fr_der_decode_boolean ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 80 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_choice()

static ssize_t fr_der_decode_choice ( 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 
)
static

Decode a CHOICE type This is where the actual decoding of the CHOICE type happens.

The CHOICE type is a type that can have multiple types, but only one of them can be present at a time. The type that is present is determined by the tag of the data

Parameters
[in]ctxTalloc context
[in]outOutput list
[in]parentParent attribute
[in]inInput buffer
[in]decode_ctxDecode context

Definition at line 2003 of file decode.c.

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

◆ fr_der_decode_combo_ip_addr()

static ssize_t fr_der_decode_combo_ip_addr ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1595 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_general_string()

static ssize_t fr_der_decode_general_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1385 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_generalized_time()

static ssize_t fr_der_decode_generalized_time ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1217 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_hdr()

static ssize_t fr_der_decode_hdr ( fr_dict_attr_t const *  parent,
fr_dbuff_t in,
uint8_t tag,
size_t len,
fr_der_tag_t  expected 
)
static

Decode the tag and length fields of a DER encoded structure.

Parameters
[in]parentParent attribute
[in]inInput buffer
[out]tagTag value
[out]lenLength of the value field
[in]expectedthe expected / required tag
Returns
0 on success, -1 on failure

Definition at line 1833 of file decode.c.

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

◆ fr_der_decode_ia5_string()

static ssize_t fr_der_decode_ia5_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1129 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_integer()

static ssize_t fr_der_decode_integer ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 130 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_ipv4_addr()

static ssize_t fr_der_decode_ipv4_addr ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1397 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_ipv4_prefix()

static ssize_t fr_der_decode_ipv4_prefix ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1445 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_ipv6_addr()

static ssize_t fr_der_decode_ipv6_addr ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1496 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_ipv6_prefix()

static ssize_t fr_der_decode_ipv6_prefix ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1544 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_null()

static ssize_t fr_der_decode_null ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 419 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_octetstring()

static ssize_t fr_der_decode_octetstring ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 364 of file decode.c.

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

◆ fr_der_decode_oid()

static ssize_t fr_der_decode_oid ( fr_dbuff_t in,
fr_der_decode_oid_t  func,
void *  uctx 
)
static

Decode an OID from a DER encoded buffer using a callback.

Parameters
[in]inThe DER encoded data.
[in]funcThe callback function to call for each subidentifier.
[in]uctxUser context for the callback function.
Returns
  • 0 on success
  • < 0 on error

Definition at line 567 of file decode.c.

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

◆ fr_der_decode_oid_and_value()

static ssize_t fr_der_decode_oid_and_value ( 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 
)
static

Decode an OID value pair.

Parameters
[in]ctxTalloc context
[out]outOutput list
[in]parentParent attribute
[in]inInput buffer
[in]decode_ctxDecode context
Returns
0 on success, -1 on failure

Definition at line 1707 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_oid_to_da()

static ssize_t fr_der_decode_oid_to_da ( uint64_t  subidentifier,
void *  uctx,
bool  is_last 
)
static

Decode an OID to a dictionary attribute.

Parameters
[in]subidentifierThe subidentifier to decode
[in]uctxUser context
[in]is_lastIs this the last subidentifier in the OID
Returns
  • 1 on success
  • < 0 on error

Definition at line 491 of file decode.c.

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

◆ fr_der_decode_oid_to_stack()

static ssize_t fr_der_decode_oid_to_stack ( uint64_t  subidentifier,
void *  uctx,
UNUSED bool  is_last 
)
static

Decode an OID to an exploded list.

Parameters
[in]subidentifierThe subidentifier to decode
[in]uctxUser context
[in]is_lastIs this the last subidentifier in the OID
Returns
  • 1 on success
  • < 0 on error

Definition at line 461 of file decode.c.

+ Here is the caller graph for this function:

◆ fr_der_decode_oid_wrapper()

static ssize_t fr_der_decode_oid_wrapper ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1641 of file decode.c.

+ 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 2393 of file decode.c.

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

◆ fr_der_decode_printable_string()

static ssize_t fr_der_decode_printable_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1074 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_proto()

static ssize_t fr_der_decode_proto ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
uint8_t const *  data,
size_t  data_len,
void *  proto_ctx 
)
static

Definition at line 2671 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_sequence()

static ssize_t fr_der_decode_sequence ( 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 
)
static

Definition at line 724 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_set()

static ssize_t fr_der_decode_set ( 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 
)
static

Definition at line 887 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_string() [1/2]

static ssize_t fr_der_decode_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
bool const  allowed_chars[],
fr_der_decode_ctx_t decode_ctx 
)
static

Function signature for DER decode functions.

Parameters
[in]ctxAllocation context
[in]outWhere to store the decoded pairs.
[in]parentParent attribute. This should be the root of the dictionary we're using to decode DER data initially, and then nested children.
[in]inThe DER encoded data.
[in]allowed_charsOptional array indicating which ASCII characters are allowed.
[in]decode_ctxAny decode specific data.
Returns
  • > 0 on success. How many bytes were decoded.
  • 0 no bytes decoded.
  • < 0 on error. May be the offset (as a negative value) where the error occurred.
+ Here is the caller graph for this function:

◆ fr_der_decode_string() [2/2]

static ssize_t fr_der_decode_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
bool const  allowed_chars[],
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 2333 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_t61_string()

static ssize_t fr_der_decode_t61_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1088 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_universal_string()

static ssize_t fr_der_decode_universal_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1391 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_utc_time()

static ssize_t fr_der_decode_utc_time ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1141 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_utf8_string()

static ssize_t fr_der_decode_utf8_string ( 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 
)
static

Definition at line 714 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_visible_string()

static ssize_t fr_der_decode_visible_string ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dict_attr_t const *  parent,
fr_dbuff_t in,
UNUSED fr_der_decode_ctx_t decode_ctx 
)
static

Definition at line 1359 of file decode.c.

+ Here is the call graph for this function:

◆ fr_der_decode_x509_extensions()

static ssize_t fr_der_decode_x509_extensions ( TALLOC_CTX *  ctx,
fr_pair_list_t out,
fr_dbuff_t in,
fr_dict_attr_t const *  parent,
fr_der_decode_ctx_t decode_ctx 
)
static

Decode an X509 Extentions Field.

Parameters
[in]ctxTalloc context
[in]outOutput list
[in]inInput buffer
[in]parentParent attribute
[in]decode_ctxDecode context
Returns
0 on success, -1 on failure

Definition at line 2062 of file decode.c.

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

Variable Documentation

◆ der_tp_decode_pair

fr_test_point_pair_decode_t der_tp_decode_pair
Initial value:
= {
.test_ctx = decode_test_ctx,
.func = decode_pair,
}
static int decode_test_ctx(void **out, TALLOC_CTX *ctx, UNUSED fr_dict_t const *dict, UNUSED fr_dict_attr_t const *root_da)
Definition decode.c:102
static ssize_t decode_pair(TALLOC_CTX *ctx, fr_pair_list_t *out, NDEBUG_UNUSED fr_dict_attr_t const *parent, uint8_t const *data, size_t data_len, void *decode_ctx)
Definition decode.c:491

Definition at line 2729 of file decode.c.

◆ der_tp_decode_proto

fr_test_point_proto_decode_t der_tp_decode_proto
Initial value:
= {
.test_ctx = decode_test_ctx,
}
static ssize_t fr_der_decode_proto(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data, size_t data_len, void *proto_ctx)
Definition decode.c:2671

Definition at line 2735 of file decode.c.

◆ oid_and_value_func

const fr_der_tag_decode_t oid_and_value_func
static
Initial value:
= {
}
@ FR_DER_TAG_PRIMITIVE
This is a leaf value, it contains no children.
Definition der.h:64
static ssize_t fr_der_decode_oid_and_value(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)
Decode an OID value pair.
Definition decode.c:1707

Definition at line 1819 of file decode.c.

◆ tag_funcs

const fr_der_tag_decode_t tag_funcs[FR_DER_TAG_VALUE_MAX]
static
Initial value:
= {
[FR_DER_TAG_NULL] = { .constructed = FR_DER_TAG_PRIMITIVE, .decode = fr_der_decode_null },
[FR_DER_TAG_SET] = { .constructed = FR_DER_TAG_CONSTRUCTED, .decode = fr_der_decode_set },
}
@ FR_DER_TAG_IA5_STRING
String of IA5 (7bit) chars.
Definition der.h:48
@ FR_DER_TAG_SEQUENCE
A sequence of DER encoded data (a structure).
Definition der.h:44
@ FR_DER_TAG_SET
A set of DER encoded data (a structure).
Definition der.h:45
@ FR_DER_TAG_INTEGER
Arbitrary width signed integer.
Definition der.h:37
@ FR_DER_TAG_BOOLEAN
Boolean true/false.
Definition der.h:36
@ FR_DER_TAG_UTF8_STRING
String of UTF8 chars.
Definition der.h:43
@ FR_DER_TAG_UTC_TIME
A time in UTC "YYMMDDhhmmssZ" format.
Definition der.h:49
@ FR_DER_TAG_GENERALIZED_TIME
A time in "YYYYMMDDHHMMSS[.fff]Z" format.
Definition der.h:50
@ FR_DER_TAG_NULL
An empty value.
Definition der.h:40
@ FR_DER_TAG_OCTETSTRING
String of octets (length field specifies bytes).
Definition der.h:39
@ FR_DER_TAG_VISIBLE_STRING
String of visible chars.
Definition der.h:51
@ FR_DER_TAG_BITSTRING
String of bits (length field specifies bits).
Definition der.h:38
@ FR_DER_TAG_T61_STRING
String of T61 (8bit) chars.
Definition der.h:47
@ FR_DER_TAG_ENUMERATED
An enumerated value.
Definition der.h:42
@ FR_DER_TAG_UNIVERSAL_STRING
String of universal chars.
Definition der.h:53
@ FR_DER_TAG_PRINTABLE_STRING
String of printable chars.
Definition der.h:46
@ FR_DER_TAG_GENERAL_STRING
String of general chars.
Definition der.h:52
@ FR_DER_TAG_OID
Reference to an OID based attribute.
Definition der.h:41
@ FR_DER_TAG_CONSTRUCTED
This is a sequence or set, it contains children.
Definition der.h:65
static ssize_t fr_der_decode_visible_string(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1359
static ssize_t fr_der_decode_generalized_time(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1217
static ssize_t fr_der_decode_oid_wrapper(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1641
static ssize_t fr_der_decode_t61_string(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1088
static ssize_t fr_der_decode_universal_string(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1391
static ssize_t fr_der_decode_general_string(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1385
static ssize_t fr_der_decode_integer(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:130
static ssize_t fr_der_decode_bitstring(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:220
static ssize_t fr_der_decode_octetstring(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:364
static ssize_t fr_der_decode_ia5_string(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1129
static ssize_t fr_der_decode_null(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:419
#define fr_der_decode_enumerated
Definition decode.c:1383
static ssize_t fr_der_decode_utf8_string(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:714
static ssize_t fr_der_decode_printable_string(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1074
static ssize_t fr_der_decode_utc_time(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1141
static ssize_t fr_der_decode_set(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:887
static ssize_t fr_der_decode_boolean(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:80
static ssize_t fr_der_decode_sequence(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:724

Definition at line 1786 of file decode.c.

◆ type_funcs

const fr_der_tag_decode_t type_funcs[FR_TYPE_MAX]
static
Initial value:
= {
}
@ FR_TYPE_IPV4_ADDR
32 Bit IPv4 Address.
@ FR_TYPE_IPV6_PREFIX
IPv6 Prefix.
@ FR_TYPE_IPV6_ADDR
128 Bit IPv6 Address.
@ FR_TYPE_IPV4_PREFIX
IPv4 Prefix.
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
static ssize_t fr_der_decode_ipv4_addr(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1397
static ssize_t fr_der_decode_ipv6_addr(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1496
static ssize_t fr_der_decode_ipv4_prefix(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1445
static ssize_t fr_der_decode_ipv6_prefix(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1544
static ssize_t fr_der_decode_combo_ip_addr(TALLOC_CTX *ctx, fr_pair_list_t *out, fr_dict_attr_t const *parent, fr_dbuff_t *in, UNUSED fr_der_decode_ctx_t *decode_ctx)
Definition decode.c:1595

Definition at line 1810 of file decode.c.