Add support for JCOP cards with DESFire emulation
Some JCOP cards support native DESFire EV1/EV2 emulation, but the existing code was ignoring these cards because they didn't have the expected ATS prefix. This change updates `mifare_desfire_taste` to also return true for JCOP cards with DESFire support, allowing them to be used with libfreefare.
This commit is contained in:
parent
682fbe69bd
commit
0480b7248e
1 changed files with 10 additions and 2 deletions
|
@ -271,11 +271,19 @@ le24toh(uint8_t data[3])
|
|||
bool
|
||||
mifare_desfire_taste(nfc_device *device, nfc_target target)
|
||||
{
|
||||
// We have two different ATS prefixes to
|
||||
// check for, standalone and JCOP.
|
||||
static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02};
|
||||
static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 };
|
||||
|
||||
(void) device;
|
||||
|
||||
return target.nm.nmt == NMT_ISO14443A &&
|
||||
target.nti.nai.btSak == 0x20 &&
|
||||
target.nti.nai.szAtsLen >= 5 &&
|
||||
memcmp(target.nti.nai.abtAts, "\x75\x77\x81\x02", 4) == 0;
|
||||
target.nti.nai.szAtsLen >= 5 && (
|
||||
memcmp(target.nti.nai.abtAts, STANDALONE_DESFIRE, sizeof(STANDALONE_DESFIRE)) == 0 ||
|
||||
memcmp(target.nti.nai.abtAts, JCOP_DESFIRE, sizeof(JCOP_DESFIRE)) == 0
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue