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

Go to the source code of this file.

Classes

struct  tlv_extracted_s
 

Macros

#define TYPE_TRANSACTION_CHECK   0x09
 
#define TRANSACTION_CHECK_VERSION   0x01
 
#define TRANSACTION_CHECK_TLV_TAGS(X)
 

Typedefs

typedef struct tlv_extracted_s tlv_extracted_t
 

Functions

static bool handle_structure_type (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_structure_version (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_tx_hash (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_domain_hash (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_chain_id (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_risk (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_category (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_type (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_provider_msg (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_tiny_url (const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
 
static bool handle_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)
 Common handler called for all tags to progressively hash them (except signature).
 
static tlv_transaction_check_status_t verify_struct (const tlv_extracted_t *tlv_extracted)
 
static tlv_transaction_check_status_t verify_signature (tlv_extracted_t *tlv_extracted)
 
tlv_transaction_check_status_t tlv_use_case_transaction_check (const buffer_t *payload, tlv_transaction_check_out_t *out)
 Parse a Transaction Check TLV payload.
 

Macro Definition Documentation

◆ TRANSACTION_CHECK_TLV_TAGS

#define TRANSACTION_CHECK_TLV_TAGS (   X)
Value:
X(0x01, TAG_STRUCTURE_TYPE, handle_structure_type, ENFORCE_UNIQUE_TAG) \
X(0x02, TAG_STRUCTURE_VERSION, handle_structure_version, ENFORCE_UNIQUE_TAG) \
X(0x22, TAG_ADDRESS, handle_address, ENFORCE_UNIQUE_TAG) \
X(0x23, TAG_CHAIN_ID, handle_chain_id, ENFORCE_UNIQUE_TAG) \
X(0x27, TAG_TX_HASH, handle_tx_hash, ENFORCE_UNIQUE_TAG) \
X(0x28, TAG_DOMAIN_HASH, handle_domain_hash, ENFORCE_UNIQUE_TAG) \
X(0x80, TAG_NORMALIZED_RISK, handle_risk, ENFORCE_UNIQUE_TAG) \
X(0x81, TAG_NORMALIZED_CATEGORY, handle_category, ENFORCE_UNIQUE_TAG) \
X(0x82, TAG_PROVIDER_MSG, handle_provider_msg, ENFORCE_UNIQUE_TAG) \
X(0x83, TAG_TINY_URL, handle_tiny_url, ENFORCE_UNIQUE_TAG) \
X(0x84, TAG_SIMULATION_TYPE, handle_type, ENFORCE_UNIQUE_TAG) \
X(0x85, TAG_ADDITIONAL_DATA, NULL, ENFORCE_UNIQUE_TAG) \
X(0x15, TAG_DER_SIGNATURE, handle_signature, ENFORCE_UNIQUE_TAG)
@ ENFORCE_UNIQUE_TAG
static bool handle_signature(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_tx_hash(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_tiny_url(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_domain_hash(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_category(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_provider_msg(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_structure_version(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)
static bool handle_type(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_risk(const tlv_data_t *data, tlv_extracted_t *tlv_extracted)

Definition at line 183 of file tlv_use_case_transaction_check.c.

◆ TRANSACTION_CHECK_VERSION

#define TRANSACTION_CHECK_VERSION   0x01

Definition at line 28 of file tlv_use_case_transaction_check.c.

◆ TYPE_TRANSACTION_CHECK

#define TYPE_TRANSACTION_CHECK   0x09

Definition at line 27 of file tlv_use_case_transaction_check.c.

Typedef Documentation

◆ tlv_extracted_t

Function Documentation

◆ handle_address()

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

Definition at line 78 of file tlv_use_case_transaction_check.c.

◆ handle_category()

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

Definition at line 106 of file tlv_use_case_transaction_check.c.

◆ handle_chain_id()

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

Definition at line 86 of file tlv_use_case_transaction_check.c.

◆ handle_common()

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

Common handler called for all tags to progressively hash them (except signature).

Definition at line 204 of file tlv_use_case_transaction_check.c.

◆ handle_domain_hash()

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

Definition at line 70 of file tlv_use_case_transaction_check.c.

◆ handle_provider_msg()

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

Definition at line 136 of file tlv_use_case_transaction_check.c.

◆ handle_risk()

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

Definition at line 91 of file tlv_use_case_transaction_check.c.

◆ handle_signature()

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

Definition at line 168 of file tlv_use_case_transaction_check.c.

◆ handle_structure_type()

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

Definition at line 52 of file tlv_use_case_transaction_check.c.

◆ handle_structure_version()

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

Definition at line 57 of file tlv_use_case_transaction_check.c.

◆ handle_tiny_url()

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

Definition at line 153 of file tlv_use_case_transaction_check.c.

◆ handle_tx_hash()

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

Definition at line 62 of file tlv_use_case_transaction_check.c.

◆ handle_type()

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

Definition at line 121 of file tlv_use_case_transaction_check.c.

◆ tlv_use_case_transaction_check()

tlv_transaction_check_status_t tlv_use_case_transaction_check ( const buffer_t payload,
tlv_transaction_check_out_t out 
)

Parse a Transaction Check TLV payload.

Parses the provided TLV payload, verifies the PKI signature, and extracts the simulation result into the output structure.

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

Definition at line 290 of file tlv_use_case_transaction_check.c.

◆ verify_signature()

static tlv_transaction_check_status_t verify_signature ( tlv_extracted_t tlv_extracted)
static

Definition at line 264 of file tlv_use_case_transaction_check.c.

◆ verify_struct()

static tlv_transaction_check_status_t verify_struct ( const tlv_extracted_t tlv_extracted)
static

Definition at line 217 of file tlv_use_case_transaction_check.c.