Commit Graph
23638 Commits
Author SHA1 Message Date
dxl 431cded61e FPGA: PM5 FPGA build implemented. 2026-10-12 14:09:22 +08:00
dxl 1f3013c6d9 FPGA: Optimization of File Directory Structure 2026-10-12 14:08:22 +08:00
dxl 9ae4caf833 FPGA: Added yosys synthesizer script 2026-10-12 00:45:39 +08:00
dxl 78529d8df7 FPGA: Update & Merge from master(a48ce25) 2026-10-12 00:44:50 +08:00
dxl da413ac9b9 Merge branch 'master' into fpga-merge-and-opensource
# Conflicts:
#	fpga/hi_flite.v
2026-10-12 00:22:24 +08:00
dxl 256aca63b7 FPGA: Add source files specific to PM5. 2026-10-12 00:04:06 +08:00
dxl 7d5dd46d94 FPGA: Added a TODO in hi_reader.v 2026-10-11 23:43:32 +08:00
dxl 416201a535 FPGA: Change the WITH_HF_15_LOWSIGNAL macro toggle to a runtime check. 2026-10-11 18:48:38 +08:00
Zhaoqi XuandGrok Bot 10fa02ca24 client: free graph and demod buffer save states after restore
save_graphbuffer() and save_buffer8() calloc a copy, and the restore_*()
helpers only copy out of it, so every owner leaked its save state.
check_chiptype() lost 4 * g_GraphTraceLen bytes plus the packed demod
buffer on each online `lf search` (~2 MB after the COTAG probe), and the
Visa2000 demod leaked on every `lf search`, online or offline.

Add free_buffer_savestate() and call it after the last restore in
check_chiptype(), demodTI(), demodVisa2k(), demodzx(),
try_detect_modulation() and t55xx_psk_untrim_head(), including the
early-return and success paths that never restored.

Reported with the check_chiptype() diagnosis and fix by @BeheSQ.

Fixes #3675

Co-Authored-By: Grok Bot <noreply@users.noreply.github.com>
2026-10-11 06:51:44 +08:00
dxl 2b0514923d FPGA: rename all ssp frame set/clr definition. 2026-10-10 16:08:27 +08:00
dxl 36bfb81538 FPGA: lo_read.v merged. 2026-10-10 16:00:06 +08:00
dxl 42bf0d4926 FPGA: lo_adc.v merged. 2026-10-10 15:54:03 +08:00
dxl 7666e84440 FPGA: lo_edge_detect.v merged. 2026-10-10 15:18:50 +08:00
dxl 3e501de109 FPGA: hi_iso14443a.v merged. 2026-10-10 12:04:51 +08:00
dxl 8752c8acdc FPGA: Use $signed instead of the minus sign (-) to improve compatibility across different synthesis tools. 2026-10-10 10:30:07 +08:00
dxl 31b0ece921 FPGA: hi_simulate.v merged. 2026-10-10 09:41:25 +08:00
dxl 9d0d58ca4b FPGA: hi_sniffer.v merged. 2026-10-10 09:29:15 +08:00
dxl e1ec61e80f FPGA: hi_reader.v merged. 2026-10-09 20:23:07 +08:00
dxl a2b1389d4c FPGA: hi_get_trace.v merged. 2026-10-09 18:26:38 +08:00
dxl 2d3de66488 FPGA: hi_flite.v merged. 2026-10-09 17:14:53 +08:00
dxl b1795a9e7e FPGA: Added 'FPGA_CMD_SET_PWR_PWM_LOW_COUNT' cmd on PM5 platform. 2026-10-09 11:43:59 +08:00
dxl 52e4f6ba92 FPGA: Specify the bit width to comply with the [IEEE 1364] standard to resolve synthesis tool warnings. 2026-10-09 11:33:10 +08:00
Matthew Carroll 3ba49c6a61 Merge remote-tracking branch 'upstream/master' into fix/t55xx-detect-pwd-guard
# Conflicts:
#	CHANGELOG.md
2026-10-07 09:11:55 -07:00
Matthew Carroll 8c65b3c9a2 Merge remote-tracking branch 'upstream/master' into fix/psk-fc2-bandpass
# Conflicts:
#	CHANGELOG.md
2026-10-07 09:11:26 -07:00
Tom HarknessandClaude Sonnet 5 99d7b02957 doc: update PM5-FLIPPER-USAGE.md to current CEP state
RF over CEP works now that the FPGA bitstream step is done - it was
never actually CEP-blocked. Note CMD_CEP_STATUS (Hardware Status
dashboard) and the real open bug (Read Hitag2 over CEP fails with
stale cached data, firmware-side). SPI bit-order/phase is confirmed,
not pending.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-07 08:23:38 +11:00
Innocent Bystander a48ce253f7 adding an entry to CHANGELOG.md per git PR note 2026-10-06 14:57:09 +02:00
Innocent Bystander dfe5f23ae3 Change references to sim014.bin to sim024.bin to reflect the current sim firmware. 2026-10-06 14:57:09 +02:00
Innocent Bystander 0fe89aef1d Added CHANGELOG.md entry per github comment. 2026-10-05 22:31:37 -04:00
Matthew CarrollandClaude Opus 5.5 7344c7d5bc lf: fall back to pm3_psk_demod for weak fc/2 PSK when the wave tracker isn't clean
At fc/2 the subcarrier is a one-sample alternation and pskRawDemod_ext finds
wave tops one sample at a time, unfiltered. On a weak tag, sample noise erases
tops; a wave then reads as four samples and counts as a phase shift, and the
bit stream fills with errors although every bit is still in the trace. A T5577
Indala at 22 mm gave the wrong card on 14 of 50 lf search reads.

PSKDemod keeps the tracker's result whenever it is clean, so nothing changes
where master already works. Otherwise, for fc/2, it tries the existing coherent
receiver pm3_psk_demod (now with an optional per-symbol magnitude output) and
keeps that only if it scores well above what level-step leakage can produce,
its bits aren't doubled or constant, and no symbol is weak. The receiver's
output is differential, so one bad decision would flip every later bit: a weak
symbol refuses the trace rather than risk a wrong card (absolute decisions with
weak symbols left to maxErr were tried and gave wrong IDs on dropouts). With no
usable clock from the caller, candidate clocks are tried largest first. Polarity is voted from the
raw level over each phase reversal, the cue pskFindFirstPhaseShift reads at the
first one. Client only; firmware is unchanged.

Base vs this change, same captures:
- T5577 Indala, live lf search: 22 mm 3 right / 14 wrong -> 50 / 0; 24 mm
  0 / 2 -> 50 / 0; 26 mm and 0-20 mm unchanged
- lf t55xx dump, live: 22 and 24 mm blocks 0-2 and page 1 correct 5/5 where
  master reads nothing; unchanged where master reads
- emulated Indala (Chameleon Ultra, clock drifting against the reader):
  lf search right / wrong 56 / 130 -> 91 / 95 of 200; every one of the 95 is
  master's own wrong ID on the same capture
- 27 PSK traces in traces/, weakened with Gaussian noise: correct 341 -> 636 of
  810, wrong IDs 83 -> 21; with recorded Proxmark noise 367 -> 553 of 648,
  33 -> 27. No lost reads and no new wrong IDs in either
- traces/lf_*.pm3 (99): lf search -1 and -1 -c output identical; 1,581
  non-PSK probes: lf search and lf t55xx detect identical
- 200 empty-field captures: no decode, either build

tools/pm3_tests.sh: a weak 24 mm Indala trace must read its ID (fails on
master), and a synthetic NRZ with an fc/2 ripple must not decode as a tag
(the level-step leakage the score check rejects).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 14:45:41 -07:00
歐歪andOpenAI Codex f4c7243387 fix(mifare): reject WUPA mode before GDM wipe
Co-Authored-By: OpenAI Codex <noreply@openai.com>
2026-10-06 04:16:28 +08:00
Tom HarknessandClaude Sonnet 5 dd8bf6c184 Add CHANGELOG entry for CMD_CEP_STATUS
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:42:29 +02:00
Tom HarknessandClaude Sonnet 5 ac9c402e13 PM5: add CMD_CEP_STATUS, a compact hardware-status snapshot
For the Flipper Zero FAP's status page: hw status/CMD_STATUS replies
entirely via free-text Dbprintf packets the FAP's frame layer discards,
with nothing structured on the terminating ack. CMD_CEP_STATUS follows
the CMD_CAPABILITIES precedent instead - one binary cep_status_t reply
covering CEP handshake state, BWM battery telemetry, and a firmware
version string.

Always replies PM3_SUCCESS; fields for a feature this build lacks
(no WITH_CEP, no WITH_BWM_STATUS) read as zero rather than failing the
command, so any client can call it unconditionally. cep_attached isn't
included yet - its getter (cep_is_attached()) only exists on the
not-yet-merged WFI-skip responsiveness branch (#3687); can be appended
later following capabilities_t's own append-only convention.

Stacked on the pm5-bwm-battery-telemetry branch (CMD_PM5_BWM_GET_BATTERY),
which this command's battery field reuses via bwm_read_battery_info().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:42:29 +02:00
Tom HarknessandClaude Sonnet 5 7bd39effbd PM5 CEP: widen reply-header timeout, resync SPI on desync evidence
The Flipper master only clocks the bus in bursts roughly every ~120ms
(its own idle poll cadence). CEP_SPI_BYTE_TIMEOUT (~3-10ms real time)
is ~20x shorter than that gap, so cep_spi_write_sync()'s first reply
byte - the one racing against the master's next poll - was giving up
long before the master actually showed up. Measured CEP reply success
at ~22% before this fix, ~100% after, across repeated LA-captured test
runs.

Fix: a separate, ~20x longer timeout (CEP_SPI_HEADER_BYTE_TIMEOUT) used
only for the first two length-header bytes of a reply - the ones that
can land in the gap. Every byte after that stays on the short timeout,
since once the master starts clocking it stays mid-CS and keeps going.

Also makes cep_spi_data_available() call cep_spi_resync() on its two
existing desync-evidence paths (sync-preamble discard overflow, an
implausible length header) instead of just returning false - those are
exactly the AT32 errata ES0003 corruption cep_spi_resync() already
exists to recover from; silently returning false left SPI1 in that bad
state until a later CRC/length check happened to catch it.

Stacked on fix-cep-spi-reliability (#3686, open) - this builds directly
on cep_spi_resync()/cep_spi_wait_tdbe()'s bounded-wait rewrite from that
PR and can't be tested standalone without it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:39:54 +02:00
Tom HarknessandClaude Sonnet 5 f2df3eba9d Move bwm_battery_info_t into pm3_cmd.h (shared wire-protocol header)
bwm_charger.h is an armsrc-only header included after pm3_cmd.h in
appmain.c, so a struct embedding bwm_battery_info_t by value (e.g. a
future PM5 status command) couldn't see the type at the point it's
needed. bwm_ble_status_t and bwm_autooff_status_t already live in
pm3_cmd.h for the same reason - this just brings
bwm_battery_info_t in line with them. bwm_charger.c/.h keep their
function declarations unchanged; only the struct's home moves.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:38:33 +02:00
Tom HarknessandClaude Sonnet 5 5661f21d60 Add CMD_PM5_BWM_GET_BATTERY: compact structured battery telemetry
hw status's battery/BWM section (bwm_print_battery_status()) only ever
formats its numbers into free-text Dbprintf lines, unusable by any
embedded/non-terminal client. Add a new command that returns the same
SoC/voltage/current/capacity/temp/health/fault numbers as one small
packed struct via reply_ng().

Refactor the shared reads into bwm_read_battery_info() so hw status
and the new command read the same values and can't drift apart -
hw status keeps all its existing charger-detail lines (MainCtl, input
limit, VIN_DPM, charge voltage/enable) unchanged, sourced from its own
reads as before; only the fuel-gauge numbers and the two small
charger-status reads the new struct needs are now shared.

Motivated by wanting a Flipper Zero FAP battery-status test screen
(separate app repo), but this command is generic and usable by any
client, not CEP-specific.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:38:33 +02:00
Tom HarknessandClaude Sonnet 5 ba4016d7e2 PM5 CEP: data_available() doesn't poll CEP, so CMD_BREAK_LOOP over a
Flipper link can't interrupt a running reader loop

Problem: triggering the Flipper FAP's built-in ReadHitag2 demo command
turns the RF field on and it stays on even after backing out of the
app - only an unrelated USB command clears it. data_available()
(armsrc/util.c) is the standard idiom LF/HF reader loops use to notice
an incoming CMD_BREAK_LOOP, but it only polled USB/BWM/FPC. CEP's own
transport PR never wired it in, so a Flipper-sent break is invisible
to any loop that was already running.

Fix: add cep_spi_rx_pending() to armsrc/pm5_cep.c/.h - a genuinely
non-blocking single SPI1 RDBF flag check, not a reuse of the existing
(bounded-wait) cep_spi_data_available(), since this gets called every
iteration of every reader loop in the codebase and needs to cost
nothing when idle. Wire it into data_available()/data_available_fast()
alongside the existing BWM/FPC branches, additive since CEP and BWM
can coexist.

Hardware-confirmed: field now drops promptly every cycle instead of
sticking on, across repeated ReadHitag2 attach/attempt/cancel cycles.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:36:03 +02:00
Tom HarknessandClaude Sonnet 5 dd93406aa0 PM5: skip WFI idle sleep while a Flipper is CEP-attached
Problem

pm5_power_idle()'s WFI sleep adds ~40-50ms of latency before the main
loop notices a fresh byte on CEP's SPI1/USART1. At idle this is the
whole point of WFI - but it's also what made the original attach
handshake miss bytes (GH #3667): cep_attach_poll() runs every 50ms, and
WFI's own latency on top of that was enough to lose bytes of the
Flipper's one-shot handshake string often enough to require a physical
cable replug to recover.

Change

armsrc/appmain.c: skip pm5_power_idle() entirely once cep_is_attached()
is true, so the main loop polls CEP as fast as the hardware allows for
as long as a Flipper is physically present.

armsrc/pm5_cep.c/.h: new cep_is_attached(), true as soon as the CC
controller reports a physical attach - independent of whether the
handshake/SPI transport is actually up yet, so the loop stops sleeping
before the handshake even starts, not after. Paired with a
CEP_ACTIVITY_TIMEOUT_MS (3000ms) idle-detach: the FAP quitting doesn't
touch the CC controller's attach bit (the cable stays connected), so
losing its normal 20-120ms SPI poll cadence for this long is what
actually means it's gone - at that point cep_is_attached() still
reflects the physical attach correctly, but cep_is_active() (and
therefore this PR's WFI-skip, which gates on attachment rather than a
completed handshake) only backs off once the FAP itself has clearly quit
rather than just being between polls.

Built on top of the AT32 SPI1 errata fix (bounded waits + resync) from
the companion CEP-reliability PR - running the main loop flat-out
against an unbounded wait would have just hit that hang faster, which is
why this shipped after rather than alongside it.

Behaviour change

PM5 no longer downclocks to WFI between main-loop iterations while a
Flipper is attached over CEP (idle power draw increases for the duration
of the attach; unaffected when no Flipper is present, and unaffected on
RDV4/non-CEP builds).

Testing

- make clean && make PLATFORM=PM5 PLATFORM_EXTRAS=BWM and
  make clean && make PLATFORM=PM3RDV4 - both zero warnings.
- Hardware: this flag was active throughout all of the companion CEP-
  reliability PR's hardware testing (60s/110s/240s captures, 18x
  `hw status`, 5x attach/detach + `hf search` cycles against a real
  card) - all passed with WFI-skip engaged the whole time. Additionally
  reflashed this exact branch standalone and reconfirmed a live
  attach/detach cycle completes cleanly.
- Not tested: clang toolchain (firmware-only diff); idle power draw was
  not independently measured (no direct ammeter in this session's
  bench setup, only observed BWM telemetry prior to this change).

Checklist

- [x] Proper style of own code, no unrelated reformatting included
- [x] Builds warning-free with gcc (PM5 and RDV4)
- [ ] clang not tried (firmware-only diff)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:29:39 +02:00
Tom HarknessandClaude Sonnet 5 8faafcebb0 PM5 CEP: recover from AT32 SPI1 errata, bound all SPI waits
Problem

With PR #3672/#3674 landed, CEP handshakes reliably but the SPI transport
hangs PM5 hard (needs a physical reset, no watchdog on this platform)
after some number of attach/reconnect cycles - sometimes the first
cycle, sometimes dozens of pings in. Logic-analyzer capture of a hang in
progress showed a ~1.2s burst of rapid CS-gated retries, and in one
capture, three periodic transactions after that burst got progressively
slower (2.1ms -> 3.9ms -> 3.2ms -> 5.2ms) instead of recovering.

Root causes (two, compounding)

1. cep_spi_write_sync() had seven bare `while (flag == RESET);` spins
   waiting on SPI1's TDBE/BF flags, with no timeout. PM5 is the SPI
   slave - TDBE only clears when the Flipper is actively clocking, on
   its own ~20-120ms schedule, completely async to when PM5's reply is
   ready. Queue a reply between two master polls and the wait never
   returns - full main-loop death.
2. Artery's own errata sheet for the AT32F435/437 (ES0003) documents
   that in SPI slave hardware-CS mode, the internal clock sync is not
   guaranteed to reset on every CS falling edge - a bad sync can persist
   across transactions with no self-correction. This is PM5's exact CEP
   configuration (SPI_CS_HARDWARE_MODE, slave mode).

Change

armsrc/pm5_cep.c:
- cep_spi_write_sync() rewritten around a bounded cep_spi_wait_tdbe()
  helper (same spin-iteration-count pattern already used for reads) -
  returns PM3_EIO on timeout instead of hanging.
- New cep_spi_resync(): hardware-resets SPI1 via crm_periph_reset()
  (a register re-init alone doesn't clear the errata's bad internal
  state) and brings it back up. This is Artery's own documented recovery
  for ES0003 ("reset SPI and restart communication"), triggered by our
  existing NG-frame CRC/length checks instead of the SPI peripheral's
  hardware CRC feature.
- cep_do_handshake()'s SPI-stall recovery path was itself unbounded
  (retried forever as long as the CC controller reported "still
  attached") and missing the StartTicks()/I2C_init(true) guard every
  other I2C call site in this file has (same bug class as #3672) - now
  bounded (CEP_HANDSHAKE_REPLY_MAX_RETRIES) with the guard added.
- cep_spi_data_available() now discards the Flipper's 0x55 idle-poll
  filler bytes before reading the real length header, instead of ever
  interpreting one as (part of) a frame length.

armsrc/cmd.c: wire cep_spi_resync() into every CEP-reachable error exit
in receive_ng_internal() (short/overflow/CRC-mismatch reads) and both
reply_old()/reply_ng_internal()'s write-failure paths, so any detected
corruption resets SPI1 before the next transaction rather than letting a
bad sync persist. Add a WITH_CEP-gated inline stub for cep_spi_resync()
so receive_ng_internal()'s call sites don't need per-site #ifdef guards
on non-CEP platforms.

Behaviour change

None for USB/FPC/BWM. CEP: a corrupted or stalled SPI1 transaction now
self-heals (one dropped reply, then normal operation) instead of
wedging the device.

Testing

- make clean && make PLATFORM=PM5 PLATFORM_EXTRAS=BWM and
  make clean && make PLATFORM=PM3RDV4 - both zero warnings.
- Hardware: flashed to a real PM5 paired with a real Flipper Zero FAP.
  - 60s continuous-connection capture with zero USB activity (isolates
    CEP from any client-side interaction): clean, no anomalies.
  - 110s capture with 18 real `hw status` calls interspersed: all 18
    succeeded, CEP stayed attached throughout.
  - 5 full attach/detach cycles with `hf search` against a real NTAG213
    card before/during/after each attach (240s, logic-analyzer capture
    throughout): all 15 reads returned the identical UID regardless of
    CEP state, zero hangs, final liveness check succeeded with no reset
    needed.
- Not tested: clang toolchain (firmware-only diff).

Checklist

- [x] Proper style of own code, no unrelated reformatting included
- [x] Builds warning-free with gcc (PM5 and RDV4)
- [ ] clang not tried (firmware-only diff)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:25:00 +02:00
Tom HarknessandClaude Sonnet 5 2e2720a1da PM5: bound usb_write()'s tx-complete wait
The two g_tx_completed spin loops in usb_write() had no timeout at all -
if the host ever stopped pulling an IN packet while the device still read
as enumerated, PM5 would spin forever with no recovery path. Add a
spin-iteration bound (not tick-based: g_tx_completed is set from the USB
core's own ISR, and the shared ticks timer is routinely stopped by LF/HF
code at arbitrary points), matching the existing bounded-wait pattern
used elsewhere in this codebase.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-04 14:24:10 +02:00
Philippe Teuwen 63063bd030 tune docs for default port 18888 2026-10-02 15:05:19 +02:00
Niel Nielsen f9bd1c3010 Update default port from 7777 to 18888
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-10-02 14:17:01 +02:00
Niel Nielsen 7d339ac4dc Update default port from 7777 to 18888
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-10-02 14:17:01 +02:00
Niel Nielsen 133b981512 Change default TCP server port from 7777 to 18888
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-10-02 14:17:01 +02:00
Matthew CarrollandClaude Opus 5 8917c48cde lf t55xx detect: do not send a password the PWD bit has not confirmed
`lf t55xx detect -p <pwd>` reached for the password whenever detection
failed without one, and sent it across every downlink mode and again
after a wake. On a tag that is not password protected those frames can
be taken for a write: the PWD bit gets set and the tag's data is
destroyed, leaving it locked behind whatever block 7 already held.

`lf t55xx read` and `lf t55xx dump` already guard against this. They
verify the PWD bit in the configuration block before using a password,
and expose -o/--override to bypass the check deliberately. detect had
neither, and T55xxReadBlockEx() treats a live `detect -p` as proof the
bit is set.

detect cannot run the same check -- reading the configuration is what it
is for, and the password is only reached for once that has failed -- so
the risk has to be the user's to accept. Gate it behind -o/--override to
match read and dump, and carry read's warning banner into the help.

No change in behaviour for anyone not passing -p.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-01 16:13:49 -07:00
Niel Nielsen 256f30f0fa Add files via upload
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-10-01 23:04:47 +02:00
Innocent Bystander 196c0e392e Documentation updated from feedback 2026-10-01 00:22:05 -04:00
Marc b1734ebf24 fix: hardnested/autopwn on PM5 with hardened MIFARE Classic EV1
Problem:
On PM5 (AT32F435, 288 MHz), `hf mf hardnested` / `hf mf autopwn` consistently
fail on genuine hardened MFC EV1: repeated AcquireEncryptedNonces Auth1/Auth2
errors, the attack never reduces the keyspace (No match for the First_Byte_Sum),
and the client intermittently loses the device (No response from Proxmark3).

Root cause - two PM5-specific issues in MifareAcquireEncryptedNonces():
- The AUTH_NESTED read is issued so soon after the first auth completes that on
  the fast AT32 the encrypted-nonce reception is intermittently corrupted
  (~0.2%/nonce). It is invisible on other frames (BCC/CRC-checked and retried)
  but fatal to hardnested, whose bit-flip elimination is zero-tolerance - one
  bad nonce can strike the true key from the candidate set. `--slow` does not
  help: its delay is before the first auth (select->auth1), not in the
  auth1->nested gap where the corruption occurs.
- MFC_MAX_NONCE_PAIRS is derived from PM3_CMD_DATA_SIZE: ~450 pairs on PM5
  (4064-byte buffer) vs ~68 elsewhere (624). A full ~450-pair PM5 round can
  outrun the client's 3 s reply wait and drop the link.

Change:
- Add a 500 us settle delay before the AUTH_NESTED read, gated to `#if defined(PM5)`.
- Cap the per-round batch to MFC_ACQ_ROUND_MAX_PAIRS (68) via MIN() - a no-op on
  every platform whose natural max is already <= 68.

Behaviour change:
- PM5 hf mf hardnested / autopwn now succeed on hardened MFC EV1. PM5 nonce
  acquisition is ~500 us/nonce slower and replies in smaller (68-pair) rounds.
- No behaviour change on any non-PM5 platform (delay compiled out; cap is a
  MIN no-op).

Testing:
- make clean && make PLATFORM=PM5, and make clean && make PLATFORM=PM3RDV4:
  both warning-free.
- On hardware (PM5): full `hf mf autopwn` recovers all 36 keys of a hardened
  MFC EV1 in ~98 s (4 sectors via hardnested, the rest cascaded) and dumps the
  card; baseline firmware recovers none.
- Not tested here: clang build, CMake/experimental_lib client variants
  (firmware-only change, no client code touched), Windows/macOS. RDV4 not
  exercised on hardware - it is unaffected and byte-identical after this change.

Fixes #3595, #3664
2026-09-30 15:29:17 -04:00
Tom HarknessandClaude Sonnet 5 e6d7cd1f9d Fix CEP reply corruption: move payload memset after time-critical reads
receive_ng_internal() zeroed rx->data (up to PM3_CMD_DATA_SIZE bytes)
between the preamble read and the payload read. CEP's SPI1 receiver has
no FIFO (single-byte holding register), so that stall lost bytes on every
frame - confirmed via logic analyzer (wire content byte-perfect) plus
Dbprintf instrumentation showing the payload read consistently short by
half. Reordered so preamble/payload/postamble/CRC are all read back-to-back
before any memset/memcpy happens. USB/FPC/BWM are unaffected: same total
work, just resequenced.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-28 21:27:50 +02:00
Nemanja Nedeljkovic 23d57af8bd lf em 4x05 chk: add EM4305 anti-clone card password to default dictionary
Adds A1856618 to t55xx_default_pwds. This is the verified working login
password (as used with -p); the bit-reversed on-air form 1866A185 does not
authenticate.
2026-09-28 21:26:56 +02:00
Tom HarknessandClaude Sonnet 5 d26d8d5ef1 Trim comments, add CHANGELOG entry per review feedback
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-28 09:32:59 +02:00