Add modulation_type to the supported_tag structure.

This will allow supporting tags using other modulations.
This commit is contained in:
Romain Tartière 2015-05-12 13:11:56 +02:00
parent 6984e162e6
commit 48e4f979a9
2 changed files with 15 additions and 11 deletions

View file

@ -27,17 +27,17 @@
#define NXP_MANUFACTURER_CODE 0x04 #define NXP_MANUFACTURER_CODE 0x04
struct supported_tag supported_tags[] = { struct supported_tag supported_tags[] = {
{ CLASSIC_1K, "Mifare Classic 1k", 0x08, 0, 0, { 0x00 }, NULL }, { CLASSIC_1K, "Mifare Classic 1k", NMT_ISO14443A, 0x08, 0, 0, { 0x00 }, NULL },
{ CLASSIC_1K, "Mifare Classic 1k (Emulated)", 0x28, 0, 0, { 0x00 }, NULL }, { CLASSIC_1K, "Mifare Classic 1k (Emulated)", NMT_ISO14443A, 0x28, 0, 0, { 0x00 }, NULL },
{ CLASSIC_1K, "Mifare Classic 1k (Emulated)", 0x68, 0, 0, { 0x00 }, NULL }, { CLASSIC_1K, "Mifare Classic 1k (Emulated)", NMT_ISO14443A, 0x68, 0, 0, { 0x00 }, NULL },
{ CLASSIC_1K, "Infineon Mifare Classic 1k", 0x88, 0, 0, { 0x00 }, NULL }, { CLASSIC_1K, "Infineon Mifare Classic 1k", NMT_ISO14443A, 0x88, 0, 0, { 0x00 }, NULL },
{ CLASSIC_4K, "Mifare Classic 4k", 0x18, 0, 0, { 0x00 }, NULL }, { CLASSIC_4K, "Mifare Classic 4k", NMT_ISO14443A, 0x18, 0, 0, { 0x00 }, NULL },
{ CLASSIC_4K, "Mifare Classic 4k (Emulated)", 0x38, 0, 0, { 0x00 }, NULL }, { CLASSIC_4K, "Mifare Classic 4k (Emulated)", NMT_ISO14443A, 0x38, 0, 0, { 0x00 }, NULL },
{ DESFIRE, "Mifare DESFire", 0x20, 5, 4, { 0x75, 0x77, 0x81, 0x02 /*, 0xXX */ }, NULL}, { DESFIRE, "Mifare DESFire", NMT_ISO14443A, 0x20, 5, 4, { 0x75, 0x77, 0x81, 0x02 /*, 0xXX */ }, NULL},
{ DESFIRE, "Cyanogenmod card emulation", 0x60, 4, 3, { 0x78, 0x33, 0x88 /*, 0xXX */ }, NULL}, { DESFIRE, "Cyanogenmod card emulation", NMT_ISO14443A, 0x60, 4, 3, { 0x78, 0x33, 0x88 /*, 0xXX */ }, NULL},
{ DESFIRE, "Android HCE", 0x60, 4, 3, { 0x78, 0x80, 0x70 /*, 0xXX */ }, NULL}, { DESFIRE, "Android HCE", NMT_ISO14443A, 0x60, 4, 3, { 0x78, 0x80, 0x70 /*, 0xXX */ }, NULL},
{ ULTRALIGHT_C, "Mifare UltraLightC", 0x00, 0, 0, { 0x00 }, is_mifare_ultralightc_on_reader }, { ULTRALIGHT_C, "Mifare UltraLightC", NMT_ISO14443A, 0x00, 0, 0, { 0x00 }, is_mifare_ultralightc_on_reader },
{ ULTRALIGHT, "Mifare UltraLight", 0x00, 0, 0, { 0x00 }, NULL }, { 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 */ /* Ensure the target is supported */
for (size_t i = 0; i < sizeof (supported_tags) / sizeof (struct supported_tag); i++) { 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)) && 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) && (target.nti.nai.btSak == supported_tags[i].SAK) &&
(!supported_tags[i].ATS_min_length || ((target.nti.nai.szAtsLen >= supported_tags[i].ATS_min_length) && (!supported_tags[i].ATS_min_length || ((target.nti.nai.szAtsLen >= supported_tags[i].ATS_min_length) &&

View file

@ -166,6 +166,7 @@ void *assert_crypto_buffer_size (FreefareTag tag, size_t nbytes);
struct supported_tag { struct supported_tag {
enum freefare_tag_type type; enum freefare_tag_type type;
const char *friendly_name; const char *friendly_name;
uint8_t modulation_type;
uint8_t SAK; uint8_t SAK;
uint8_t ATS_min_length; uint8_t ATS_min_length;
uint8_t ATS_compare_length; uint8_t ATS_compare_length;