Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
tlv_use_case_trusted_name.c File Reference
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include "os_utils.h"
#include "ox_ec.h"
#include "cx.h"
#include "os_pki.h"
#include "ledger_pki.h"
#include "tlv_use_case_trusted_name.h"
Include dependency graph for tlv_use_case_trusted_name.c:

Go to the source code of this file.

Classes

struct  multi_hash_ctx_s
 
struct  multi_hash_finalized_u
 
struct  tlv_extracted_s
 

Macros

#define TLV_TAGS(X)
 

Typedefs

typedef struct multi_hash_ctx_s multi_hash_ctx_t
 
typedef struct multi_hash_finalized_u multi_hash_finalized_t
 
typedef struct tlv_extracted_s tlv_extracted_t
 

Functions

static void init_multi_hash_ctx (multi_hash_ctx_t *hash_ctx)
 
static void update_multi_hash_ctx (multi_hash_ctx_t *hash_ctx, buffer_t data)
 
static int finalize_hash_for_algo (const multi_hash_ctx_t *hash_ctx, tlv_trusted_name_signer_algorithm_t signer_algo, multi_hash_finalized_t *multi_hash_finalized)
 
static bool handle_structure_type (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_version (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_trusted_name_type (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_trusted_name_source (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_trusted_name (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_chain_id (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_address (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_nft_id (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_source_contract (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_challenge (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_not_valid_after (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_signer_key_id (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_signer_algorithm (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_der_signature (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_common (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static tlv_trusted_name_status_t verify_struct (const tlv_extracted_t *tlv_extracted)
 
static tlv_trusted_name_status_t verify_signature (const tlv_extracted_t *tlv_extracted)
 
tlv_trusted_name_status_t tlv_use_case_trusted_name (const buffer_t *payload, tlv_trusted_name_out_t *out)
 Processes a TLV dynamic descriptor use case.
 

Macro Definition Documentation

◆ TLV_TAGS

#define TLV_TAGS (   X)
Value:
X(0x01, TAG_STRUCTURE_TYPE, handle_structure_type, ENFORCE_UNIQUE_TAG) \
X(0x02, TAG_VERSION, handle_version, ENFORCE_UNIQUE_TAG) \
X(0x70, TAG_TRUSTED_NAME_TYPE, handle_trusted_name_type, ENFORCE_UNIQUE_TAG) \
X(0x71, TAG_TRUSTED_NAME_SOURCE, handle_trusted_name_source, ENFORCE_UNIQUE_TAG) \
X(0x20, TAG_TRUSTED_NAME, handle_trusted_name, ENFORCE_UNIQUE_TAG) \
X(0x23, TAG_CHAIN_ID, handle_chain_id, ENFORCE_UNIQUE_TAG) \
X(0x22, TAG_ADDRESS, handle_address, ENFORCE_UNIQUE_TAG) \
X(0x72, TAG_NFT_ID, handle_nft_id, ENFORCE_UNIQUE_TAG) \
X(0x73, TAG_SOURCE_CONTRACT, handle_source_contract, ENFORCE_UNIQUE_TAG) \
X(0x12, TAG_CHALLENGE, handle_challenge, ENFORCE_UNIQUE_TAG) \
X(0x10, TAG_NOT_VALID_AFTER, handle_not_valid_after, ENFORCE_UNIQUE_TAG) \
X(0x13, TAG_SIGNER_KEY_ID, handle_signer_key_id, ENFORCE_UNIQUE_TAG) \
X(0x14, TAG_SIGNER_ALGORITHM, handle_signer_algorithm, ENFORCE_UNIQUE_TAG) \
X(0x15, TAG_DER_SIGNATURE, handle_der_signature, ENFORCE_UNIQUE_TAG)
@ ENFORCE_UNIQUE_TAG
static bool handle_trusted_name_source(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_trusted_name_type(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_chain_id(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_address(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_signer_key_id(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_nft_id(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_signer_algorithm(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_version(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_source_contract(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_not_valid_after(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_trusted_name(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_structure_type(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_der_signature(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_challenge(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)

Definition at line 224 of file tlv_use_case_trusted_name.c.

Typedef Documentation

◆ multi_hash_ctx_t

◆ multi_hash_finalized_t

◆ tlv_extracted_t

Function Documentation

◆ finalize_hash_for_algo()

static int finalize_hash_for_algo ( const multi_hash_ctx_t hash_ctx,
tlv_trusted_name_signer_algorithm_t  signer_algo,
multi_hash_finalized_t multi_hash_finalized 
)
static

Definition at line 77 of file tlv_use_case_trusted_name.c.

◆ handle_address()

static bool handle_address ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 168 of file tlv_use_case_trusted_name.c.

◆ handle_chain_id()

static bool handle_chain_id ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 163 of file tlv_use_case_trusted_name.c.

◆ handle_challenge()

static bool handle_challenge ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 183 of file tlv_use_case_trusted_name.c.

◆ handle_common()

static bool handle_common ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 243 of file tlv_use_case_trusted_name.c.

◆ handle_der_signature()

static bool handle_der_signature ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 214 of file tlv_use_case_trusted_name.c.

◆ handle_nft_id()

static bool handle_nft_id ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 173 of file tlv_use_case_trusted_name.c.

◆ handle_not_valid_after()

static bool handle_not_valid_after ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 188 of file tlv_use_case_trusted_name.c.

◆ handle_signer_algorithm()

static bool handle_signer_algorithm ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 209 of file tlv_use_case_trusted_name.c.

◆ handle_signer_key_id()

static bool handle_signer_key_id ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 204 of file tlv_use_case_trusted_name.c.

◆ handle_source_contract()

static bool handle_source_contract ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 178 of file tlv_use_case_trusted_name.c.

◆ handle_structure_type()

static bool handle_structure_type ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 137 of file tlv_use_case_trusted_name.c.

◆ handle_trusted_name()

static bool handle_trusted_name ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 157 of file tlv_use_case_trusted_name.c.

◆ handle_trusted_name_source()

static bool handle_trusted_name_source ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 152 of file tlv_use_case_trusted_name.c.

◆ handle_trusted_name_type()

static bool handle_trusted_name_type ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 147 of file tlv_use_case_trusted_name.c.

◆ handle_version()

static bool handle_version ( const tlv_data_t data,
tlv_extracted_t tlv_extracted 
)
static

Definition at line 142 of file tlv_use_case_trusted_name.c.

◆ init_multi_hash_ctx()

static void init_multi_hash_ctx ( multi_hash_ctx_t hash_ctx)
static

Definition at line 55 of file tlv_use_case_trusted_name.c.

◆ tlv_use_case_trusted_name()

tlv_trusted_name_status_t tlv_use_case_trusted_name ( const buffer_t payload,
tlv_trusted_name_out_t out 
)

Processes a TLV dynamic descriptor use case.

This function parses the provided payload buffer and extracts dynamic descriptor information, storing the results in the output structure.

Parameters
[in]payloadPointer to the buffer containing the TLV payload data.
[out]outPointer to the structure where the parsed dynamic descriptor will be stored.
Returns
Status code indicating the result of the operation. See tlv_dynamic_descriptor_status_t for possible values.

Definition at line 351 of file tlv_use_case_trusted_name.c.

◆ update_multi_hash_ctx()

static void update_multi_hash_ctx ( multi_hash_ctx_t hash_ctx,
buffer_t  data 
)
static

Definition at line 66 of file tlv_use_case_trusted_name.c.

◆ verify_signature()

static tlv_trusted_name_status_t verify_signature ( const tlv_extracted_t tlv_extracted)
static

Definition at line 316 of file tlv_use_case_trusted_name.c.

◆ verify_struct()

static tlv_trusted_name_status_t verify_struct ( const tlv_extracted_t tlv_extracted)
static

Definition at line 251 of file tlv_use_case_trusted_name.c.