Skip to content

Commit c2b0cfa

Browse files
authored
Merge pull request #138 from AlexandreFenyo/patch-2
support of a new ATS for DESFire EV1 on JCOP3
2 parents e95406c + 24dc2ef commit c2b0cfa

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

libfreefare/mifare_desfire.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,21 @@ le24toh(uint8_t data[3])
271271
bool
272272
mifare_desfire_taste(nfc_device *device, nfc_target target)
273273
{
274-
// We have two different ATS prefixes to
275-
// check for, standalone and JCOP.
276-
static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02};
274+
// We have three different ATS prefixes to
275+
// check for, standalone, JCOP and JCOP3.
276+
static const char STANDALONE_DESFIRE[] = { 0x75, 0x77, 0x81, 0x02 };
277277
static const char JCOP_DESFIRE[] = { 0x75, 0xf7, 0xb1, 0x02 };
278+
static const char JCOP3_DESFIRE[] = { 0x78, 0x77, 0x71, 0x02 };
278279

279280
(void) device;
280281

281282
return target.nm.nmt == NMT_ISO14443A &&
282-
target.nti.nai.btSak == 0x20 &&
283+
target.nti.nai.btSak == 0x20 && ((
283284
target.nti.nai.szAtsLen >= 5 && (
284285
memcmp(target.nti.nai.abtAts, STANDALONE_DESFIRE, sizeof(STANDALONE_DESFIRE)) == 0 ||
285-
memcmp(target.nti.nai.abtAts, JCOP_DESFIRE, sizeof(JCOP_DESFIRE)) == 0
286-
);
286+
memcmp(target.nti.nai.abtAts, JCOP_DESFIRE, sizeof(JCOP_DESFIRE)) == 0))
287+
|| (target.nti.nai.szAtsLen == 4 &&
288+
memcmp(target.nti.nai.abtAts, JCOP3_DESFIRE, sizeof(JCOP3_DESFIRE)) == 0));
287289
}
288290

289291
/*

0 commit comments

Comments
 (0)