Skip to main content

Module load

Module load 

Source
Expand description

LOAD (CLA 84, INS E8) — PDD §5.4a, GPCS v2.3.1 §11.6.

P1: 0x00 more blocks, 0x80 last block. P2: block number from 0x00. Chunk size ≤ LOAD_BLOCK_DATA (223 B) plaintext (short APDU); ≤ 256 blocks.

Scope note: load_block is a pure per-block APDU framer. The first block’s 'C4' (Load File) BER wrapper carries the length of the whole assembled Load File Data Block, which a per-block framer cannot know, so it is not added here. It is the first bytes of the LFDB byte stream produced upstream by the CAP/LFDB streamer (cap::LoadFileDataBlock::next_block, S3) — so the first chunk handed to this framer already begins with 'C4' len …. This keeps the fixed (block_no, last, chunk) signature and the “never hold the whole LFDB in RAM” contract (§5.4a).

Functions§

load_block
Build one LOAD block. block_no is the P2 counter; last sets P1 0x80 (otherwise 0x00, “more blocks”). chunk is one streamed LFDB slice (≤ LOAD_BLOCK_DATA); see the module note on the 'C4' wrapper.