diff --git a/libfreefare/freefare.c b/libfreefare/freefare.c index 13aba05..2b54f10 100644 --- a/libfreefare/freefare.c +++ b/libfreefare/freefare.c @@ -27,17 +27,17 @@ #define NXP_MANUFACTURER_CODE 0x04 struct supported_tag supported_tags[] = { - { CLASSIC_1K, "Mifare Classic 1k", 0x08, 0, 0, { 0x00 }, NULL }, - { CLASSIC_1K, "Mifare Classic 1k (Emulated)", 0x28, 0, 0, { 0x00 }, NULL }, - { CLASSIC_1K, "Mifare Classic 1k (Emulated)", 0x68, 0, 0, { 0x00 }, NULL }, - { CLASSIC_1K, "Infineon Mifare Classic 1k", 0x88, 0, 0, { 0x00 }, NULL }, - { CLASSIC_4K, "Mifare Classic 4k", 0x18, 0, 0, { 0x00 }, NULL }, - { CLASSIC_4K, "Mifare Classic 4k (Emulated)", 0x38, 0, 0, { 0x00 }, NULL }, - { DESFIRE, "Mifare DESFire", 0x20, 5, 4, { 0x75, 0x77, 0x81, 0x02 /*, 0xXX */ }, NULL}, - { DESFIRE, "Cyanogenmod card emulation", 0x60, 4, 3, { 0x78, 0x33, 0x88 /*, 0xXX */ }, NULL}, - { DESFIRE, "Android HCE", 0x60, 4, 3, { 0x78, 0x80, 0x70 /*, 0xXX */ }, NULL}, - { ULTRALIGHT_C, "Mifare UltraLightC", 0x00, 0, 0, { 0x00 }, is_mifare_ultralightc_on_reader }, - { ULTRALIGHT, "Mifare UltraLight", 0x00, 0, 0, { 0x00 }, NULL }, + { CLASSIC_1K, "Mifare Classic 1k", NMT_ISO14443A, 0x08, 0, 0, { 0x00 }, NULL }, + { CLASSIC_1K, "Mifare Classic 1k (Emulated)", NMT_ISO14443A, 0x28, 0, 0, { 0x00 }, NULL }, + { CLASSIC_1K, "Mifare Classic 1k (Emulated)", NMT_ISO14443A, 0x68, 0, 0, { 0x00 }, NULL }, + { CLASSIC_1K, "Infineon Mifare Classic 1k", NMT_ISO14443A, 0x88, 0, 0, { 0x00 }, NULL }, + { CLASSIC_4K, "Mifare Classic 4k", NMT_ISO14443A, 0x18, 0, 0, { 0x00 }, NULL }, + { CLASSIC_4K, "Mifare Classic 4k (Emulated)", NMT_ISO14443A, 0x38, 0, 0, { 0x00 }, NULL }, + { DESFIRE, "Mifare DESFire", NMT_ISO14443A, 0x20, 5, 4, { 0x75, 0x77, 0x81, 0x02 /*, 0xXX */ }, NULL}, + { DESFIRE, "Cyanogenmod card emulation", NMT_ISO14443A, 0x60, 4, 3, { 0x78, 0x33, 0x88 /*, 0xXX */ }, NULL}, + { DESFIRE, "Android HCE", NMT_ISO14443A, 0x60, 4, 3, { 0x78, 0x80, 0x70 /*, 0xXX */ }, NULL}, + { ULTRALIGHT_C, "Mifare UltraLightC", NMT_ISO14443A, 0x00, 0, 0, { 0x00 }, is_mifare_ultralightc_on_reader }, + { ULTRALIGHT, "Mifare UltraLight", NMT_ISO14443A, 0x00, 0, 0, { 0x00 }, NULL }, }; /* @@ -52,6 +52,9 @@ freefare_tag_new (nfc_device *device, nfc_target target) /* Ensure the target is supported */ for (size_t i = 0; i < sizeof (supported_tags) / sizeof (struct supported_tag); i++) { + if (target.nm.nmt != supported_tags[i].modulation_type) + continue; + if ((target.nm.nmt == NMT_ISO14443A) && ((target.nti.nai.szUidLen == 4) || (target.nti.nai.abtUid[0] == NXP_MANUFACTURER_CODE)) && (target.nti.nai.btSak == supported_tags[i].SAK) && (!supported_tags[i].ATS_min_length || ((target.nti.nai.szAtsLen >= supported_tags[i].ATS_min_length) && diff --git a/libfreefare/freefare_internal.h b/libfreefare/freefare_internal.h index 3dd5f7d..3ddf3c9 100644 --- a/libfreefare/freefare_internal.h +++ b/libfreefare/freefare_internal.h @@ -166,6 +166,7 @@ void *assert_crypto_buffer_size (FreefareTag tag, size_t nbytes); struct supported_tag { enum freefare_tag_type type; const char *friendly_name; + uint8_t modulation_type; uint8_t SAK; uint8_t ATS_min_length; uint8_t ATS_compare_length;