Commit Graph
100 Commits
Author SHA1 Message Date
iceman1001 465deeda39 text 2026-09-14 12:24:31 +02:00
iceman1001andClaude Opus 5 (1M context) 971c318d78 smart raw: make --t1 switch the card to T=1 by itself
A card runs the protocol its TD1 names until a PPS changes it. --t1 only
picked the module's T=1 send opcode, so on a card whose ATR offers T=0 first
the APDU went out as T=1 blocks to a card still speaking T=0 and got no
answer at all:

  smart raw --t1 -s -d 00a4040007a000000004101000
  [!] smart card response failed

'smart pps --t1' in the same client session made it work, which is what the
help for 'smart pps' already promised was unnecessary:

  Note 'smart raw --t1' already switches a card to T=1 by itself when
  the ATR offers it; this is for negotiating Fi/Di explicitly.

Do it for real. SmartCardRaw() now runs the PPS when T=1 is asked for and
nothing has selected it yet, taking the ATR it needs first because PPS is
only legal in that window. It fires once per activation: a second --t1 apdu
sees the protocol already in force and sends straight away. A card that does
not offer T=1 is left alone and the apdu still goes out, as before.

Also fix the flag names in the docs and in the error path. 'smart raw's
first example and both 'Choose either' messages said -0 / -1, which have
never existed. tools/pm3_online_tests.sh had copied the example, so its T=0
checks failed with 'invalid option' on every run; its T=1 checks needed no
change beyond dropping the now unnecessary reset.

Co-Authored-By: Claude Opus 5 (1M context)
2026-09-12 23:54:39 +02:00
Niel Nielsen f8a0ed0096 Add files via upload
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-01 17:57:31 +02:00
Niel Nielsen 9df1c62ec5 Add files via upload
Signed-off-by: Niel Nielsen <nieldk@gmail.com>
2026-09-01 17:57:31 +02:00
iceman1001 35c098d489 make style 2026-08-29 17:42:29 +02:00
iceman1001 377d7cd612 since it still felt a bit slow, Claude came up with the idea of burst mode transfers. A new sim module firmware 'sim022.bin' and we now can auto-negotiate for TA1 = 0x95 which give us 125 000 bits/s which is almost 10x from the 10752 bits/s we were doing before. Thanks Claude! 2026-08-28 01:16:11 +02:00
iceman1001 76181dfb8e sim module firmware is now v4.60, (sim020.bin) it adds a better drain when T=0 exits abnormal (abort). Better waiting time floor, with faster ETU which doesnt shrink with WWT.\n Changes to i2c with SDA timings, also modified the fixed msleep(100) with an idle time waiting which leads to 107 ms off from every iteration.\n Added a ATR cache to remember which TA1 was autonegotiated. This impact i2c comms speed with sim module for same card. 'smart pps' is better documented.\n The sam_common.c now also logs 61xx and GET_RESPONSE :) and generic long-form ASN-1 lengths. trace list -t 7816 now also shows rdr frames in us. \n All in all, this should lead for 'emv reader -w' to go from 5.87sec to 2.78sec. 'hf seos sam' is down to 1.92sec. 'hw ping' is down to 0.57sec. A USB round trip is down from 20.8ms to 1.3ms. It should give a snappier end user experience 2026-08-27 22:37:32 +02:00
iceman1001 9040f60f17 text 2026-08-27 15:41:43 +02:00
iceman1001 84ad2fb8d4 new sim module firmware, shorter delays for T=0 transfers 2026-08-27 01:38:46 +02:00
iceman1001 35d1cb4fa7 fixed timings, T=1 <> T=0 swaps when emv card doesn't support T=0, 2026-08-26 23:57:47 +02:00
iceman1001 dcb474a963 added ISO 7816-3 protocol and parameter selection exchange command. wired up T=1 in device side and fixed timing issues too. Thanks Claude 2026-08-26 20:42:39 +02:00
iceman1001 7d66359ee6 fix coverity #910789 2026-07-01 22:37:20 +02:00
achazal 232bb1959c fix(pcsc): add comment explaining the use of a 256 bytes buffer 2026-03-24 14:21:00 +01:00
achazal 033a734ceb fix(pcsc): remove infinite loop and buffer overflow in smart pcsc 2026-03-24 10:49:59 +01:00
Philippe Teuwen f93c9977ad hf 14a info: add ATR fingerprinting 2025-09-20 12:32:03 +02:00
iceman1001 2597c7576e style 2025-07-10 11:52:39 +02:00
iceman1001 607f1bb26c style 2025-05-24 22:49:46 +02:00
iceman1001 ad292e8810 unify test - step 2 2025-03-25 10:17:42 +01:00
Philippe Teuwen ad84875afd cppcheck nullPointerOutOfMemory 2025-03-24 23:46:43 +01:00
iceman1001 4d603a4530 unify hint text 2025-03-20 22:55:26 +01:00
iceman1001 17a8f0f9c2 text 2025-03-20 12:17:37 +01:00
iceman1001 323a4284ff modified weigand formats to include number of bits 2025-02-22 18:28:38 +01:00
iceman1001 9ddd833cba fix string handling and styles 2024-11-02 14:50:31 +01:00
Philippe Teuwen 153064ddfa Fix a bunch of potential buffer overruns with CLIGetStrWithReturn :
Most prominent one was "lf pac clone --cn 123456789" causing garbage on the terminal
Some changed code was valid before but as ppl tend to copy-paste to new code,
better to uniformize and document usages of CLIGetStrWithReturn.

Exceptions left are when filling real buffers (bin, raw,...), not strings.
2024-07-30 22:23:04 +02:00
iceman1001 96a68a1ddc fuzzing seems to believe we would actually write more than 50 bytes of ATR... 2024-02-19 18:21:19 +01:00
iceman1001 b910d7ea94 make miscchecks 2024-02-17 14:47:49 +01:00
iceman1001 f5e976afa6 style 2024-02-16 21:59:45 +01:00
iceman1001 c3e269d1b6 took PR #2283 and fixed it up. Added contact inteface to PCSC pass through (@gm3197) 2024-02-10 19:00:01 +01:00
iceman1001 05353deb4a unified verbose param text and fixed behavior 2024-01-18 19:46:14 +01:00
nvx d2d6f80d11 Fix some missing frees, null dereferences and missing initialisation picked up by clang-analyzer 2024-01-16 00:22:53 +10:00
iceman1001 fda0968db2 white space and adding hf_unisniff to buildscript 2024-01-02 23:11:51 +01:00
iceman1001 fdc1c9d864 text 2023-12-06 22:16:53 +01:00
wh201906 10ab013f5b Use defined return value 2023-11-25 11:09:16 +08:00
wh201906 493383c995 Fix ExchangeAPDUSC() in cmdsmartcard.c
It doesn't return 1 if the retry fails, which is different from the
behavior of the first try.
2023-11-24 22:20:26 +08:00
Philippe Teuwen 97f2770982 Ignore mbedtls header sitch-enum warnings 2023-11-13 09:25:41 +01:00
Grayson Martin e65263c73b run make style 2023-11-11 14:32:09 -06:00
Grayson Martin db3c86958a implement smartcard daemon relay for iso14b cards 2023-11-11 14:30:31 -06:00
Grayson Martin 4e346e8ca2 Merge branch 'master' into smartcard-relay 2023-11-11 13:05:11 -06:00
iceman1001 b0ee6ae67b fixes ntag424 2023-10-30 12:55:23 +01:00
iceman1001 4f96d3eb46 style 2023-10-03 17:10:39 +02:00
iceman1001 bb5d61dca7 added some helper functions 2023-10-01 13:05:08 +02:00
iceman1001 1234b08132 adapt to new sim module firmware version 2023-09-28 08:46:04 +02:00
iceman1001 44fe3ec38f smart raw --timeout parameter 2023-09-27 22:09:01 +02:00
iceman1001 b6e1344e1c added a custom timeout parameter to the smart raw command 2023-09-16 18:38:53 +02:00
iceman1001 d7f306084a colors for kiwi 2023-09-15 21:48:57 +02:00
Grayson Martin 8af75cb220 make style 2023-07-11 15:42:30 -05:00
Grayson Martin dfc7104799 add additional info to smart relay cmd help text 2023-07-11 15:26:50 -05:00
Grayson Martin 8bb4949016 Finish initial implementation 2023-07-11 15:11:01 -05:00
Grayson Martin 7028944ee0 Begin cmd 2023-07-11 10:55:43 -05:00
zebbe94 ee8759bc8b fix typo 2023-01-16 01:06:12 +01:00