ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
Loading...
Searching...
No Matches
der.h File Reference

ASN.1 Distinguished Encoding Rules: one TLV at a time, over the caller's bytes. More...

#include "protocore_config.h"

Go to the source code of this file.

Classes

struct  DerTlv
 One value in the caller's bytes: what it is, where its content is, and what follows. More...
 
struct  DerReadArgs
 The bytes a read walks, and where in them it starts. More...
 
struct  DerOidArgs
 An object identifier a comparison names, in its encoded form (X.690 sec 8.19). More...
 
struct  DerVars
 
struct  DerNs
 The entries. More...
 

Macros

#define PROTOCORE_DER_CONSTRUCTED   0x20u
 X.690 sec 8.1.2.5: the constructed bit, set on a value that holds other values.
 
#define PROTOCORE_DER_CONTEXT(n)   (0x80u | (uint8_t)(n))
 X.690 sec 8.1.2.2: a context-specific tag, as an X.509 field's [n].
 
#define PROTOCORE_DER_CONTEXT_CONSTRUCTED(n)   (0xA0u | (uint8_t)(n))
 
X.690 sec 8.1.2 identifier octets: the universal tags this profile reads.
#define PROTOCORE_DER_BOOLEAN   0x01u
 
#define PROTOCORE_DER_INTEGER   0x02u
 
#define PROTOCORE_DER_BIT_STRING   0x03u
 
#define PROTOCORE_DER_OCTET_STRING   0x04u
 
#define PROTOCORE_DER_NULL   0x05u
 
#define PROTOCORE_DER_OID   0x06u
 
#define PROTOCORE_DER_UTF8_STRING   0x0Cu
 
#define PROTOCORE_DER_PRINTABLE_STRING   0x13u
 
#define PROTOCORE_DER_IA5_STRING   0x16u
 
#define PROTOCORE_DER_UTC_TIME   0x17u
 
#define PROTOCORE_DER_GENERALIZED_TIME   0x18u
 
#define PROTOCORE_DER_SEQUENCE   0x30u
 
#define PROTOCORE_DER_SET   0x31u
 

Functions

void protocore_der_read (uint8_t *work)
 
void protocore_der_enter (uint8_t *work)
 
void protocore_der_uint (uint8_t *work)
 
void protocore_der_bitstring (uint8_t *work)
 
void protocore_der_oid_eq (uint8_t *work)
 
void protocore_der_time (uint8_t *work)
 

Variables

DerVars DerV
 The operands and the outcome.
 

Detailed Description

ASN.1 Distinguished Encoding Rules: one TLV at a time, over the caller's bytes.

X.690 sec 10 makes DER a canonical subset of BER: every length is definite, and the shortest form that fits. That is the whole of what this reads - an indefinite length, a redundant long form, or a length that runs past the caller's buffer is refused rather than guessed at, because a parser that accepts more than the encoding allows accepts two encodings of the same certificate and signature verification covers only one of them.

Nothing is copied and nothing is allocated. A read reports a tag, a pointer into the caller's own bytes, a length, and where the next value begins, so walking a structure is a sequence of reads against one buffer that outlives them all.

The caller holds the position. A chain walk has two certificates open at once, so the cursor is a value on the call rather than state in this module.

Author
Douglas Quigg (dstroy0)
Date
2026

Definition in file der.h.

Macro Definition Documentation

◆ PROTOCORE_DER_BOOLEAN

#define PROTOCORE_DER_BOOLEAN   0x01u

Definition at line 34 of file der.h.

◆ PROTOCORE_DER_INTEGER

#define PROTOCORE_DER_INTEGER   0x02u

Definition at line 35 of file der.h.

◆ PROTOCORE_DER_BIT_STRING

#define PROTOCORE_DER_BIT_STRING   0x03u

Definition at line 36 of file der.h.

◆ PROTOCORE_DER_OCTET_STRING

#define PROTOCORE_DER_OCTET_STRING   0x04u

Definition at line 37 of file der.h.

◆ PROTOCORE_DER_NULL

#define PROTOCORE_DER_NULL   0x05u

Definition at line 38 of file der.h.

◆ PROTOCORE_DER_OID

#define PROTOCORE_DER_OID   0x06u

Definition at line 39 of file der.h.

◆ PROTOCORE_DER_UTF8_STRING

#define PROTOCORE_DER_UTF8_STRING   0x0Cu

Definition at line 40 of file der.h.

◆ PROTOCORE_DER_PRINTABLE_STRING

#define PROTOCORE_DER_PRINTABLE_STRING   0x13u

Definition at line 41 of file der.h.

◆ PROTOCORE_DER_IA5_STRING

#define PROTOCORE_DER_IA5_STRING   0x16u

Definition at line 42 of file der.h.

◆ PROTOCORE_DER_UTC_TIME

#define PROTOCORE_DER_UTC_TIME   0x17u

Definition at line 43 of file der.h.

◆ PROTOCORE_DER_GENERALIZED_TIME

#define PROTOCORE_DER_GENERALIZED_TIME   0x18u

Definition at line 44 of file der.h.

◆ PROTOCORE_DER_SEQUENCE

#define PROTOCORE_DER_SEQUENCE   0x30u

Definition at line 45 of file der.h.

◆ PROTOCORE_DER_SET

#define PROTOCORE_DER_SET   0x31u

Definition at line 46 of file der.h.

◆ PROTOCORE_DER_CONSTRUCTED

#define PROTOCORE_DER_CONSTRUCTED   0x20u

X.690 sec 8.1.2.5: the constructed bit, set on a value that holds other values.

Definition at line 50 of file der.h.

◆ PROTOCORE_DER_CONTEXT

#define PROTOCORE_DER_CONTEXT (   n)    (0x80u | (uint8_t)(n))

X.690 sec 8.1.2.2: a context-specific tag, as an X.509 field's [n].

Definition at line 53 of file der.h.

◆ PROTOCORE_DER_CONTEXT_CONSTRUCTED

#define PROTOCORE_DER_CONTEXT_CONSTRUCTED (   n)    (0xA0u | (uint8_t)(n))

Definition at line 54 of file der.h.

Function Documentation

◆ protocore_der_read()

void protocore_der_read ( uint8_t *  work)

◆ protocore_der_enter()

void protocore_der_enter ( uint8_t *  work)

◆ protocore_der_uint()

void protocore_der_uint ( uint8_t *  work)

◆ protocore_der_bitstring()

void protocore_der_bitstring ( uint8_t *  work)

◆ protocore_der_oid_eq()

void protocore_der_oid_eq ( uint8_t *  work)

◆ protocore_der_time()

void protocore_der_time ( uint8_t *  work)

Variable Documentation

◆ DerV

DerVars DerV
extern

The operands and the outcome.