Commit Graph
21803 Commits
Author SHA1 Message Date
kormax d0d562528d Recognize more command codes in 'hf calypso list' 2026-05-12 19:04:02 +03:00
Philippe Teuwen 620e8b4744 Client Makefile: add FORCE* options to mirror the SKIP* options, mostly for maintainers 2026-05-11 21:43:57 +02:00
iceman1001 cbb572afad style 2026-05-11 14:36:17 +02:00
Iceman 9fe6f12859 Merge pull request #3300 from Antiklesys/master
Added SC Operations
2026-05-11 10:49:50 +02:00
Antiklesys 7c1fa4de4b Update cmdhficlass.c
Signed-off-by: Antiklesys <syselkitna@gmail.com>
2026-05-11 14:07:05 +08:00
Antiklesys f73ec7275c Fix formatting in command help text
Signed-off-by: Antiklesys <syselkitna@gmail.com>
2026-05-11 14:05:57 +08:00
Antiklesys 3a293cb98c Update CHANGELOG.md 2026-05-11 13:58:16 +08:00
Antiklesys abe54994d2 Implemented SC operations 2026-05-11 13:54:49 +08:00
Antiklesys b269b83a83 Merge branch 'RfidResearchGroup:master' into master 2026-05-11 13:09:34 +08:00
Iceman 70516ce41d Merge pull request #3288 from suut/desfire-ev3c-support
DESFire EV3C support
2026-05-11 05:19:20 +02:00
suut 6661653316 Remove extra spaces 2026-05-10 23:34:41 +02:00
suut 6d458a9f49 Remove the --force argument from hf mfdes auth 2026-05-10 23:33:37 +02:00
suut b018054bce Fix linter error 2026-05-10 23:28:27 +02:00
suut cfb32e6951 Remove superfluous typing of defines 2026-05-10 23:27:27 +02:00
Iceman a11275a2f7 Merge pull request #3299 from kormax/calypso-list
Add `hf calypso list` command
2026-05-10 20:59:57 +02:00
kormax 3da7e52c1a Implement 'hf calypso list' command 2026-05-10 21:18:04 +03:00
kormax 9399dfc16e Fix ISO7816 trace CRC status handling 2026-05-10 21:18:04 +03:00
kormax 80751a88c0 Add ISODEP trace annotation helpers 2026-05-10 21:17:56 +03:00
Antiklesys d5d00bce0a smartcard-i2c-fixes
## armsrc: smartcard / I2C correctness + SAM compatibility fixes

A focused pass over `armsrc/i2c.{c,h}` and `armsrc/i2c_direct.c` addressing correctness bugs (NULL deref on alloc failure, unbounded recursion, write-failure silently falling through to read), and removing two long-standing SAM-compatibility blockers (`SmartCardSetBaud` was a stub; float in firmware hot path).

### Fixed

- **`SmartCardRaw`: BigBuf_calloc result was unchecked.** NULL deref on memory pressure crashed the firmware. Now bails with `PM3_EMALLOC` before touching `resp[]`.
- **`SmartCardRaw`: `I2C_BufferWrite` failure was only acted on at `dbglevel > 3`.** Lower debug levels silently fell through to `sc_rx_bytes()` reading from a card we never wrote to. The `reply_ng` / `goto OUT` path now runs on any write failure; the `Dbprintf` is the only thing gated on dbglevel.
- **`SmartCardRaw`: replaced float division** `(p->wait_delay * 1000) / 3.07` with integer math via `uint64_t`. Avoids pulling `__aeabi_fdiv` into the ARM image and removes overflow at large `wait_delay` values: `wait = (ms * 100000 + 153) / 307`.
- **`SmartCardUpgrade`: BigBuf_calloc result was unchecked.** Now bails with `PM3_EMALLOC`. Renamed local `verfiydata` typo to `verifydata`. Failure messages now include the offset where the upgrade aborted (`Writing failed at offset 0x%04X` instead of `Writing failed`).
- **`I2C_BufferRead`: rejected `len == 0` but accepted `len == 1`**, which cannot represent the SIM module's 2-byte BE length header (returned -1 cast through int16_t). Tightened to `len < 2`.
- **`WaitSCL_L_timeout`: `return (delay == 0)` was dead code** — post-decrement underflows `delay` to `UINT32_MAX` after the loop, so the expression was always false. Replaced with explicit `return false` and corrected the comment that claimed an 1800 ms cap (actual cap is 1200 ms).
- **`i2c.h`: SIM_WAIT_DELAY comment was wrong** — `150000 * 3.07us = 460 ms`, not 270 ms. Updated comment to match the actual value; constant unchanged.
- **`SmartCardDirectSend`: BigBuf_calloc result for `resp[]` was unchecked.** The next `resp[0] = prepend` would NULL-deref on alloc failure. Now bails.
- **`SmartCardDirectSend`: GET RESPONSE (61xx) chain recursed without bound**, allocating a fresh `smart_card_raw_t` from BigBuf each round. A misbehaving card returning 61xx every time would wedge the device. Added `depth` parameter capped at `SC_DIRECT_MAX_DEPTH` (8); both call sites updated. The GET RESPONSE inner allocation is also now NULL-checked.
- **`SmartCardDirectSend`: same write-failure-silent fix** as `SmartCardRaw`.
- **`SmartCardDirectSend`: same float → integer-math conversion** as `SmartCardRaw`.

### Added

- **`SmartCardSetBaud` is now functional.** Was an empty stub (wired through `pm3_cmd.h` / `appmain.c` dispatch but did nothing). Now sends `I2C_DEVICE_CMD_SETBAUD` (0x04) to the SIM module's main address.

### Notes for follow-up

- `SmartCardSetBaud` is now functional on the firmware side, but no client command exposes it — `client/src/cmdsmartcard.c` has no `setbaud` subcommand. A separate change can wire `CMD_SMART_SETBAUD` into the client if needed; leaving it out of this patch keeps it firmware-only and safe to backport.
- The proxmark3 SIM module's stock asm firmware (`sim013`) silently drops `CMD_SETBAUD`. gentilkiwi's `sim_c` v4.50+ also currently dispatches it to a no-op. Full PPS follow-through requires a SIM-firmware-side patch in addition to this commit.
- Mid-byte SCL stretch timeouts in `I2C_SendByte` / `I2C_ReadByte` are still swallowed (return void / -1, both ignored at most callers). Fixing this requires changing those signatures and verifying every caller — out of scope here, merits its own PR.
2026-05-10 14:35:16 +08:00
Iceman b2689aad92 Merge pull request #3298 from kormax/trace-14b-improvements
Trace 14b improvements
2026-05-09 18:56:53 +02:00
kormax 2529b16662 Annotate ECP in HF 14B traces 2026-05-09 18:33:45 +03:00
kormax eef3721357 Clear trace before HF 14B info 2026-05-09 18:33:45 +03:00
Iceman d198304579 Merge pull request #3296 from kormax/calypso-maintenance
Calypso maintenance
2026-05-08 21:23:59 +02:00
kormax 7ee697aa02 Add new hex print helper 2026-05-08 21:43:54 +03:00
kormax e96b6931e6 Skip attempting GET DATA if reported as unsupported 2026-05-08 19:46:21 +03:00
kormax b2f5ae43c6 Format big GET DATA object entries 2026-05-08 19:45:58 +03:00
kormax a1077d9f7d Retrieve GET DATA objects in 'hf calypso info' 2026-05-08 19:45:27 +03:00
Iceman 486f9f1b00 Merge pull request #3295 from kormax/calypso-implicit-select
Handle implicitly selected DF in 'hf calypso info'
2026-05-08 10:10:02 +02:00
kormax 3a0fdf1ddf Handle implicitly selected DF in 'hf calypso info' 2026-05-07 17:22:03 +03:00
Iceman d3e9638474 Merge pull request #3292 from YoungJules/legic_improvements
Some improvements to a couple lua scripts for Legic.
2026-05-07 12:09:16 +02:00
YoungJules 52005ec95c Some improvements to a couple lua scripts for Legic. Improved help, made the purpose clearer, added json dump support, better support for blank cards, look for KGH (Kaba Group Header) etc. 2026-05-07 11:19:57 +02:00
Iceman a804c64d84 Merge pull request #3290 from sleepwalkera/fix/hitag-s-82xx-cloning
Fix Hitag S / 82xx cloning and compatibility
2026-05-06 22:43:24 +02:00
Iceman 7f9071efa8 Merge pull request #3291 from kormax/calypso-dump-eflist
Improve EF candidate discovery in `hf calypso dump`
2026-05-06 22:42:04 +02:00
kormax e8f6649310 Improve EF candidate discovery in 'hf calypso dump' 2026-05-06 21:57:43 +03:00
sleepwalkera b95a24798f Fix Hitag S / 82xx cloning and compatibility
Fixes an issue where cloning EM410x to Hitag S / 82xx tags (like F8310) would fail on subsequent attempts with "Something went wrong in step 0".

Changes:
- Write sequence: Reordered to write data (Pages 4/5) before configuration (Page 1). The current logic enables TTF mode first, and the resulting broadcast likely interferes with the remaining write commands.
- Handshake: Switched from FADV to ADV1. Some 82xx clones don't seem to respond to FADV once they've been programmed, while ADV1 appears more reliable.
- Config header: Adjusted RES/auth bits to produce a 0xDA header instead of 0xCA. This matches the "standard" configuration used by most standalone 82xx duplicators and fixes issues where tags written by PM3 weren't recognized by other readers.

Tested with F8310 tags. They are now successfully rewritable and work across different 82xx devices.
2026-05-06 16:05:33 +00:00
suut 80b70a37f4 remove unused variable to make compiler happy 2026-05-05 18:27:53 +02:00
Iceman 2893cf6c9b Merge pull request #3289 from kormax/duox-maintenance
DUOX Maintenance
2026-05-05 18:21:47 +02:00
suut 106a9e61a3 refactor the MFC block parsing into a function parse_mfc_blocks 2026-05-05 18:18:03 +02:00
kormax a24fd5382a Remove 'hf mfdes leaf'; use 'hf mfdes verifycert leaf' instead 2026-05-05 18:48:03 +03:00
kormax 7abc9a1563 Use LEAF certificate instead of bare public key 2026-05-05 18:40:18 +03:00
kormax 1167bd9701 Decompose utils from duox-related code 2026-05-05 18:27:19 +03:00
Iceman 59edb4720e Merge branch 'master' into desfire-ev3c-support
Signed-off-by: Iceman <iceman@iuse.se>
2026-05-05 09:52:07 +02:00
Iceman ab4eda6ce5 Merge pull request #3287 from kormax/duox-verifycert
Implement `hf mfd verifycert` command
2026-05-05 09:51:24 +02:00
suut 23fbdd2f52 Fix typo, check if raw blocks are given in ascending order 2026-05-04 23:23:54 +02:00
suut 0e679eaa17 Add the command hf mfdes makemfclicense 2026-05-04 23:16:16 +02:00
kormax fa414f3b65 Implement 'hf mfd verifycert' command 2026-05-04 22:07:33 +03:00
Iceman 2bf48a02c8 Merge pull request #3286 from kormax/drop-old-calypso-mobib
Drop old `hf 14b calypso` and `hf 14b mobib` commands
2026-05-03 14:19:03 +07:00
iceman1001 d6d1df6969 Claude was nice and made an interactive script for editing of trace files. Finally its easy to clean up traces 2026-05-03 13:13:39 +07:00
kormax 7484af6c87 Drop old 'hf 14b calypso' and 'hf 14b mobib' commands 2026-05-03 08:08:15 +03:00
Iceman 5fdbb223b8 Merge pull request #3285 from kormax/calypso-dump
Implement 'hf calypso dump' command
2026-05-03 09:57:14 +07:00