Don't check the ATQA to determine tags type, it should not be used.

This commit is contained in:
Romain Tartiere 2010-08-04 12:51:34 +00:00
parent bef4ec342f
commit f0e03b99fb
2 changed files with 7 additions and 9 deletions

View file

@ -24,11 +24,11 @@
#include "freefare_internal.h" #include "freefare_internal.h"
struct supported_tag supported_tags[] = { struct supported_tag supported_tags[] = {
{ { 0x00, 0x04 }, 0x08, CLASSIC_1K, "Mifare Classic 1k" }, { 0x08, CLASSIC_1K, "Mifare Classic 1k" },
{ { 0x00, 0x02 }, 0x18, CLASSIC_4K, "Mifare Classic 4k" }, { 0x18, CLASSIC_4K, "Mifare Classic 4k" },
{ { 0x00, 0x02 }, 0x38, CLASSIC_4K, "Mifare Classic 4k (Emulated)" }, { 0x38, CLASSIC_4K, "Mifare Classic 4k (Emulated)" },
{ { 0x03, 0x44 }, 0x20, DESFIRE, "Mifare DESFire 4k" }, { 0x20, DESFIRE, "Mifare DESFire 4k" },
{ { 0x00, 0x44 }, 0x00, ULTRALIGHT, "Mifare UltraLight" }, { 0x00, ULTRALIGHT, "Mifare UltraLight" },
}; };
@ -79,9 +79,7 @@ freefare_get_tags (nfc_device_t *device)
struct supported_tag *tag_info; struct supported_tag *tag_info;
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_info.nai.abtAtqa[0] == supported_tags[i].ATQA[0]) && if (target_info.nai.btSak == supported_tags[i].SAK) {
(target_info.nai.abtAtqa[1] == supported_tags[i].ATQA[1]) &&
(target_info.nai.btSak == supported_tags[i].SAK)) {
tag_info = &(supported_tags[i]); tag_info = &(supported_tags[i]);
found = true; found = true;

View file

@ -99,7 +99,7 @@ void *assert_crypto_buffer_size (MifareTag tag, size_t nbytes);
#define MIFARE_ULTRALIGHT_PAGE_COUNT 16 #define MIFARE_ULTRALIGHT_PAGE_COUNT 16
struct supported_tag { struct supported_tag {
uint8_t ATQA[2], SAK; uint8_t SAK;
enum mifare_tag_type type; enum mifare_tag_type type;
const char *friendly_name; const char *friendly_name;
}; };