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/proto.h>
#include <freeradius-devel/util/struct.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
639d1a749314d06f9c247fef849d88ecca52f7df
Author
Ethan Thompson (ethan.nosp@m..tho.nosp@m.mpson.nosp@m.@ink.nosp@m.bridg.nosp@m.e.io)
Id
35c2683f41c1af01136fbc29fccbd6a0864216d5
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 472 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 443 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 54 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 1399 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 42 of file decode.c.

◆ IS_DER_TAG_CONSTRUCTED

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

Definition at line 41 of file decode.c.

◆ IS_DER_TAG_CONTINUATION

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

Definition at line 40 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 44 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 51 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 2715 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 2729 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 216 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 76 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 2019 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 1611 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 1401 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 1220 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 1849 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 1132 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 126 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 1413 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 1461 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 1512 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 1560 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 415 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 360 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 563 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 1723 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 487 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 457 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 1657 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 2409 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 1077 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 2687 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 720 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 883 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 2349 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 1091 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 1407 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 1144 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 710 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 1375 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 2078 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:489

Definition at line 2745 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:2687

Definition at line 2751 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:1723

Definition at line 1835 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:1375
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:1220
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:1657
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:1091
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:1407
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:1401
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:126
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:216
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:360
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:1132
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:415
#define fr_der_decode_enumerated
Definition decode.c:1399
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:710
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:1077
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:1144
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:883
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:76
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:720

Definition at line 1802 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:1413
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:1512
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:1461
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:1560
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:1611

Definition at line 1826 of file decode.c.