Skip to content

Prevent copying of the APDU data if possible #47

@sirkrypt0

Description

@sirkrypt0

To reduce the amount of memory required on the stack, we may find a way to prevent copying the data when transmitting short APDUs.

Implementation Note

The copying happens in the tx_short_apdu function.

libmicrofido2/src/nfc.c

Lines 150 to 161 in bb3678d

static int tx_short_apdu(
fido_dev_t *dev,
const iso7816_header_t *h,
const uint8_t *payload,
uint8_t payload_len,
uint8_t cla_flags
) {
// TODO: Prevent copying if possible.
uint8_t apdu[5 + UINT8_MAX];
uint8_t status_word[2];
size_t apdu_len;
int ok = FIDO_ERR_TX;

This currently allocates (mostly, depending on the platform) 263 bytes, which may not be toooo bad.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions