Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
apdu_chunks.h File Reference

Chunked APDU payload reassembly shared by the SDK app features. More...

#include <stddef.h>
#include <stdint.h>
Include dependency graph for apdu_chunks.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define APDU_CHUNKS_P2_FIRST   0x00
#define APDU_CHUNKS_P2_NEXT   0x80

Enumerations

enum  apdu_chunks_status_t { APDU_CHUNKS_PENDING , APDU_CHUNKS_COMPLETE , APDU_CHUNKS_ERROR }
enum  apdu_chunks_owner_t { APDU_CHUNKS_OWNER_ADDRESS_BOOK = 1 , APDU_CHUNKS_OWNER_TRANSACTION_CHECK }

Functions

apdu_chunks_status_t apdu_chunks_reassemble (apdu_chunks_owner_t owner, const uint8_t *data, size_t len, uint8_t p2, uint8_t **out_buf, size_t *out_len)
 Reassemble a multi-chunk APDU payload.

Detailed Description

Chunked APDU payload reassembly shared by the SDK app features.

The first chunk (P2=APDU_CHUNKS_P2_FIRST) is prefixed with a 2-byte big-endian total payload length; continuation chunks are appended directly. A single reassembly buffer is shared by all the features: a payload in progress is owned by the feature that started it.

Definition in file apdu_chunks.h.

Macro Definition Documentation

◆ APDU_CHUNKS_P2_FIRST

#define APDU_CHUNKS_P2_FIRST   0x00

P2 value for the first (or only) APDU chunk.

Definition at line 48 of file apdu_chunks.h.

◆ APDU_CHUNKS_P2_NEXT

#define APDU_CHUNKS_P2_NEXT   0x80

P2 value for continuation APDU chunks.

Definition at line 50 of file apdu_chunks.h.

Enumeration Type Documentation

◆ apdu_chunks_owner_t

Features sharing the reassembly buffer.

Enumerator
APDU_CHUNKS_OWNER_ADDRESS_BOOK 
APDU_CHUNKS_OWNER_TRANSACTION_CHECK 

Definition at line 41 of file apdu_chunks.h.

◆ apdu_chunks_status_t

Enumerator
APDU_CHUNKS_PENDING 

More chunks needed.

APDU_CHUNKS_COMPLETE 

Full payload assembled; out_buf/out_len are valid.

APDU_CHUNKS_ERROR 

Protocol error; the payload in progress is dropped.

Definition at line 34 of file apdu_chunks.h.

Function Documentation

◆ apdu_chunks_reassemble()

apdu_chunks_status_t apdu_chunks_reassemble ( apdu_chunks_owner_t owner,
const uint8_t * data,
size_t len,
uint8_t p2,
uint8_t ** out_buf,
size_t * out_len )

Reassemble a multi-chunk APDU payload.

Parameters
[in]ownerFeature owning the payload in progress
[in]dataChunk data (including the 2-byte header on the first chunk)
[in]lenLength of this chunk
[in]p2APDU_CHUNKS_P2_FIRST or APDU_CHUNKS_P2_NEXT
[out]out_bufSet to the assembled buffer when APDU_CHUNKS_COMPLETE
[out]out_lenSet to the assembled length when APDU_CHUNKS_COMPLETE
Returns
apdu_chunks_status_t