Commit graph

52 commits

Author SHA1 Message Date
Henry Gabryjelski
b5e6d21128 Make it clear that this code was *always* sending a parity bit. All the tags require the parity bit. 2025-06-09 14:54:30 -07:00
Henry Gabryjelski
31b1117a51 em4x70 --par deprecation: Step 2: arm-side always uses false 2025-06-09 12:58:50 -07:00
iceman1001
b4cc21c68f modified hf 14a apdu to report back when extending time and also added a possibililty to interrupt the extension loop with button press or usb commad. A bunch of minor textual changes 2025-03-20 19:58:13 +01:00
iceman1001
3c873d34bc style 2025-03-19 11:26:25 +01:00
Henry Gabryjelski
2aa58457e3 Missing lines from my last commit 2025-03-19 02:34:38 -07:00
Henry Gabryjelski
43e026b1c9 Fix LIW to RM delay
* Change from 40 FC to 72 FC as default delay between detecting LIW and sending the command.
* Use parity for ID, UM1, and UM2 commands
* Remove extra bit hack from AUTH, PIN, and WRITE commands
2025-03-18 23:18:36 -07:00
Henry Gabryjelski
8617541660 rename some constants to increase clarity 2025-03-18 23:06:33 -07:00
Henry Gabryjelski
a588e74e9d rename global variable g_tag 2025-03-18 22:54:46 -07:00
Henry Gabryjelski
ab602794d9 rename global variable g_command_parity 2025-03-18 22:52:19 -07:00
iceman1001
a776f9a0bd style 2025-03-18 08:11:06 +01:00
Henry Gabryjelski
21ad101ff5 Major update to EM4x70 support:
1. Rework how communications with tag occur.
    a. bitstream to be sent to the tag is now fully pre-generated.
    b. bits sent and received are logged with start / end times.

2. Support built-in `hw dbg` for controlling verbosity of debug output

The new bitstream generation and logging has exposed a surprising legacy behavior ... each of the command that sent additional data (beyond the command) were:
* inserting an extra RM zero bit
* force-enabling command parity is used

This was not expected.  However, this PR maintains the behavior of the existing code.

TODO: Root-cause why the third RM bit is needed.  Fix code to remove that hack.

TODO: change the arm/client interface to ONLY use arrays of bytes, with well-defined content endianness, to avoid this problem.
2025-03-16 01:05:55 -07:00
douniwan5788
5d66bcfd75 fix: WITH_EM4x70. Get rid of the dependency on WITH_ICLASS. 2024-08-26 20:55:58 +08:00
iceman1001
369db7c9d7 style 2024-05-27 20:29:02 +02:00
Henry Gabryjelski
b7fff95b7c Improve editor folding (some editors use indentation as cue) 2024-05-14 19:16:37 -07:00
Henry Gabryjelski
d27c084819 Internal code cleanup.
Reduce ambiguity in function and parameter names.
2024-05-14 19:16:05 -07:00
Henry Gabryjelski
483b192d40 rename parameter for em4x70_receive
Avoid generic "length" parameters, as they are often ambiguous.

Prefer `byte_count`, `element_count`, `bit_count` or more explicit names to reduce misunderstandings and thus reduce bugs.
2024-05-13 10:19:00 -07:00
Henry Gabryjelski
18cbc7259c prevent sending corrupt data to em4x70 tags 2024-05-05 16:00:16 -07:00
Henry Gabryjelski
569d57719d Fix firmware return value for em4x70 to always be of type PM3_* 2024-05-05 15:54:00 -07:00
Henry Gabryjelski
c7d7680cd6 Decoder must not write more bit than requested 2024-03-13 23:23:31 -07:00
Henry Gabryjelski
cc2bae2f4d lf em 4x70 writekey --> lf em 4x70 setkey 2024-03-13 09:38:35 -07:00
Henry Gabryjelski
ba83ac065e lf em 4x70 writepin --> lf em 4x70 setpin 2024-03-13 09:25:43 -07:00
Henry Gabryjelski
160d61682b Add lf em 4x70 autorecover
Also:
* common.h: Increase safety of some of the macros.
  Parenthesizing the macro parameters ... a best practice.
* firmware: partially-tracked source of "extra bits" messages.
  Add a TODO comment for further study.
* Improve reliability of `lf em 4x70 writekey`
  Authenticate w/new key after it is written.
  Particularly important for glass modules,
  or other tags with weaker coupling.
2024-03-11 17:14:03 -07:00
nvx
8dd963d305 make style 2023-08-24 16:34:33 +10:00
Henry Gabryjelski
0af484fdee const for em4x70 2023-08-08 23:24:10 -07:00
iceman1001
08d2c2f1a5 style 2023-02-11 11:42:58 +01:00
adite
c7825a2adf Fix bug in 'lf em 4x70 brute' command 2023-02-01 19:28:31 +01:00
Adrian Teuscher
71389e0b17 Add function to brute force partial key 2023-01-27 19:37:40 +01:00
Philippe Teuwen
b703bb746b Adapting license headers, WIP 2022-01-06 02:20:38 +01:00
Łukasz Jurczyk
218a4ba2ec
Added ledcontrol to lf functions 2021-11-18 15:00:54 +01:00
Philippe Teuwen
88308ea727 typos 2021-10-10 01:35:45 +02:00
Philippe Teuwen
75328a34b6 arraylen 2021-05-09 23:37:45 +02:00
iceman1001
9395f8c8ac cppchecker 2021-02-24 00:29:50 +01:00
iceman1001
f65b5eb96d coverity fix #308194 2021-01-29 16:10:33 +01:00
Philippe Teuwen
8d4acbe3a6 make style 2020-12-23 19:51:10 +01:00
Christian Molson
60f36b468d em4x70: Add write key convenience function. Use real values in writekey/auth help text so people with blank tags can program a test key and test authentication. 2020-12-15 12:32:30 -05:00
Christian Molson
dc35f79bd2 em4x70: Add write pin convenience function to write and verify a new pin 2020-12-15 11:22:43 -05:00
Christian Molson
ff762027d9 em4x70: Update receive function with expected bits to receive. 2020-12-15 08:57:11 -05:00
Christian Molson
afbef5ba73 em4x70: clean up check_ack function 2020-12-15 08:34:14 -05:00
Christian Molson
a2c21f1d07 em4x70: fix function names 2020-12-15 08:33:57 -05:00
Christian Molson
f87aa869c6 em4x70: clean up edge detection code 2020-12-15 08:15:18 -05:00
Christian Molson
40654b8ac6 em4x70: Clean up conversion of RF periods to ticks 2020-12-14 19:44:07 -05:00
Christian Molson
334000d444 em4x70: Used fixed threshold for high/low. Since we measure only pulse lengths (high+low) we just need to make sure the value is higher than noise threshold 2020-12-14 16:17:29 -05:00
Christian Molson
701914430f em4x70 makestyle 2020-12-12 10:02:43 -05:00
Christian Molson
13268df9c3 Merge remote-tracking branch 'upstream/master' into em4x70-auth 2020-12-12 10:00:22 -05:00
Christian Molson
a6024a8622 EM4x70 Authentication support 2020-12-12 09:59:30 -05:00
Philippe Teuwen
7cd80611d3 #makestyleday 2020-12-12 14:46:40 +01:00
Christian Molson
ed8c63a4f4 EM4x70 Unlock support. Send pin code to unlock tag. 2020-12-12 01:20:26 -05:00
Christian Molson
4c52fac9e1 EM4x70 write support 2020-12-11 23:26:17 -05:00
Christian Molson
e48d343c5c Fix issue with command parity, adding too many bits to command 2020-12-09 16:22:38 -05:00
Christian Molson
97a27c0156 Remove debug code 2020-12-09 09:57:17 -05:00