Repository navigation
Conversation
dangfan
commented
Sep 1, 2026
- Streaming APDU
- Add support for ML-DSA-65 & ML-KEM-768
- CTAP 2.3
- More extentions for PIV
Adopt GNU GCC/AFL++ builds and optimize ML-DSA streaming
Remove the FM11NC (SPI, HW_NFCA/HW_NFCA_LEGACY) code paths; FM11NT over I2C is the only supported NFC front-end now. The porting contract gains i2c_bus_recover() and loses spi_transmit()/spi_receive(). Rework the FM11NT idle recovery into an explicit state machine (NONE/REQUESTED/SILENCED/UNSILENCE): the RF-silence period is timed with a one-shot timeout instead of a blocking device_delay(), chip-level IRQ masking replaces in-ISR draining during the silent period (with a drain fallback if the mask write fails), and forced (error-triggered) recoveries are latched before the session reset so an IRQ landing mid-recovery is drained instead of being handled as normal activity.
…y first chunk When Le is absent, apdu_output sends a zero-length first chunk and the transport stamps the SW trailer at abData[0..1], which aliases the pending chain store. The saved response_tail was discarded at the next apdu_output entry because it keyed invalidation on sent == 0, which a GET RESPONSE continuation also satisfies. Invalidate the tail at the new-command dispatch points instead, so the restore actually runs. A spurious GET RESPONSE with nothing pending now returns SW_COMMAND_NOT_ALLOWED on the applet streaming path too, matching the generic path, instead of 9000 with stale buffer contents. Found by differential fuzzing against CIU98320B hardware.
…fuzzing Reads hex APDUs on stdin, drives them through the virt-card via process_apdu_from (APDU_TRANSPORT_CCID) with GET RESPONSE chaining, and prints RESP <sw><data> per line. Long-lived: card state persists across lines, so the host side can mirror a hardware fuzz campaign APDU for APDU. DBG output is diverted to stderr to keep the pipe protocol clean. Built via the new ENABLE_APDU_REPLAY option, which defines TEST but not FUZZ: the FUZZ gates skip PIN/touch verification paths and would diverge from real fuzz firmware, defeating the comparison.
A completed or abandoned chained response left rapdu_chaining.len > 0 behind, and neither a new non-GET-RESPONSE command nor a CCID slot power cycle cleared it. A later spurious GET RESPONSE then served stale shared_io_buffer bytes with the old SW (typically 9000), leaking leftover response/request data across commands and sessions. Per ISO 7816-4 a new command abandons any pending chain: dispatch now resets both rapdu.len and sent (chaining handlers re-establish them; OATH/ADMIN/SELECT/error paths leave len=0), and session expiry and the no-owner session-reset branch drop pending RAPDU chains like they already did for response sources and FIDO CAPDU chains. Also gate the INS 0xEE/0xEF APDU test hooks behind TESTMODE_INS_HOOKS (defined by ENABLE_TESTS/ENABLE_FUZZING, not ENABLE_APDU_REPLAY) so the differential-fuzz replay build matches real firmware, which answers 6D00 to those INS. Found by differential fuzzing against CIU98320B hardware.
Read LittleFS attributes using their stored payload length instead of the overall PIV object capacity. This prevents PRINTED reads from clearing past the 256-byte APDU response buffer on CIU firmware. Add a bounded response-buffer regression test for the PIN-protected management-key object. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
canokey-crypto 5033de4/cf2f724: host software RSA and ECDH now reject inconsistent CRT keys and invalid peer points instead of silently repairing/accepting them, matching the hardware contract. Regression tests exercise both via PIV import + GENERAL AUTHENTICATE.
PIV and OpenPGP imports now reject inconsistent CRT keys with 6A80 via rsa_check_crt instead of accepting them and failing later (and differently per platform) at use. Found by hardware differential fuzzing (p==q import accepted, GET METADATA then diverged 6900/9000).
Update checkout, cache, and setup-go to their current major versions. Advance canokey-crypto for its matching checkout update. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
Advance canokey-crypto to the fixture fix that supplies valid CRT values for the host RSA private-operation test. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
The HIL runner opens a fresh PC/SC connection per fuzz case, so the device's applet session (PIN validation, pending chains) expires between cases via PC_to_RDR_IccPowerOff -> device_applet_session_reset. The persistent harness process had no equivalent boundary, so host-side validation outlived the device's and gated commands diverged (6982 vs 6D00). !POWEROFF expires the session identically (applets_poweroff + chain/source resets); the runner sends one per case.
Return up to 256 random bytes for 00 84 and validate its APDU parameters. Also update the reported PIV firmware version to 6.0.0.
Require English for source comments, engineering documentation, diagnostics, and contribution metadata while allowing explicitly identified localization resources. Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
|
Important Review skippedToo many files! This PR contains 131 files, which is 31 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (131)
You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |