Added Javacard Emulated mifare classic 1K compatibility (#1369)

* Add Mifare classic 1k JC handling
  Add mifare classic Javacard emulation handling
* Adding MIFARE 1K Javacard Emulation Compatibility
  MIFARE Classic 1K Cards from NXP have the SAK value of 0x08.
  MIFARE Classic 1K Cards that are emulated via javacard applet have an SAK value of 0x09.
  Adding the SAK values accordingly so that Javacard emulated mifare classic tags are properly handled.
* update mifare_common.c
  added javacard emulation handling for mifare classic 1k

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Equip 2022-07-05 16:34:21 +01:00 committed by GitHub
parent 8af2198684
commit e147b2ceea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -198,7 +198,7 @@ static bool mf_classic_is_allowed_access(
bool mf_classic_check_card_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) { bool mf_classic_check_card_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
UNUSED(ATQA1); UNUSED(ATQA1);
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88)) { if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
return true; return true;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) { } else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
return true; return true;
@ -219,7 +219,7 @@ bool mf_classic_get_type(
furi_assert(reader); furi_assert(reader);
memset(reader, 0, sizeof(MfClassicReader)); memset(reader, 0, sizeof(MfClassicReader));
if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88)) { if((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) {
reader->type = MfClassicType1k; reader->type = MfClassicType1k;
} else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) { } else if((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18)) {
reader->type = MfClassicType4k; reader->type = MfClassicType4k;

View File

@ -6,7 +6,7 @@ MifareType mifare_common_get_type(uint8_t ATQA0, uint8_t ATQA1, uint8_t SAK) {
if((ATQA0 == 0x44) && (ATQA1 == 0x00) && (SAK == 0x00)) { if((ATQA0 == 0x44) && (ATQA1 == 0x00) && (SAK == 0x00)) {
type = MifareTypeUltralight; type = MifareTypeUltralight;
} else if( } else if(
((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88)) || ((ATQA0 == 0x44 || ATQA0 == 0x04) && (SAK == 0x08 || SAK == 0x88 || SAK == 0x09)) ||
((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18))) { ((ATQA0 == 0x42 || ATQA0 == 0x02) && (SAK == 0x18))) {
type = MifareTypeClassic; type = MifareTypeClassic;
} else if(ATQA0 == 0x44 && ATQA1 == 0x03 && SAK == 0x20) { } else if(ATQA0 == 0x44 && ATQA1 == 0x03 && SAK == 0x20) {