|
Embedded SDK
Embedded SDK
|
Chunked APDU payload reassembly shared by the SDK app features. More...
#include <stddef.h>#include <stdint.h>

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. | |
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.
| #define APDU_CHUNKS_P2_FIRST 0x00 |
P2 value for the first (or only) APDU chunk.
Definition at line 48 of file apdu_chunks.h.
| #define APDU_CHUNKS_P2_NEXT 0x80 |
P2 value for continuation APDU chunks.
Definition at line 50 of file apdu_chunks.h.
| enum 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.
| enum 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.
| 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.
| [in] | owner | Feature owning the payload in progress |
| [in] | data | Chunk data (including the 2-byte header on the first chunk) |
| [in] | len | Length of this chunk |
| [in] | p2 | APDU_CHUNKS_P2_FIRST or APDU_CHUNKS_P2_NEXT |
| [out] | out_buf | Set to the assembled buffer when APDU_CHUNKS_COMPLETE |
| [out] | out_len | Set to the assembled length when APDU_CHUNKS_COMPLETE |