Commit Graph
23574 Commits
Author SHA1 Message Date
Iceman d596fe6b04 Merge pull request #3730 from adrian-stepien/dev/bootrom-common-init
Include COMMON globals in bootrom BSS initialization
2026-10-28 13:15:20 +07:00
Iceman a71c3ebad3 Merge pull request #3731 from adrian-stepien/dev/bootloader-dump-cleanup
Avoid hanging the bootrom after a memory dump
2026-10-28 13:14:51 +07:00
Adrian fbdbaf3c9e Include COMMON globals in bootrom BSS initialization
The bootrom linker script defines __bss_end__ before COMMON symbols are
placed. Startup clears only up to that boundary. On PM5 with ARM GCC 8.5,
this leaves the entire 92-byte USB CDC structure outside the zeroed area,
even though bootrom sources themselves are built with -fno-common.

Place COMMON inside .bss before setting __bss_end__, and assert that the
boundary covers the whole section. The shared script applies to PM5 and
RDV4. On the tested PM5 build, stack addresses, the shared communication
area and the entry point remain unchanged.

Built both targets with ARM GCC 8.5 and ran bootrom/check. Checked ELF
boundaries and the 16 KiB boot partition; removing COMMON placement
triggers the new assertion. No compiler warnings; the existing PM5 RWX
LOAD-segment linker warning remains. CMake and BWM builds were not tested.

Flashed the bootrom alone on PM5 and verified readback against the image.
All internal flash bytes from the OS start onward matched the pre-flash
backup. Cold startup and five software reset cycles passed. Five complete
bootloader/read/reset cycles also passed after fixing the client's dump
cleanup separately. FPGA was not written. This corrects initialization;
it does not establish a fix for the USB-controller failures in #3642.
2026-10-27 17:11:20 +00:00
Adrian 6762b812d5 Avoid hanging the bootrom after a memory dump
Bootloader memory-dump cleanup sends CMD_PING to wake the communication
thread after clearing its run flag. The thread can be waiting for another
transmit after the dump ACK, so it sends this command before exiting.
The non-BWM bootrom does not handle CMD_PING: its default dispatch enters
Fatal(), leaving the device unresponsive even though the dump succeeded.

Use CMD_DEVICE_INFO for the wakeup instead. It is already supported by the
bootloader and used to identify it before the dump. Keep the wakeup so
closing the client does not leave the communication thread waiting.

Reproduced on PM5: the dump completed, but the following reset and device
probe failed. With only the rebuilt client changed, the same test script
passed five OS-to-bootloader, memory-dump and reset-to-OS cycles, with a
successful ping after each. No firmware was flashed for this comparison.

Built the client with AppleClang through Make, CMake and experimental_lib;
client/check passed. GCC 16 compiled the changed translation unit with
-Wall -Werror. Existing macOS linker warnings remain. The full GCC host
build was not repeated because of the previously observed Apple SDK
alignment error. Linux and Windows were not tested; this change replaces
an existing protocol command without changing platform-specific code.
2026-10-27 17:11:20 +00:00
Iceman 61ede21feb Merge pull request #3725 from M35mar/mfuev1-counter-reset
HF MFU: rewrite hf mfu countertear as faithful port of mfuev1_counter_reset.py
2026-10-27 09:54:36 +07:00
Iceman 94a6c1beed Merge pull request #3728 from TomHarkness/fix/cep-spi1-write-read-roerr-flush
pm5 cep: clear stale SPI1 RX byte around write/read on CEP's SPI1
2026-10-27 09:54:05 +07:00
Iceman 34225e6df6 Merge pull request #3722 from antoniovazquezblanco/emv
Tag EMV cards
2026-10-27 09:50:08 +07:00
Iceman fabf0f7b94 Merge pull request #3726 from kormax/calypso-aid-selection-fallback
Fallback to SELECT via AID if Calypso card does not respect LID file select
2026-10-24 23:57:42 +07:00
kormax 1883ef3369 Fallback to SELECT via AID if Calypso card does not respect LID file select 2026-10-24 18:29:53 +03:00
M35mar a3009aedbc Merge branch 'RfidResearchGroup:master' into mfuev1-counter-reset 2026-10-24 10:48:47 +02:00
M35MARandopencode agent a260d0514e HF MFU: rewrite hf mfu countertear as faithful port of mfuev1_counter_reset.py
Problem
The native hf mfu countertear used a device-side
CMD_HF_MFU_COUNTER_TEAROFF path with a static increment payload,
decided once per run. The pyscript mfuev1_counter_reset.py implements
the same attack with auto-calibration, a 3-phase attack loop,
per-attempt BD delay tuning (hunting) and stuck-value handling,
which the native command lacked.

Change
- rewrite the client command around the generic tear-off hook
  (hw tearoff) and raw INCREASE_CNT frames, mirroring the pyscript
  step by step: preflight checks, CHECK_TEARING_EVENT support gate,
  targeted repair/normalize, BD sweep calibration (working delay
  accepted only on 0xBD), and the DECREMENT -> PREPARE (0x00FFFF)
  -> RESET phases with the same increment payloads (000100 for
  decrement steps, 010000 for reset/repair)
- same delay tuning on counter movement: +1 when unchanged, -1 when
  a jump exceeds 10, delay locked after a successful decrement
- remove CMD_HF_MFU_COUNTER_TEAROFF usage from the client; device
  side stays untouched
- add Lua port client/luascripts/mfuev1_counter_reset.lua with the
  same behaviour, using core.console capture and Enter-to-stop
- regenerate doc/commands.md and doc/commands.json

Behaviour change
Same CLI shape as the pyscript (-c/-f/--DelayBD/--Delay00, legacy
-i/-l/-s/-x options removed). Console output now matches the pyscript.

Testing
gcc warningless for client, armsrc and bootrom (RDV4). make check
green. doc regenerated with GD enabled. Verified 1:1 against the
pyscript and the new Lua port on hardware (EV1 card). Not tested
here: clang, Windows/ProxSpace and macOS. No build files are touched,
so the usual client-side review applies.

Co-Authored-By: opencode agent (GLM-5.3-Flash-Free) <noreply@opencode.ai>
2026-10-24 10:10:55 +02:00
M35MAR b497afc00e client/pyscripts: harden mfuev1 counter reset
Validate counter choices 0-2, treat only 0x00/0xBD as valid
CHECK_TEARING_EVENT answers, and detect NACK replies from the raw
payload, so retry logic does not mistake a NACK for a real answer.
2026-10-24 10:09:37 +02:00
Iceman bc6d767964 Merge pull request #3724 from r3wretrhy/fix/emv-aidlist-rule-stringop-overflow
emv: fix false -Wstringop-overflow in AID list rule with AVX2
2026-10-24 10:30:51 +07:00
Zhaoqi XuandGrok Bot 56efde54f5 emv: fix false -Wstringop-overflow in AID list rule with AVX2
Building the client with -march=x86-64-v3 (the CentOS/RHEL 10
baseline) fails with gcc 14:

  src/emv/emvcore.c:211:24: error: writing 32 bytes into a region of
  size 22 [-Werror=stringop-overflow=]

gcc vectorizes the dash fill loop in aidlist_rule() into 32-byte
stores and loses the pos + 2 < dstlen bound. The bound was correct.
Compute the dash count with the same limit and fill it with memset,
so there is no vectorized loop store to mis-size. Output is unchanged.

Reported in #3671.

Co-Authored-By: Grok Bot <noreply@users.noreply.github.com>
2026-10-23 19:06:41 -04:00
Antonio Vázquez Blanco 6d9526f4fb Tag EMV cards 2026-10-23 13:28:28 +02:00
Iceman 6ce4ec49c1 Merge pull request #3717 from antoniovazquezblanco/emv
HF 14a: Only hint EMV when correct AID is found
2026-10-23 16:06:31 +07:00
Antonio Vázquez Blanco aa55bfca0e HF 14a: Only hint EMV when correct AID is found 2026-10-23 08:25:24 +02:00
Iceman c10930d6e4 Merge pull request #3721 from antoniovazquezblanco/seosinfo
hf seos info: Try to print more information
2026-10-23 11:15:45 +07:00
Iceman f34f09b90f Merge branch 'master' into seosinfo
Signed-off-by: Iceman <iceman@iuse.se>
2026-10-23 11:15:33 +07:00
Iceman de5489f45b Merge pull request #3720 from antoniovazquezblanco/managekeys
mf seos managekeys: Fix table alignment
2026-10-23 11:12:56 +07:00
Iceman 89c6536c5f Merge branch 'master' into managekeys
Signed-off-by: Iceman <iceman@iuse.se>
2026-10-23 11:12:47 +07:00
Iceman 85a751bdb9 Merge pull request #3719 from antoniovazquezblanco/aid
aidlist: Fix uppercase in SEOS, TeslaDAP and LA TAP AIDs
2026-10-23 11:12:09 +07:00
Iceman d66273ea3c Merge branch 'master' into aid
Signed-off-by: Iceman <iceman@iuse.se>
2026-10-23 11:12:00 +07:00
Iceman 8691140de8 Merge pull request #3718 from antoniovazquezblanco/seoskeys
hf seos: Print a better hint on missing keys
2026-10-23 11:09:32 +07:00
Iceman 6adf5a59f2 Merge pull request #3716 from antoniovazquezblanco/seos
HF 14a: Add a SEOS hint
2026-10-23 11:07:26 +07:00
Iceman 9502e1d1b9 Merge pull request #3693 from mfcarroll/fix/psk-fc2-bandpass
lf: fall back to pm3_psk_demod for weak fc/2 PSK when the wave tracke…
2026-10-23 11:06:33 +07:00
Tom HarknessandClaude Sonnet 5 8cdce6ab78 pm5 cep: clear stale SPI1 RX byte around write/read on CEP's SPI1
SPI1 is full-duplex with no RX FIFO. Every byte cep_spi_write_sync()
clocks out on MISO also shifts a byte in on MOSI that nothing reads,
and AT32F435/437 RM ch 13.2.9 says the first such byte freezes in
SPI_DT until read - not "newest overwrites oldest" as assumed before.
A frozen byte then gets misread by cep_spi_data_available() as part of
the next frame's length header, forcing a resync. Clear ROERR once
after the write (before the read path can touch it) and once at the
top of the read path (for freezes from other main-loop gaps).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-22 15:26:25 +11:00
Antonio Vázquez Blanco 3a57bb112c hf seos info: Try to print more information 2026-10-21 15:05:53 +02:00
Antonio Vázquez Blanco e582bfe9c5 mf seos managekeys: Fix table alignment 2026-10-21 13:37:22 +02:00
Antonio Vázquez Blanco 798f9f3d28 aidlist: Fix uppercase in SEOS, TeslaDAP and LA TAP AIDs 2026-10-21 13:35:29 +02:00
Antonio Vázquez Blanco 75e4e766ec hf seos: Print a better hint on missing keys 2026-10-21 13:29:14 +02:00
Antonio Vázquez Blanco 748394d0ab HF 14a: Add a SEOS hint 2026-10-21 13:11:44 +02:00
Iceman 0b9597e8f3 Merge pull request #3715 from xianglin1998/fpga-timing-bug
Fixed: FPGA PWM clock timing failed to meet the 400 MHz requirement.
2026-10-20 13:42:49 +07:00
dxl 6bc400db5e Fixed: FPGA PWM clock timing failed to meet the 400 MHz requirement.
Following discussions and debugging with the hardware engineer, the PWM clock frequency was reduced from 400 MHz to 200 MHz. Subsequent testing confirmed that voltage regulation remained largely unaffected.
2026-10-19 23:09:40 +08:00
Iceman 8ab96c9cee Merge pull request #3713 from nip-was-here/fix/mfc-acquisition-budget
Replace mfc pair cap with an acquisition time budget
2026-10-19 21:06:26 +07:00
Iceman 588a6eb32c Merge branch 'master' into fix/mfc-acquisition-budget
Signed-off-by: Iceman <iceman@iuse.se>
2026-10-19 14:45:58 +07:00
Iceman a8fe9f0f50 Merge pull request #3712 from nip-was-here/fix/iso14443a-nonce-completeness
Reject incomplete nested nonces instead of delaying PM5 authentication
2026-10-19 14:44:18 +07:00
nip dbb823c8f8 Revert redundant test
Signed-off-by: nip <182409448+nip-was-here@users.noreply.github.com>
2026-10-19 08:37:55 +04:00
nip f6b768e002 Revert redundant test
Signed-off-by: nip <182409448+nip-was-here@users.noreply.github.com>
2026-10-19 08:35:37 +04:00
Matthew CarrollandClaude Opus 5.5 ac59f2f768 lf: reject fc/2 PSK fallback clocks off nominal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:24:28 -07:00
Matthew CarrollandClaude Opus 5.5 13b841e0b1 lf: cache the fc/2 PSK fallback per graph buffer, name its thresholds
The cache is keyed on a hash of the graph buffer contents: the buffer has
many writers and no change counter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 17:24:28 -07:00
nipandOpenAI coding assistant fe176bb533 MIFARE: replace the pair cap with an acquisition time budget
Replace the artificial 68-pair limit with a 2900 ms inter-attempt
budget.
A completed-pair count does not limit failed RF/authentication retries
and unnecessarily restricts fast PM5 collection.

Keep natural buffer capacity, whole-pair packing, client cancellation,
watchdog handling and the existing 3000 ms client response waits.
A blocking attempt can overshoot; persistent errors may yield an empty
nonce reply.

Add actual-handler regression coverage for PM5, RDV4 and GENERIC.

Co-Authored-By: OpenAI coding assistant <noreply@openai.com>
Signed-off-by: nip <182409448+nip-was-here@users.noreply.github.com>
2026-10-18 22:03:43 +04:00
nipandOpenAI coding assistant 4ab9a26b30 MIFARE: reject incomplete encrypted nonce frames
Validate byte length, unfinished bits, collisions and parity-buffer
length before accepting an encrypted nested nonce. Capture decoder
metadata before CHK_TIMEOUT changes it and retry incomplete responses.

Remove the PM5-only 500 us nested-authentication delay and its override.
Preserve other RF timing, the pair cap, cancellation and watchdog calls.
Add native regression coverage without target-key filtering.

Co-Authored-By: OpenAI coding assistant <noreply@openai.com>
Signed-off-by: nip <182409448+nip-was-here@users.noreply.github.com>
2026-10-18 19:48:44 +04:00
Iceman 693ead0803 Merge pull request #3699 from s00se/replace-deprecated-strtok-with-strtok_r
client: replace deprecated strtok calls with strtok_r
2026-10-18 22:43:20 +07:00
s00se a2501dc6d4 Fixed ndef vcard by replacing deprecated strtok with strtok_r
Use 200112L instead of 200809L
2026-10-18 09:02:13 -06:00
Iceman 42c1c7a76e Merge pull request #3676 from dunderhay/desfire-reader-candidate-probe
Add DESFire reader candidate-key probe
2026-10-18 14:40:53 +07:00
Matthew Carroll 1bc32bff15 Merge remote-tracking branch 'upstream/master' into fix/psk-fc2-bandpass
# Conflicts:
#	CHANGELOG.md
2026-10-17 23:47:19 -07:00
Daniel UnderhayandOpenAI Codex 90525502f1 Add DESFire reader candidate-key probe
Add an opt-in simulator probe that checks a reader's AES authentication continuation against a supplied candidate and stops before the final card response. Expose the result through the firmware protocol and etest bench command, and document the evidence and handshake scope.

Co-Authored-By: OpenAI Codex <noreply@openai.com>
2026-10-18 16:03:57 +11:00
Iceman 23ce7229a7 Merge pull request #3711 from xianglin1998/fpga-merge-clear
FPGA: requirements.txt & run.ys translate & license headers
2026-10-18 10:52:03 +07:00
dxl 781020bf9d FPGA: requirements.txt & run.ys translate & license headers 2026-10-18 11:43:56 +08:00