From 86e7cac1e9fd5e19fd68a633f27eadf2d3f09288 Mon Sep 17 00:00:00 2001 From: David Lam Date: Tue, 8 Oct 2019 04:47:14 -0400 Subject: [PATCH 1/3] Update CHANGELOG.md for Kastle HID high bit change --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e566eec9f..19b0a2b62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Display high bit for detected Kastle HIDs to allow `lf hid clone [id]` to work properly (@swg0101) - Add option `-n` to scripts pm3* (@doegox) - Add `wiegand list/encode/decode` - wiegand format manipulation. Adapted to fit here. (@grauerfuchs) - Add `lf t55xx protect` - sets password and enables password protection on t55x7 tag (@iceman1001) From 1baf51b862486587cdd5474e651f15d74d400556 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 8 Oct 2019 11:49:23 +0200 Subject: [PATCH 2/3] t5577-M3 ATMEL info, thanks @doegox --- client/cmdlft55xx.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index bb4b5415b..fa1cee1e3 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -1792,11 +1792,17 @@ void printT55x7Trace(t55x7_tracedata_t data, uint8_t repeat) { PrintAndLogEx(NORMAL, "-------------------------------------------------------------"); /* + Trace info. + M1, M2 has the about ATMEL defintion of trace data. + M3 has unique format following industry defacto standard with row/col parity + TRACE - BLOCK O Bits Definition HEX 1-8 ACL Allocation class (ISO/IEC 15963-1) 0xE0 9-16 MFC Manufacturer ID (ISO/IEC 7816-6) 0x15 Atmel Corporation - 17-21 CID 0x1 = Atmel ATA5577M1 0x2 = Atmel ATA5577M2 + 17-21 CID 0x1 = Atmel ATA5577M1 + 0x2 = Atmel ATA5577M2 + 0x3 = Atmel ATA5577M3 22-24 ICR IC revision 25-28 YEAR (BCD encoded) 9 (= 2009) 29-30 QUARTER 1,2,3,4 @@ -1806,6 +1812,11 @@ void printT55x7Trace(t55x7_tracedata_t data, uint8_t repeat) { 1-12 LOT ID 13-17 Wafer number 18-32 DW, die number sequential + + + Startup times (FC) + M1, M2 = 192 + M3 = 128 */ } @@ -2319,6 +2330,7 @@ char *GetModelStrFromCID(uint32_t cid) { if (cid == 1) snprintf(retStr, sizeof(buf), "ATA5577M1"); if (cid == 2) snprintf(retStr, sizeof(buf), "ATA5577M2"); + if (cid == 3) snprintf(retStr, sizeof(buf), "ATA5577M3"); return buf; } From 810a70d8a8258bc4fc91cd1ae7b9abad4f14cfbb Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 8 Oct 2019 11:50:43 +0200 Subject: [PATCH 3/3] tweak? --- client/cmdhfmfhard.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/client/cmdhfmfhard.c b/client/cmdhfmfhard.c index c38c4022e..75e647489 100644 --- a/client/cmdhfmfhard.c +++ b/client/cmdhfmfhard.c @@ -237,7 +237,6 @@ static void init_bitflip_bitarrays(void) { uint8_t line = 0; #endif - z_stream compressed_stream; char state_files_path[strlen(get_my_executable_directory()) + strlen(STATE_FILES_DIRECTORY) + strlen(STATE_FILE_TEMPLATE) + 1]; @@ -248,9 +247,11 @@ static void init_bitflip_bitarrays(void) { for (uint16_t bitflip = 0x001; bitflip < 0x400; bitflip++) { bitflip_bitarrays[odd_even][bitflip] = NULL; count_bitflip_bitarrays[odd_even][bitflip] = 1 << 24; + sprintf(state_file_name, STATE_FILE_TEMPLATE, odd_even, bitflip); strcpy(state_files_path, STATE_FILES_DIRECTORY); strcat(state_files_path, state_file_name); + char *path; if (searchFile(&path, RESOURCES_SUBDIR, state_files_path, "", true) != PM3_SUCCESS) { continue; @@ -1637,15 +1638,18 @@ static inline bool bitflips_match(uint8_t byte, uint32_t state, odd_even_t odd_e return true; } - +/* static uint_fast8_t reverse(uint_fast8_t b) { b = (b & 0xF0) >> 4 | (b & 0x0F) << 4; b = (b & 0xCC) >> 2 | (b & 0x33) << 2; b = (b & 0xAA) >> 1 | (b & 0x55) << 1; return b; +} +*/ +static uint_fast8_t reverse(uint_fast8_t b) { + return (b * 0x0202020202ULL & 0x010884422010ULL) % 1023; } - static bool all_bitflips_match(uint8_t byte, uint32_t state, odd_even_t odd_even) { uint32_t masks[2][8] = { {0x00fffff0, 0x00fffff8, 0x00fffff8, 0x00fffffc, 0x00fffffc, 0x00fffffe, 0x00fffffe, 0x00ffffff},