547 Commits
Author SHA1 Message Date
Eric BettsandGitHub abc2a54c9d Merge pull request #42 from Antiklesys/main
USB SAM Reader (ACR39U-style passthrough)
2026-08-25 18:55:51 -07:00
Eric Betts 2d23f39f5f style: apply ufbt formatting
Claude-Session: https://claude.ai/code/session_017aeoATqoJv92Xiq5vnqaN8
2026-08-25 18:53:11 -07:00
Antiklesys 78cb9e52fd USB SAM Reader (ACR39U-style passthrough)
Seader can present the attached HID SAM to a host PC as a **USB CCID contact
smart-card reader**, so any PC/SC application can drive the SAM directly (e.g.
the PM3 SAM host tools). The SAM appears as the card in slot 0.
2026-08-25 23:46:40 +08:00
Eric Betts d5c3e0a08f Power on SAM with 3v 2026-08-16 12:46:34 -07:00
Eric Betts f6e123fade Bump version to 4.2
Claude-Session: https://claude.ai/code/session_012KzYQqdKYpvXFanXCtTsZT
2026-08-12 19:58:41 -07:00
Eric Betts 32b7ee12b9 style: apply ufbt formatting
Claude-Session: https://claude.ai/code/session_016a4SuDfC8EkHo3MGGrRMod
2026-08-12 12:26:37 -07:00
Eric Betts bf27134257 sam: drop the unused mfc transmit helper
seader_mfc_transmit() lost its caller when the HF plugin took over the
read path; MIFARE Classic frames now go through plugin_hf_mfc_transmit()
in hf_interface_fal/hf.c. Remove it along with the three statics it was
the last user of: seader_require_worker(), seader_trace_mfc_bitbuffer()
and seader_trace_mfc_packed_frame(). Both trace helpers had a real and a
stubbed variant behind SEADER_ENABLE_TRACE_LOG, so all four go.

Nothing in the file uses bit_lib any more either, so its include goes
with them.

Claude-Session: https://claude.ai/code/session_016a4SuDfC8EkHo3MGGrRMod
2026-08-12 10:22:12 -07:00
Eric Betts 784a8ba3d8 hf: capture only the bytes a READ4 actually returned
plugin_hf_capture_sio() passed a fixed 32 bytes to append_picopass_sio()
no matter how long the response was. A short or truncated READ4 fed the
SIO whatever else happened to be sitting in the receive buffer past the
end of the frame.

Derive the length from the frame instead, trimming the trailing CRC and
clamping to the four blocks a READ4 can return. The DESFire branch got
the same treatment: its length was computed as size - 2 with no check
that the response held at least two bytes, so an empty frame underflowed
to a huge value. Both now bail out when the response is too short to
hold a trailer.

Claude-Session: https://claude.ai/code/session_016a4SuDfC8EkHo3MGGrRMod
2026-08-12 10:17:07 -07:00
Eric Betts 881d40dd8c sam: drop unused nfc transmit helpers
seader_capture_sio() copied 32 bytes into the 128 byte credential->sio
at an unchecked uint8_t offset derived from the block number. Reads
below the recorded start block underflowed the offset and wrote well
past the struct, over load_path and the loading callback pointers.

It is unreachable: its only callers were seader_iso15693_transmit() and
seader_iso14443a_transmit(), which lost their own callers when the HF
plugin took over the read path. The live equivalent lives in seader.c as
seader_hf_plugin_append_picopass_sio() and is bounds checked. Delete all
three rather than fix a copy nobody runs, along with the command
constants they were the last users of.

seader_mfc_transmit() is dead too but never touched the SIO buffer, and
removing it would orphan the MFC trace helpers, so it stays for now.

Claude-Session: https://claude.ai/code/session_016a4SuDfC8EkHo3MGGrRMod
2026-08-12 10:16:12 -07:00
Eric Betts e766106c6d picopass: bound virtual replay reads to the saved SIO
The virtual credential state machine computed a uint8_t block offset as
buffer[1] - 10 with no range check, then read from credential->sio at
that offset. Any block below the SR base underflowed: an SE credential
starts at block 6, so the SAM's first read produced offset 252 and
copied eight bytes from ~2KB past the 128 byte SIO buffer. Blocks above
25 walked off the far end for the same reason.

Route both the READ and READ4 branches through a helper that rejects
out-of-range blocks, and reply with an empty frame instead of garbage
when the SAM asks for something the saved credential does not hold.

Claude-Session: https://claude.ai/code/session_016a4SuDfC8EkHo3MGGrRMod
2026-08-12 10:13:33 -07:00
Eric Betts 27df1aadb8 picopass: trim CRC from the buffer that received the frame
picopass_poller_send_frame() received into the caller-supplied rx_buffer
but trimmed instance->rx_buffer. The SAM read path passes its own
buffers, so every CRC-bearing card response silently shrank
instance->rx_buffer by two bytes: 8 after select, then 6, 4, 2, 0. The
fifth such frame called bit_buffer_set_size_bytes() with an underflowed
size and tripped its capacity furi_check.

A normal Picopass read spends exactly four trims (READ 05, READ 06, two
READ4s), landing on zero and surviving by one frame. Anything needing a
third READ4 -- an SIO too long for 64 bytes -- crashes.

READCHECK and CHECK responses carry no CRC, so they never reached the
trim; only READ, READ4 and PAGESEL did.

Drop the trim from send_frame rather than retargeting it: the SAM
expects responses with the CRC still attached, which is why the virtual
card state machine appends one and why capture_sio copies 32 of the 34
bytes a READ4 returns. identify() and select() need the trim for their
size checks, so they now do it themselves.

Claude-Session: https://claude.ai/code/session_016a4SuDfC8EkHo3MGGrRMod
2026-08-12 10:11:06 -07:00
CinderSocketandGitHub 7f5267efed Merge pull request #39 from cindersocket/fix-errors
Stabilize HF/SAM reads and reduce memory pressure (for running alongside qFlipper)
2026-06-17 20:14:08 -07:00
CinderSocket e8481de4fa style: apply ufbt formatting 2026-06-17 20:07:39 -07:00
CinderSocket 82d25490a7 ui: free inactive views during config reads 2026-06-17 19:54:54 -07:00
CinderSocket afc60486e5 hf: reuse picopass host transmit buffers 2026-06-17 19:54:24 -07:00
CinderSocket f1280da86e hf: avoid duplicate detect before read start 2026-06-17 19:53:25 -07:00
CinderSocket 2be8528600 sam: fast-parse hf nfcSend responses 2026-06-17 19:48:50 -07:00
CinderSocket ae45a6b107 ui: free inactive views during hf reads 2026-06-17 19:43:50 -07:00
CinderSocket 01c3374766 hf: avoid 14a poller data copy 2026-06-17 17:08:44 -07:00
CinderSocket fba25195aa ui: release submenu during hf reads 2026-06-17 17:03:11 -07:00
CinderSocket 8ce3a44cef hf: allocate nfc host objects lazily 2026-06-17 16:55:44 -07:00
CinderSocket 30ee4df4e1 hf: reuse plugin transmit buffers 2026-06-17 16:51:39 -07:00
CinderSocket 7e3ed5dda0 t1: surface chained response allocation failures 2026-06-17 16:41:56 -07:00
CinderSocket d27641e87a ccid: build control frames off scratch buffer 2026-06-17 16:36:09 -07:00
CinderSocket 8839e1c43a uart: compact consumed rx frames safely 2026-06-17 16:30:59 -07:00
CinderSocket be6c161dfa uart: remove rx chunk delay 2026-06-17 16:26:16 -07:00
CinderSocket 4a1d29c6c9 uart: remove obsolete tx buffer fallback 2026-06-17 16:23:39 -07:00
CinderSocket 793a57c1b1 ccid: publish tx frames through uart queue 2026-06-17 16:21:00 -07:00
CinderSocket 449d1958ef uart: queue immutable tx frames 2026-06-17 16:20:31 -07:00
CinderSocket 9cb9df5778 uart: add host-tested immutable tx frame copy 2026-06-17 16:19:52 -07:00
CinderSocket 338af29408 hf: keep prompt state until teardown completes 2026-06-17 16:14:23 -07:00
CinderSocket 700275a0c3 worker: build virtual credential loop policy 2026-06-17 16:11:01 -07:00
CinderSocket 40a23cf201 debug: remove stale hex dump blocks 2026-06-17 16:09:49 -07:00
CinderSocket 477aebd9f1 alloc: guard calloc size overflow 2026-06-17 16:09:15 -07:00
CinderSocket 4536c81e75 worker: stop virtual credential loop on failure 2026-06-17 16:08:15 -07:00
CinderSocket 2bd8e8c635 sam: surface failed key probes on the main screen 2026-06-17 16:07:39 -07:00
CinderSocket 64b7f30193 hf: reset read failure context for new reads 2026-06-17 16:06:02 -07:00
CinderSocket a38eca1196 ccid: avoid unaligned dwLength loads 2026-06-17 16:05:38 -07:00
CinderSocket c868b04a1c Reset HF type prompt state on cancel 2026-06-17 15:43:00 -07:00
CinderSocket 85f3bb4940 Fix HF bridge synchronization and SAM key diagnostics 2026-06-17 15:24:51 -07:00
CinderSocket 148ecd7a72 Add host-tested board and HF bridge policies 2026-06-17 15:24:33 -07:00
Eric Betts bf10c834eb Bump version to 4.1 2026-05-28 18:48:46 -07:00
Eric Betts c631537e5f Always compute Kd from CSN 2026-05-28 18:03:48 -07:00
CinderSocketandGitHub 651c01a765 Merge pull request #38 from cindersocket/feat-multi-card-v2
Harden power handling, reduce Seader memory pressure, and simplify runtime behavior
2026-03-27 23:38:46 -07:00
CinderSocket b13a91576a Unload HF plugin before saving to avoid memory pressure 2026-03-27 23:35:55 -07:00
CinderSocket 86b6b49cef Revert "asn1: move metadata tables out of RAM"
This reverts commit ea35ecf3a57cabc36c1c778aae0bf9fd65d6f32d.
2026-03-27 23:14:43 -07:00
CinderSocket 6e64c27ca7 asn1: move metadata tables out of RAM 2026-03-27 23:05:53 -07:00
CinderSocket 3127fd64c2 mem: eliminate 280 bytes of static BSS
Stack-allocate the two mbedtls DES contexts in loclass optimized_elite
(128 bytes each) and the APDU runner progress text buffer (24 bytes).
All three were static/global but are used only within single call frames.
2026-03-27 22:40:59 -07:00
CinderSocket 7f87a5efa3 style: normalize delete scene widget call formatting 2026-03-27 22:31:12 -07:00
CinderSocket 0a409d3713 nfc: replace manual Mifare Classic file writer with SDK save path 2026-03-27 22:30:20 -07:00