From 365ffc5f695539a03ab9f8e82b60b7ce2a1263eb Mon Sep 17 00:00:00 2001 From: Christine Barron Date: Sun, 13 Feb 2022 13:27:31 -0800 Subject: [PATCH 1/4] Bugfix updating NXP GET_SYSTEM_INFO command to 0xAB instead of 0x2B (as per section 9.5.3.18 in technical docs: https://www.nxp.com/docs/en/data-sheet/SL2S2602.pdf) --- client/src/cmdhf15.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 38f07b6ae..ea46c914d 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -654,7 +654,7 @@ static int NxpSysInfo(uint8_t *uid) { uint16_t reqlen = 0; req[reqlen++] |= ISO15_REQ_SUBCARRIER_SINGLE | ISO15_REQ_DATARATE_HIGH | ISO15_REQ_NONINVENTORY | ISO15_REQ_ADDRESS; - req[reqlen++] = ISO15693_GET_SYSTEM_INFO; + req[reqlen++] = ISO15693_GET_NXP_SYSTEM_INFO; req[reqlen++] = 0x04; // IC manufacturer code memcpy(req + 3, uid, 8); // add UID reqlen += 8; From 61ece3a2a19f60ea3ae5c4b3ce6a585e95801843 Mon Sep 17 00:00:00 2001 From: Christine Barron Date: Mon, 14 Feb 2022 23:29:46 -0800 Subject: [PATCH 2/4] Sketchy way to check if card is SLIX2, will revise with bitwise operators --- client/src/cmdhf15.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index ea46c914d..ff9b290b6 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -930,8 +930,16 @@ static int CmdHF15Info(const char *Cmd) { } // Check if SLIX2 and attempt to get NXP System Information - PrintAndLogEx(DEBUG, "4 & 08 :: %02x 7 == 1 :: %u 8 == 4 :: %u", data[4], data[7], data[8]); - if (data[8] == 0x04 && data[7] == 0x01 && data[4] & 0x80) { + PrintAndLogEx(DEBUG, "Byte 6 :: %02x Byte 7 :: %02x Byte 8 :: %02x", data[6], data[7], data[8]); + + // SLIX2 uses xxx0 1xxx format on data[6] of UID + // Convert to bits to check if pattern match + uint8_t data6_bits[sizeof(data[6]) * 8]; + bytes_to_bytebits(&data[6], sizeof(data[6]), data6_bits); + PrintAndLogEx(DEBUG, "Card Type: %u, %u", data6_bits[3], data6_bits[4]); + + if (data[8] == 0x04 && data[7] == 0x01 && data6_bits[3]==0 && data6_bits[4]==1) { + PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info"); return NxpSysInfo(uid); } From 22ea1b864f18165096e84d5974493c3eb16f0ce5 Mon Sep 17 00:00:00 2001 From: Christine Barron Date: Mon, 14 Feb 2022 23:39:32 -0800 Subject: [PATCH 3/4] Refactored to cleaner version using bit mask --- client/src/cmdhf15.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index ff9b290b6..78d231bfe 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -933,12 +933,10 @@ static int CmdHF15Info(const char *Cmd) { PrintAndLogEx(DEBUG, "Byte 6 :: %02x Byte 7 :: %02x Byte 8 :: %02x", data[6], data[7], data[8]); // SLIX2 uses xxx0 1xxx format on data[6] of UID - // Convert to bits to check if pattern match - uint8_t data6_bits[sizeof(data[6]) * 8]; - bytes_to_bytebits(&data[6], sizeof(data[6]), data6_bits); - PrintAndLogEx(DEBUG, "Card Type: %u, %u", data6_bits[3], data6_bits[4]); + uint8_t nxpversion = data[6] & 0x18; + PrintAndLogEx(DEBUG, "NXP Version: %02x", nxpversion); - if (data[8] == 0x04 && data[7] == 0x01 && data6_bits[3]==0 && data6_bits[4]==1) { + if (data[8] == 0x04 && data[7] == 0x01 && nxpversion == 0x08) { PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info"); return NxpSysInfo(uid); } From e2f12b1020993649ad009becb66fdd7a318512aa Mon Sep 17 00:00:00 2001 From: Christine Barron Date: Tue, 15 Feb 2022 10:17:31 -0800 Subject: [PATCH 4/4] Style --- client/src/cmdhf15.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 78d231bfe..8bd79cb76 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -931,12 +931,10 @@ static int CmdHF15Info(const char *Cmd) { // Check if SLIX2 and attempt to get NXP System Information PrintAndLogEx(DEBUG, "Byte 6 :: %02x Byte 7 :: %02x Byte 8 :: %02x", data[6], data[7], data[8]); - // SLIX2 uses xxx0 1xxx format on data[6] of UID - uint8_t nxpversion = data[6] & 0x18; - PrintAndLogEx(DEBUG, "NXP Version: %02x", nxpversion); - - if (data[8] == 0x04 && data[7] == 0x01 && nxpversion == 0x08) { + uint8_t nxp_version = data[6] & 0x18; + PrintAndLogEx(DEBUG, "NXP Version: %02x", nxp_version); + if (data[8] == 0x04 && data[7] == 0x01 && nxp_version == 0x08) { PrintAndLogEx(DEBUG, "SLIX2 Detected, getting NXP System Info"); return NxpSysInfo(uid); }