Skip to content

Commit

Permalink
Addressing the ACK/NAK keep-alive exchanges from some NXP readers not…
Browse files Browse the repository at this point in the history
…ed by \@lvandenb in emsec#313
  • Loading branch information
maxieds committed Feb 12, 2022
1 parent b6be1b8 commit 9ee3236
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2020,7 +2020,7 @@ uint16_t ISO7816CmdSelect(uint8_t *Buffer, uint16_t ByteCount) {
return ISO7816CmdSelectDF(Buffer, ByteCount);
}
Buffer[0] = ISO7816_ERROR_SW1_INS_UNSUPPORTED;
Buffer[1] = ISO7816_ERROR_SW2_INS_UNSUPPORTED;
Buffer[1] = ISO7816_ERROR_SW2_FUNC_UNSUPPORTED;
return ISO7816_STATUS_RESPONSE_SIZE;
}

Expand Down
7 changes: 7 additions & 0 deletions Firmware/Chameleon-Mini/Application/MifareDESFire.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ uint16_t MifareDesfireAppProcess(uint8_t *Buffer, uint16_t BitCount) {
} else if (ByteCount >= 6 && DesfireCLA(Buffer[0]) && Buffer[2] == 0x00 &&
Buffer[3] == 0x00 && Buffer[4] == ByteCount - 6) {
return MifareDesfireProcess(Buffer, BitCount);
} else if (ByteCount == 4 && Buffer[2] == 0x37 && Buffer[3] == 0xC8) {
// NXP-based PCD sent a "keep alive" response of ACK,
// so we respond with a corresponding NAK (with CRCA bytes appended):
Buffer[2] = 0x7E;
Buffer[3] = 0x44;
ISO14443AAppendCRCA(Buffer, 4);
return 6 * BITS_PER_BYTE;
} else if (IsWrappedISO7816CommandType(Buffer, ByteCount)) {
uint8_t ISO7816PrologueBytes[2];
memcpy(&ISO7816PrologueBytes[0], Buffer, 2);
Expand Down

0 comments on commit 9ee3236

Please sign in to comment.