Commit Graph
405 Commits
Author SHA1 Message Date
iceman1001andClaude Opus 5 (1M context) 5b909402b5 BigBuf: stop narrowing sizes, and size the 14a modulation buffer to fit
Three things that all cost memory or correctness once BigBuf is larger
than 64KB, which it already is on PM5.

BigBuf_max_traceLen() returned a uint16_t while s_bigbuf_hi is a
uint32_t. At 33272 on AT91 that is harmless; on AT32, where BigBuf runs
to several hundred kbyte, it truncates and LF sampling asks for a
fraction of the buffer that is there. Widened, along with the four
callers that assigned it straight back into a uint16_t.

BigBuf_malloc() and BigBuf_calloc() took a uint16_t chunksize, so a
request of exactly 65536 arrived as 0 and anything above wrapped. It
returned NULL for the 65536 case by accident, not by design. Both take a
uint32_t now and the guard tests the upper bound explicitly, so an
oversized request fails like any other allocation that does not fit.

The 14a tag simulation allocated its dynamic modulation buffer as a flat
512, or 4096 for ST25TA. prepare_tag_modulation() memcpy's the encoded
answer out of the ToSend buffer and tosend_stuffbit() hard caps that at
TOSEND_BUFFER_SIZE, so 1788 of ST25TA's 4096 could never be reached --
it was the largest single allocation of any tag simulation for nothing.
Meanwhile 512 is 68 bytes short of what a full 64 byte response encodes
to, at 9 bytes per byte plus 4, so those answers were refused at
modulation time.

Both are now derived from the response size and capped at what ToSend
can hold: 580 for the default tag types, 2308 for ST25TA. That also
fixes the reason the 4096 never helped -- all six call sites passed the
512 macro as max_buffer_size rather than the size actually allocated, so
ST25TA allocated 4096 and then bounds checked against 512.

Worst case for a simulation that also holds emulator memory drops from
12247 bytes of BigBuf to 10459.

Built for client, RDV4 and PM3GENERIC. Not yet run on hardware.

Co-Authored-By: Claude Opus 5 (1M context)
2026-09-14 13:06:14 +02:00
iceman1001 a0a3eb4bbf remove CMD_LF_SIMULATE_BIDIR, never implemented 2026-08-29 17:38:41 +02:00
iceman1001 d7ed0d5a96 NG: convert CMD_LF_T55XX_SET_CONFIG to t55xx_setconfig_t 2026-08-29 11:28:29 +02:00
dxl e3511c5350 Used HAL layer
in appmain.c and cmd added.
in cmd.c and add some code for test CEP
in em4x50.c(Do not timeout--)
in em4x70.c
in emvsim.c
in epa.c
in felica.c
in felicasim.c
in felicasim.c
in hfops.c
in hfsnoop.c
in hitag2.c
in hitag_common.c(Cross-platform implementation is incomplete.)
in hitagS.c
in hitagu.c
in i2c.c(Incomplete, continue to abstract.)
in i2c_direct.c
in iclass.c
in iso14443a.c(Sniff no finish yet)
in iso14443b.c and fixed bug for st25
in iso15693.c
in legicrf.c
in legicrfsim.c
in lfadc.c(lf_count_edge_periods_ex() improved)
in lfops.c(TI tag no finish yet)
in lfsampling.c
in lfzx.c
in mifarecmd.c
in mifaredesfire.c
in mifaresim.c
in mifaresniff_disabled.c
in mifareutil.c
in pcf7931.c
in sam_xxx
in secc & seos
in start.c
in thinfilm.c
in utils
2026-08-19 15:32:39 +02:00
iceman1001 3525a7bfe8 minor style 2026-06-29 02:07:35 +02:00
towelbyte c1cefd6e38 Complete and working reimplementation of COTAG support
- "lf cotag reader": now behaves mostly the same as "lf read",
   except it is dedicated for COTAG.
	- It makes sure to send COTAG start sequence and to use
          real time sampling mode to get enough samples.

- "lf cotag demod": Working client-side COTAG demodulation implementation
   (high-low raw demod + Manchester demodulation from high/low demod).
	- Now uses samples directly from g_GraphBuffer
	- Supports 3 types of COTAG preamble (1 active, 2 passive), which
          can start anywhere in the samples.
	- Prints full 128-bits of COTAG tag data in 3 formats: raw,
          groupped by nibbles, and in hex, and identifies and
          prints out the card number.

Signed-off-by: andrej@towelbyte.net
2026-06-12 22:49:06 +02:00
iceman1001 af9567a19e style 2025-09-12 22:00:46 +02:00
iceman1001 6ee974b935 swapped from bigbuf malloc calls to calloc calls on device side. Now all allocations should start from a known state of memory 2025-08-20 16:23:36 +02:00
iceman1001 1c52bee9a1 text and style 2025-03-21 11:25:31 +01:00
douniwan5788 214ded2b97 Replace all μ(greek small letter mu, UTF-8 \xce\xbc) to µ(micro sign, UTF-8 \xc2\xb5) 2025-03-19 19:21:01 +08:00
iceman1001 cef07dedf6 code style, code clean up of redundant functions, comments, its many minor fixes across the platform. Sorry for not making 20 commits 2025-02-21 15:38:33 +01:00
Donny 7923d07ed0 Add hid preamble handle function for standalone 2025-02-20 21:49:15 -08:00
Donny c36b352c2f Fix incorrect encoding for HID with long format on sim and clone 2025-02-20 21:49:15 -08:00
Donny 3f794818f0 fix incorrect HID bitlen calculations and wiegand format display 2025-02-15 21:56:19 -08:00
Shawn Hoffman aa286b4a16 fix bigbuf allocators (tracing + malloc) overwriting each other
* BigBuf.c: use s_ prefix for statics
* BigBuf_Clear_ext already calls clear_trace, so remove extra calls
* add some sanity checking of allocator args
* dont compare PDC_RNCR to false
2025-01-24 15:56:45 -08:00
iceman1001 17338e2a5f style 2024-12-31 23:35:16 +01:00
Piotr Rzeszut 5261106098 Add spiffs operation checks, update changelog and documentation after moving t55xx configurations 2024-12-26 21:58:30 +01:00
Piotr Rzeszut dd17effaab Move T55XX config to spiffs file 2024-12-26 19:46:55 +01:00
Piotr Rzeszut 2fe0ba57b2 Change lf t55xx chk -m to read dictionary from spiffs file 2024-12-26 02:52:59 +01:00
ANTodorov 76aaef96cc rework addressing the review comments
Reverted 'mfr_id' to 'manufacturer_id'
Moved devices table definition to flashmem.h
Single global variable 'spi_flash_pages64k'
The local structure holding the actual device data is used in firmware.c only

difference in code:
```
   text    data     bss     dec     hex filename
 223189  138560    6067  367816   59cc8 ./armsrc/obj/fullimage.elf <-- c9e751d darkside: fix backdoor support

 223437  138624    6075  368136   59e08 ./armsrc/obj/fullimage.elf <-- this commit
 ======================================
   +248     +64      +8    +320
```
2024-11-20 14:10:02 +02:00
ANTodorov f3fa732062 refactor spi flash detection 2024-11-19 09:35:26 +02:00
ANTodorov 861c7efd26 fix missing offsets
the data was written, but it should be readable too...
2024-11-17 22:16:35 +02:00
iceman1001 c002ae9f77 style 2024-10-06 10:08:17 +02:00
iceman1001 01a191f385 style 2024-10-01 09:52:46 +02:00
douniwan5788 eca9830050 fix: lf cmdread. skip WaitMS(100) when keep signal field ON.
4 extra symbol.
avoid include SOF in crc-hitag
2024-08-20 22:50:13 +08:00
iceman1001 6bc6ec23ce fix #2346 refactored the write loop before it assumed a full t55xx memory layout. Now handles block writes to individual parts 2024-04-13 10:59:07 +02:00
iceman1001 f5e976afa6 style 2024-02-16 21:59:45 +01:00
iceman1001 c544d67d2b Thanks to the user jareckib for his solution of adding two extra blocks to t5577 in order to clone a more modern Electra tag. Find it under the extra param lf em 410x clone --electra 2024-02-16 21:21:02 +01:00
iceman1001 6597a1705a text 2024-02-04 23:20:56 +01:00
iceman1001 0c4a1066c1 text 2024-01-05 19:27:38 +01:00
iceman1001 6b9963b12a forgot to free the allocated memory 2023-12-14 23:37:37 +01:00
Henry Gabryjelski 665cf3254b more const for lfops and some commonutil 2023-08-14 23:02:09 -07:00
iceman1001 b4255eea77 simplify save files 2022-06-06 13:20:39 +02:00
iceman1001 90fcec0152 add ledcontrol 2022-05-08 09:36:56 +02:00
Philippe Teuwen 9880df8ca7 make style 2022-05-03 15:18:44 +02:00
Philippe Teuwen 7f37958144 Enable support to clone HID on EM4x05 2022-04-30 00:08:10 +02:00
Philippe Teuwen 185a45e749 Add support for cloning Viking and EM410x on EM4x05 2022-04-29 17:32:52 +02:00
Philippe Teuwen 4d264fa63c Preparing EM4100 clone to EM4305 2022-04-29 16:44:38 +02:00
Philippe Teuwen ebba11b3f5 make style 2022-01-06 20:05:26 +01:00
iceman1001 e550f8ccc8 cppcheck fixes for const 2022-01-06 15:40:11 +01:00
Philippe Teuwen bcafc5d03c some historical copyright adjustments, thanks @iceman1001! 2022-01-06 11:24:04 +01:00
Philippe Teuwen b703bb746b Adapting license headers, WIP 2022-01-06 02:20:38 +01:00
iceman1001 0d38da5de2 make style 2021-12-27 19:36:42 +01:00
iceman1001 4493114f4f renamed function and exported it 2021-12-27 17:43:28 +01:00
Philippe Teuwen c3864a0ce5 lf cmdread: add -k to keep field on 2021-12-18 00:43:11 +01:00
Łukasz Jurczyk 218a4ba2ec Added ledcontrol to lf functions 2021-11-18 15:00:54 +01:00
Łukasz Jurczyk 53611b5cad Fixed ledcontrol in SimulateTagLowFrequencyEx 2021-11-17 16:15:27 +01:00
Philippe Teuwen 88308ea727 typos 2021-10-10 01:35:45 +02:00
Philippe Teuwen 9f36ce1b9d cppcheck reduce variable scopes 2021-09-05 23:42:14 +02:00
merlokk ca40ee99d6 make style 2021-08-30 12:36:48 +03:00