|
Embedded SDK
Embedded SDK
|
Default APDU harness body for a fuzz target. More...
#include <stddef.h>#include <stdint.h>#include <string.h>#include <setjmp.h>#include "fuzz_defs.h"#include "mocks.h"#include "parser.h"
Go to the source code of this file.
Macros | |
| #define | FUZZ_PICK_COMMAND_STRUCTURED(data, size) (&fuzz_commands[fuzz_ctrl[1] % fuzz_n_commands]) |
| #define | FUZZ_PICK_COMMAND_RAW(data, size) (&fuzz_commands[(data)[1] % fuzz_n_commands]) |
Functions | |
| void | fuzz_app_reset (void) |
| Reset app state before each iteration (required). | |
| void | fuzz_app_dispatch (void *cmd) |
Dispatch one command_t to the app (required). | |
| void | fuzz_app_cleanup (void) |
| Optional per-iteration teardown; a weak no-op default is provided. | |
| static int | fuzz_use_structured_lane (void) |
| Whether control byte 0 selects the structured lane. | |
| static uint8_t | fuzz_clamp_p (uint8_t raw, uint8_t p_max) |
| Clamp a raw P1/P2 byte to the command's declared maximum (0 = full range). | |
| static void | fuzz_harness_cleanup (void) |
| static int | fuzz_harness_entry (const uint8_t *data, size_t size) |
Default fuzz_entry() body: run one fuzzer input as one APDU. | |
Variables | |
| const fuzz_command_spec_t | fuzz_commands [] |
| App command table. | |
| const size_t | fuzz_n_commands |
| Number of entries in fuzz_commands. | |
Default APDU harness body for a fuzz target.
Including this header gives a target the standard fuzz_harness_entry() implementation: it turns one fuzzer input into one APDU and dispatches it through the app. The app supplies the command table (fuzz_commands), the required fuzz_app_reset() / fuzz_app_dispatch() callbacks, and the fuzz_* symbols from its mocks.h. fuzz_app_cleanup() is optional: the framework ships a weak no-op default that an app may override.
Definition in file fuzz_harness.h.
| #define FUZZ_PICK_COMMAND_RAW | ( | data, | |
| size | |||
| ) | (&fuzz_commands[(data)[1] % fuzz_n_commands]) |
Definition at line 50 of file fuzz_harness.h.
| #define FUZZ_PICK_COMMAND_STRUCTURED | ( | data, | |
| size | |||
| ) | (&fuzz_commands[fuzz_ctrl[1] % fuzz_n_commands]) |
Apps may override these macros before inclusion to install lane-specific command tables.
Definition at line 46 of file fuzz_harness.h.
|
extern |
Optional per-iteration teardown; a weak no-op default is provided.
|
extern |
Dispatch one command_t to the app (required).
|
extern |
Reset app state before each iteration (required).
|
inlinestatic |
Clamp a raw P1/P2 byte to the command's declared maximum (0 = full range).
Definition at line 36 of file fuzz_harness.h.
|
static |
Definition at line 53 of file fuzz_harness.h.
|
static |
Default fuzz_entry() body: run one fuzzer input as one APDU.
Reads the first 4 bytes as CLA/INS/P1/P2 selectors, exposes the rest as the APDU payload, picks a command from fuzz_commands, and dispatches it.
Definition at line 69 of file fuzz_harness.h.
|
inlinestatic |
Whether control byte 0 selects the structured lane.
Definition at line 30 of file fuzz_harness.h.
|
extern |
App command table.
|
extern |
Number of entries in fuzz_commands.