Detect Mifare DESFire targets with more than one historical character.
This commit is contained in:
parent
9a4b7b5882
commit
06c052db36
2 changed files with 9 additions and 11 deletions
|
@ -28,15 +28,12 @@
|
|||
|
||||
#define NXP_MANUFACTURER_CODE 0x04
|
||||
|
||||
/* Number of bytes of ATS to compare */
|
||||
#define ATS_LENGTH 4
|
||||
|
||||
struct supported_tag supported_tags[] = {
|
||||
{ CLASSIC_1K, "Mifare Classic 1k", 0x08, 0, { 0x00 } },
|
||||
{ CLASSIC_4K, "Mifare Classic 4k", 0x18, 0, { 0x00 } },
|
||||
{ CLASSIC_4K, "Mifare Classic 4k (Emulated)", 0x38, 0, { 0x00 } },
|
||||
{ DESFIRE, "Mifare DESFire", 0x20, 5, { 0x75, 0x77, 0x81, 0x02 /*, 0xXX */ }},
|
||||
{ ULTRALIGHT, "Mifare UltraLight", 0x00, 0, { 0x00 } },
|
||||
{ CLASSIC_1K, "Mifare Classic 1k", 0x08, 0, 0, { 0x00 } },
|
||||
{ CLASSIC_4K, "Mifare Classic 4k", 0x18, 0, 0, { 0x00 } },
|
||||
{ CLASSIC_4K, "Mifare Classic 4k (Emulated)", 0x38, 0, 0, { 0x00 } },
|
||||
{ DESFIRE, "Mifare DESFire", 0x20, 5, 4, { 0x75, 0x77, 0x81, 0x02 /*, 0xXX */ }},
|
||||
{ ULTRALIGHT, "Mifare UltraLight", 0x00, 0, 0, { 0x00 } },
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -53,8 +50,8 @@ freefare_tag_new (nfc_device_t *device, nfc_iso14443a_info_t nai)
|
|||
for (size_t i = 0; i < sizeof (supported_tags) / sizeof (struct supported_tag); i++) {
|
||||
if (((nai.szUidLen == 4) || (nai.abtUid[0] == NXP_MANUFACTURER_CODE)) &&
|
||||
(nai.btSak == supported_tags[i].SAK) &&
|
||||
(!supported_tags[i].ATS_length || ((nai.szAtsLen == supported_tags[i].ATS_length) &&
|
||||
(0 == memcmp (nai.abtAts, supported_tags[i].ATS, ATS_LENGTH))))) {
|
||||
(!supported_tags[i].ATS_min_length || ((nai.szAtsLen >= supported_tags[i].ATS_min_length) &&
|
||||
(0 == memcmp (nai.abtAts, supported_tags[i].ATS, supported_tags[i].ATS_compare_length))))) {
|
||||
|
||||
tag_info = &(supported_tags[i]);
|
||||
found = true;
|
||||
|
|
|
@ -165,7 +165,8 @@ struct supported_tag {
|
|||
enum mifare_tag_type type;
|
||||
const char *friendly_name;
|
||||
uint8_t SAK;
|
||||
uint8_t ATS_length;
|
||||
uint8_t ATS_min_length;
|
||||
uint8_t ATS_compare_length;
|
||||
uint8_t ATS[5];
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue