Commit Graph
100 Commits
Author SHA1 Message Date
Iceman 2da575ab36 Merge branch 'master' into master
Signed-off-by: Iceman <iceman@iuse.se>
2026-09-06 21:25:31 +07:00
Iceman 23f8bfbc46 Merge pull request #3473 from YoungJules/feature/add_kgh_tools
Feature/add kgh tools
2026-09-06 21:01:40 +07:00
Iceman 8423286160 Merge pull request #3549 from 0x6r1an0y/20260823-mfuformat
Complete `hf mfu format` command
2026-09-06 21:00:20 +07:00
Iceman 45c1d79282 Merge branch 'master' into 20260823-mfuformat
Signed-off-by: Iceman <iceman@iuse.se>
2026-09-06 21:00:13 +07:00
iceman1001 2025e49c09 added missing clock fct for pm5 2026-09-04 15:34:30 +02:00
iceman1001 9a958880ff fix bad txframe variable 2026-09-04 15:21:19 +02:00
iceman1001 0aef94c667 fix 'lf hitag reader -@' mode with sending a break afterwards. 2026-09-04 15:18:16 +02:00
iceman1001 ceda0728b6 remove debug statements 2026-09-04 14:34:19 +02:00
iceman1001 1a34aac8df texts 2026-09-04 13:32:54 +02:00
iceman1001 ace5d63ff9 hitag2: fix simulation against genuine readers, add restore, fix info
Simulation now completes the full exchange with a genuine Paxton reader in
password mode, and crypto mode read/write passes Proxmark-to-Proxmark.

Firmware:
- SOF was one bit period short. The lead-in that compensated for the lost
  head half bit was removed and nothing replaced it, so readers rejected
  every answer with a second START_AUTH. Default is now 6.
- The edge-detect threshold was latched before being measured, so the value
  chosen depended on whether the Proxmark was in a field when sim started.
  It is now measured on field entry and re-armed when the reader leaves.
- The percentile walk latched on run-scoped variables, so one attempt made
  outside a field poisoned every later one.
- Field loss was detected from TIMESTAMP, which is free-running MCU time and
  never stalls. Detect it from receive silence instead.
- Frames of a length the protocol does not have no longer reach the state
  machine; our own modulation tail was resetting the session and breaking
  every write.
- A dropped edge merges two or three reader bit periods into one gap. Those
  bits were discarded; they are now recovered by decomposition, which is what
  made crypto mode work (AUTH decode 15% -> 100%).
- Threshold selection is limited to 20 and 32 and settles in under 25 ms.

Client:
- lf hitag info printed a hardcoded 0x06 and reported 'Password mode' for
  every tag. It now reads page 3, takes -k (4 bytes password, 6 bytes
  crypto), and says so when the config cannot be read.
- lf hitag restore: writes a dump back in dependency order - user pages,
  then key material, then config last - validates the config byte, and
  prints the credential the tag will require afterwards.
- lf hitag crack2 now reports why it failed instead of a bare 'fail'.
- trace list: bit count moved to its own column, relative mode shows a
  Frame Delay Time row rather than renaming Start/End, --frame and -r
  rejected together.
2026-09-04 13:20:29 +02:00
iceman1001 d85550c6de text 2026-09-04 10:18:08 +02:00
iceman1001 ff387762b4 text 2026-09-04 10:16:34 +02:00
iceman1001 50c1c72136 added some sample dump files and trace file for hitag2 2026-09-03 19:35:58 +02:00
iceman1001 1b631a288a text output 2026-09-03 19:31:56 +02:00
iceman1001 12bd5736ad renamed script 2026-09-03 19:23:39 +02:00
iceman1001 a7918d5135 style 2026-09-03 18:30:00 +02:00
iceman1001 d397e62665 bad compare signed 2026-09-03 18:29:01 +02:00
iceman1001 6616e939f7 the changes to the PM5 button press influenced PM3 button press to enter bootloader. This make sure to seperate those two behaviors from eachother on each device platform 2026-09-03 18:26:09 +02:00
iceman1001 b0c1e42720 textual changes and layout changes to 'lf hitag list'. Now it is more uniform with the rest of the annotation formats 2026-09-03 18:15:44 +02:00
iceman1001 54bbff4c8c hf mad: fix aarch64 -Wstringop-overflow false positive in mad encode
GCC on aarch64 vectorizes the sector fill loop in parse_sector_ranges()
into 16-byte NEON stores. When it versions the loop it loses the range
relationship between count and max_sectors, and reports a 16-byte store
into the last 8 bytes of sectors[40]. The code was correct; the guard
was there. Does not reproduce on x86-64 gcc 14.

Accumulate sectors in a uint64_t bitmask instead of an array, so there
is no store for -Wstringop-overflow to mis-size on any target. Sector
numbers are already validated to 1..39, so the bound check is no longer
needed. Supersedes the sectors[48] padding, which only absorbs a
16-byte vector and would regress on wider ones.

Side effect: duplicate sectors within a single --aid argument now
dedupe instead of erroring (E103:1-3,2 encodes 1-3). Conflicts between
different --aid arguments still error.
2026-09-03 16:55:15 +02:00
iceman1001 08a31f01db client now supports tilde sign '~/´ in paths 2026-09-03 14:59:37 +02:00
Iceman 130219fb99 Merge pull request #3588 from mfcarroll/agents-md
AGENTS.md: say what new comments should look like and add checklist line
2026-09-03 14:53:21 +07:00
Iceman 2475ed7ea9 Merge pull request #3564 from digitalhoax/feature/hf-legic-rdv4
Add Legic Prime 7-slot RDV4 standalone mode (HF_LEGIC_RDV4)
2026-09-03 14:52:42 +07:00
Iceman 3339922ec8 Merge pull request #3587 from JasonYuan869/fix-wifi-wsc-ndefread
Improve ndef wsc parsing
2026-09-03 13:30:34 +07:00
Iceman feae212f3d Merge pull request #3586 from Msprg/pm5-android-ble-doc
Docs: Add PM5 BWM BLE connection instructions
2026-09-03 09:41:52 +07:00
Iceman 710a1968e9 Merge pull request #3584 from nieldk/BWM-work
Enhance bwm_wifi_forward_down for better disable confirmation
2026-09-02 23:44:39 +07:00
Iceman 89c0682990 Merge pull request #3583 from nieldk/BWM-work
Improve BLE negitiation and corrected wifi status
2026-09-02 20:06:40 +07:00
Iceman 1d97fda4b4 Merge pull request #3582 from Msprg/pm5-fix-lowbatt-shutdown-vusb
PM5 low-batt shutdown: gate power-off on VUSB pin, not charger PG bit
2026-09-02 20:05:31 +07:00
Iceman d1e0476278 Merge pull request #3580 from nieldk/master
Update helptext in cmdhw.c
2026-09-02 14:51:45 +07:00
Iceman 7220df2500 Merge pull request #3577 from mfcarroll/t55xx-psk3-ambiguity
lf t55xx: correctly report the psk2/psk3 ambiguity
2026-09-02 14:51:24 +07:00
Iceman 866516f440 Merge pull request #3578 from innocentbystanderproxmark/update-documentation
Making the Documentation better and clearer
2026-09-02 11:25:21 +07:00
Iceman 93ca09f3a8 Merge pull request #3576 from pkilar/epassport-extended-docnum
Fix the ePassport personal number read from the MRZ optional-data field
2026-09-02 02:55:42 +07:00
Iceman 1a50403254 Merge branch 'master' into epassport-extended-docnum
Signed-off-by: Iceman <iceman@iuse.se>
2026-09-02 02:55:11 +07:00
Iceman 4d00e241e5 Merge pull request #3575 from pkilar/epassport-caption-wrap
Name the ePassport files each detail tab actually drew from
2026-09-02 02:05:33 +07:00
Iceman 450e3dfaaa Merge pull request #3573 from pkilar/epassport-dg13-pesel
Decode ePassport EF_DG13, and read Poland's PESEL from it
2026-09-02 00:59:36 +07:00
Iceman 4d0280dbb3 Merge branch 'master' into epassport-dg13-pesel
Signed-off-by: Iceman <iceman@iuse.se>
2026-09-02 00:59:23 +07:00
Iceman e1a56dff85 Merge pull request #3574 from pkilar/epassport-disabled-button
Fix ePassport disabled buttons drawing as three bands
2026-09-02 00:58:00 +07:00
Iceman 0d8b99b2a1 Merge pull request #3571 from DidierA/aarch64
fixes compile fail on aarch64 (issue #3394)
2026-09-01 23:30:40 +07:00
Iceman 083cd7ac15 Merge pull request #3572 from xianglin1998/improve-sp-send-speed
Improve serialport send speed
2026-09-01 23:30:04 +07:00
Iceman 2da2fda378 Merge pull request #3570 from pkilar/hf14b-wtx-timeout
hf 14b: scale the WTX timeout, not the shift
2026-09-01 23:27:02 +07:00
iceman1001 12a890f444 text 2026-09-01 16:24:46 +02:00
iceman1001 89b1de6526 user supplied keys was not taken in consideration and also it left the field on 2026-09-01 16:17:35 +02:00
iceman1001 81a6f3bf3d style 2026-09-01 13:34:23 +02:00
iceman1001 be88db1b54 move clock 2026-09-01 13:34:02 +02:00
iceman1001 b65017ceaf move clocks 2026-09-01 13:32:49 +02:00
iceman1001 2fc7f81a4a fix PM3_GENERIC builds. dont compile SAM-sim module things 2026-09-01 13:30:04 +02:00
iceman1001 2f8f72b679 text 2026-09-01 13:06:08 +02:00
iceman1001 b2fa9d540e usart: drop the rx ring, read straight from the PDC banks
Saves 1040 bytes of .bss (BigBuf on AT91), removes a second copy of every
byte, and fixes a full/empty ambiguity where filling the ring to exactly
sizeof(us_rxfifo) left low == high, so usart_rxdata_available() returned 0
and the next bank overwrote 1 kB of received data.
2026-09-01 13:01:44 +02:00
iceman1001 f4bfda2b3c fix overzealous check for data_availablitity in 'hf 15/iclass' commands 2026-09-01 12:59:50 +02:00
iceman1001 db7686d988 forgot to empty the trace when clearing bigbuf 2026-09-01 12:55:38 +02:00
iceman1001 96ed916074 recompress fpga streams 2026-09-01 11:34:45 +02:00
iceman1001 83c3f81b1b move to 16kb fpga ring buffer size, recompile fullimage and lower stack size to 7160 bytes 2026-09-01 10:14:35 +02:00
Iceman ea5b017299 Merge pull request #3568 from innocentbystanderproxmark/master
Consolidiating/Cleaning up PM5 First Time Use documentation
2026-09-01 15:08:45 +07:00
Iceman 6c5be68fe7 Merge pull request #3565 from pkilar/epassport-diagnose-failed-reads
Fix ePassport reporting of failed reads, and decode EF_CardAccess
2026-09-01 15:08:15 +07:00
iceman1001 7326003be3 lessen stack usage 2026-09-01 06:41:00 +02:00
iceman1001 453c192a32 lessen stack usage 2026-09-01 06:40:46 +02:00
iceman1001 ef2ffa2bb4 lessen stack usage 2026-09-01 06:40:26 +02:00
iceman1001 70b2262326 lessen stack usage 2026-09-01 06:40:07 +02:00
iceman1001 f1cc02a6ca lessen stack usage 2026-09-01 06:39:04 +02:00
iceman1001 03f9601cc2 lessen stack usage 2026-09-01 06:38:29 +02:00
iceman1001 ab7729259f fix multi tech timings in the trace list. 'hf iclass sam' or 'hf seos sam' 2026-08-31 21:59:32 +02:00
iceman1001 81aa2d437a Real SPI completion wait 2026-08-31 19:47:17 +02:00
iceman1001 7556dd8fc0 Resync drain after framing error 2026-08-31 19:45:23 +02:00
iceman1001 179de04301 Clear ring per send, check start ack 2026-08-31 19:43:38 +02:00
iceman1001 41f8afbfc8 Re-assert HF field every sample when running hf/lf tune 2026-08-31 19:41:40 +02:00
Iceman cb3a21d015 Merge pull request #3562 from pkilar/epassport-blank-panes
Fix ePassport FILES and LOG panes drawing nothing
2026-09-01 00:10:44 +07:00
Iceman 5e19ee7d38 Merge pull request #3559 from Antiklesys/master
Extended T=1 support
2026-08-31 16:03:36 +07:00
Iceman b3c1ebaade Merge pull request #3558 from nieldk/master
BWM: negotiate ESP/AT32 UART baud up from 460800
2026-08-31 16:00:47 +07:00
Iceman be7f55f72b Merge pull request #3555 from munzzyy/fix/xerox-view-info-block-oob
Fix heap out-of-bounds read in hf xerox view on short dump files
2026-08-31 03:50:44 +07:00
Iceman 5a1d93a2a4 Merge pull request #3557 from Antiklesys/master
Bugfix: stale ISO14443A scheduler delay
2026-08-31 02:19:43 +07:00
Iceman ff94b8b376 Merge pull request #3554 from actuallysparky/codex/emrtd-sod-stack-overflow
fix(eMRTD): move EF_SOD parser buffers off the stack
2026-08-31 02:18:08 +07:00
Iceman 7a56985ba5 Merge pull request #3556 from nieldk/master
Change Dbprintf to display voltage in mV instead of V
2026-08-31 02:16:43 +07:00
Iceman 8e405a7fe8 Merge pull request #3550 from pkilar/epassport-startup-segfault
Fix ePassport viewer segfault on startup
2026-08-31 01:26:28 +07:00
iceman1001 9e2092fc66 capabilities: report device frame size so the client can adapt
PM3_CMD_DATA_SIZE went 512 -> 624 without a capabilities bump, so a new
client connects to old firmware and every oversized command dies at the
device's length check with no message.

Append max_cmd_data_size, bump to v9. The client now accepts an older
capabilities struct - it only ever grows by appending, so an older layout
is a prefix - and defaults the frame size for pre-v9 firmware.
SendCommandNG bounds by the device value instead of the compile time one.

Also zero init capabilities_t on the device, it leaked stack bytes.
2026-08-30 20:13:38 +02:00
iceman1001 6d2c35b05b The slight increase of array size makes us use the usb packages the AT91 sends which is 64bytes of size. We maximizing the available bytes basically and it comes with a slight cost of .bss and stack cost. Making bigbuff just abit smaller. We gain: 600 kBs -> 630 kB/s and less number of frames being sent over the wire. \n\nWhen it comes to Pm5 it will need to find its own aligned size to optimize transfers 2026-08-30 19:21:28 +02:00
iceman1001 b7bd6ddadb fix return value that break 'hf search', Thanks @atk! 2026-08-30 19:11:37 +02:00
Iceman 70aa0309e7 Merge pull request #3553 from nieldk/master
Updated BWM usage doc
2026-08-30 23:41:50 +07:00
iceman1001 26d85264d3 add some more output for speed check 2026-08-30 16:55:15 +02:00
iceman1001 ca5913a2db text 2026-08-30 16:54:20 +02:00
iceman1001 52eb6118e7 text 2026-08-30 14:03:26 +02:00
iceman1001 6d67465d7d hf plot: convert CMD_FPGAMEM_DOWNLOADED to NG
The FPGA trace loop was the last OLD reply on the device outside the two
the bootrom also serves. It stayed OLD because the DMA double-buffer was
sized to the frame payload and an NG header did not obviously fit in
front of it.

DMA straight into chunk->data of a download_chunk_t instead, so a filled
buffer is already a complete NG payload and needs no copy. Chunking now
follows DOWNLOAD_CHUNK_MAX and scales with PM3_CMD_DATA_SIZE. The
terminator carries download_done_t like the other bulk downloads. No
client change needed, dl_it already had the NG branch.

Two fixes fall out of it:

FPGA_TRACE_SIZE is 3072, an exact multiple of 512 but not of
DOWNLOAD_CHUNK_MAX. Each transfer is now armed for exactly the bytes
still expected - arming a full chunk for the short last one would spin in
FPGA_SSC_DMA_RX_Done() forever. This also drops the stray extra DMA the
old loop left armed.

get_tosend() moved after FpgaDownloadAndGo(). The loader calls
BigBuf_free(), which nulls s_toSend.buf, then reuses that same region for
its decompression ring buffer - the old code captured the pointer before
the free and only worked because the loader was done with it in time.

3072 bytes goes from 6 OLD frames to 7 NG frames at PM3_CMD_DATA_SIZE
512, and would be 5 at 688.
2026-08-30 14:02:18 +02:00
iceman1001 1d87a6c192 chunk CMD_READ_MEM_DOWNLOADED by the OLD frame size reply_old clamps its payload to PM3_CMD_DATA_SIZE_OLD but the sender still
chunked by PM3_CMD_DATA_SIZE. Identical today, but if the NG size moves the
chunk would be built oversized, truncated on the wire, and still announced
at full length in oldarg[1] - the client would copy past the valid bytes and
advance by the wrong stride. Bound the client's OLD download branch by the
same constant.
2026-08-30 13:33:50 +02:00
iceman1001 ed066d84aa 'hf mfu cchk' - widen 3-pass chkkey nkeys to a full byte
nkeys was a 6 bit field but the client chunked by what fits in a frame -
123 keys in segment mode. nkeys wrapped to 59 while memcpy copied all 123
and the loop advanced by 123, so 64 of every 123 keys were never tested
and never reported. Full key mode was unaffected, it chunks 30.

Give nkeys its own byte. MIFAREU3P_CHKKEY_HEADER goes 18 -> 19, costing
one byte of payload, and segment mode chunks 123 again

Payload layout changed: client and firmware must be updated together.
Thanks Claude!
2026-08-30 13:25:50 +02:00
iceman1001 25d958e5e6 split PM3_CMD_DATA_SIZE_OLD out of PM3_CMD_DATA_SIZE
The OLD frame size was tied to the NG one, but the bootloader only speaks
OLD - growing PM3_CMD_DATA_SIZE would silently change sizeof(PacketCommandOLD)
and break flashing against every deployed bootrom in both directions.

Pin the OLD structs to their own constant and use it on every OLD path:
reply_old and the OLD receive branch on both sides, the bootrom, and the
flasher's write_block/send_finish_write_cmd, which memcpy into a
PacketCommandOLD using the NG size.

No behaviour change - both constants are 512 and armsrc .text is
byte-identical before and after.
2026-08-30 13:03:53 +02:00
iceman1001 50c63690cd iso15693: share one response buffer across the reader helpers
Each helper had its own uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH],
2116 bytes, and the SLIX/AFI helpers nest up to three deep - write_afi
-> set_pass_Slix -> set_pass_SlixRnd put over 6 kB of the 8.4 kB stack
into one chain. No helper reads its response across a nested call, so
one shared buffer serves all of them.

Worst chain from AppMain 6848 -> 4544 bytes, measured with -fstack-usage.
Costs 2120 bytes of bss, so BigBuf goes 35108 -> 32988.

SimTagIso15693 keeps its own buffer, it does not nest.\n Thanks Claude!
2026-08-30 12:06:51 +02:00
iceman1001 2f6cb9e45c text 2026-08-30 11:36:17 +02:00
iceman1001 87cea09fd7 don't inline version info on device side, keeps 1.5kB out of the AppMain stack frame
SendVersion holds three PM3_CMD_DATA_SIZE sized buffers. Inlined into AppMain they sat in its frame for the whole main loop, not just while CMD_VERSION was handled. Marking it noinline makes the frame transient.

AppMain frame 2160 -> 1160 bytes, measured with -fstack-usage.  Thanks Claude!
2026-08-30 11:34:17 +02:00
iceman1001 2714628baf swap to bigbuf_calloc in pcf7939 Write on device side to lessen RAM footprint, Thanks Claude! 2026-08-30 11:29:39 +02:00
iceman1001 27dd62e329 use bigbuf_calloc to dynamic allocate sniffing arrays when iso15693 sniffing. Thanks Claude 2026-08-30 11:27:41 +02:00
iceman1001 d3f1c6dd5e fix proper calloc failure handling. Thanks Claude! 2026-08-30 10:19:59 +02:00
iceman1001 02f2c0ad34 fix a hidden starvation of bigbuf during long running sc sessions. Thanks Claude! 2026-08-30 10:12:33 +02:00
Iceman 26fcf38864 Merge pull request #3551 from Antiklesys/master
NULL-check fix
2026-08-30 14:48:52 +07:00
Iceman 1d035e8643 Merge pull request #3498 from 0x6r1an0y/20260823-ndefnlen
Correct NLEN log message and empty record example
2026-08-30 04:28:30 +07:00
iceman1001 a1053ad70d New individual json dump file formats for ht1, ht2, htS, htU. '.bin' / binary format for hitag has been deprecated 2026-08-29 20:58:59 +02:00
Iceman dda9d7dd1c Merge pull request #3548 from nieldk/master
add hw bwmwifi status
2026-08-30 01:51:45 +07:00
iceman1001 009490134b revert 2026-08-29 20:37:18 +02:00
iceman1001 d1386baae2 honor T=x framing 2026-08-29 20:29:09 +02:00
iceman1001 d9b8f75b0c make T=0 / T=1 autonegate over sim... 2026-08-29 20:05:19 +02:00
Iceman bb18ff0e49 Merge pull request #3547 from nieldk/master
Refine low battery shutdown conditions
2026-08-30 00:42:33 +07:00
iceman1001 7fade30465 remove commented out code 2026-08-29 17:48:25 +02:00