From f0e03b99fb04570205d8f101ca0a3836cb269c84 Mon Sep 17 00:00:00 2001 From: Romain Tartiere Date: Wed, 4 Aug 2010 12:51:34 +0000 Subject: [PATCH] Don't check the ATQA to determine tags type, it should not be used. --- libfreefare/freefare.c | 14 ++++++-------- libfreefare/freefare_internal.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/libfreefare/freefare.c b/libfreefare/freefare.c index 13159cf..aa60dda 100644 --- a/libfreefare/freefare.c +++ b/libfreefare/freefare.c @@ -24,11 +24,11 @@ #include "freefare_internal.h" struct supported_tag supported_tags[] = { - { { 0x00, 0x04 }, 0x08, CLASSIC_1K, "Mifare Classic 1k" }, - { { 0x00, 0x02 }, 0x18, CLASSIC_4K, "Mifare Classic 4k" }, - { { 0x00, 0x02 }, 0x38, CLASSIC_4K, "Mifare Classic 4k (Emulated)" }, - { { 0x03, 0x44 }, 0x20, DESFIRE, "Mifare DESFire 4k" }, - { { 0x00, 0x44 }, 0x00, ULTRALIGHT, "Mifare UltraLight" }, + { 0x08, CLASSIC_1K, "Mifare Classic 1k" }, + { 0x18, CLASSIC_4K, "Mifare Classic 4k" }, + { 0x38, CLASSIC_4K, "Mifare Classic 4k (Emulated)" }, + { 0x20, DESFIRE, "Mifare DESFire 4k" }, + { 0x00, ULTRALIGHT, "Mifare UltraLight" }, }; @@ -79,9 +79,7 @@ freefare_get_tags (nfc_device_t *device) struct supported_tag *tag_info; for (size_t i = 0; i < sizeof (supported_tags) / sizeof (struct supported_tag); i++) { - if ((target_info.nai.abtAtqa[0] == supported_tags[i].ATQA[0]) && - (target_info.nai.abtAtqa[1] == supported_tags[i].ATQA[1]) && - (target_info.nai.btSak == supported_tags[i].SAK)) { + if (target_info.nai.btSak == supported_tags[i].SAK) { tag_info = &(supported_tags[i]); found = true; diff --git a/libfreefare/freefare_internal.h b/libfreefare/freefare_internal.h index 93aa1ee..af3bfc2 100644 --- a/libfreefare/freefare_internal.h +++ b/libfreefare/freefare_internal.h @@ -99,7 +99,7 @@ void *assert_crypto_buffer_size (MifareTag tag, size_t nbytes); #define MIFARE_ULTRALIGHT_PAGE_COUNT 16 struct supported_tag { - uint8_t ATQA[2], SAK; + uint8_t SAK; enum mifare_tag_type type; const char *friendly_name; };