mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-10 02:04:39 +08:00
chg: 'hf 14a sim' - send 4bit ACK/NACK responses
This commit is contained in:
parent
65a45fe187
commit
ca24b7ae74
1 changed files with 6 additions and 10 deletions
|
@ -1138,8 +1138,7 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
|
|||
uint8_t index = receivedCmd[1];
|
||||
if (index > 2) {
|
||||
// send NACK 0x0 == invalid argument
|
||||
uint8_t nack[] = {0x00};
|
||||
EmSendCmd(nack, sizeof(nack));
|
||||
EmSend4bit(0x00);
|
||||
} else {
|
||||
uint8_t cmd[] = {0x00, 0x00, 0x00, 0x14, 0xa5};
|
||||
num_to_bytes(counters[index], 3, cmd);
|
||||
|
@ -1151,8 +1150,7 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
|
|||
uint8_t index = receivedCmd[1];
|
||||
if (index > 2) {
|
||||
// send NACK 0x0 == invalid argument
|
||||
uint8_t nack[] = {0x00};
|
||||
EmSendCmd(nack, sizeof(nack));
|
||||
EmSend4bit(0x00);
|
||||
} else {
|
||||
|
||||
uint32_t val = bytes_to_num(receivedCmd + 2, 4);
|
||||
|
@ -1160,13 +1158,12 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
|
|||
// if new value + old value is bigger 24bits, fail
|
||||
if (val + counters[index] > 0xFFFFFF) {
|
||||
// send NACK 0x4 == counter overflow
|
||||
uint8_t nack[] = {0x04};
|
||||
EmSendCmd(nack, sizeof(nack));
|
||||
EmSend4bit(CARD_NACK_NA);
|
||||
} else {
|
||||
counters[index] = val;
|
||||
// send ACK
|
||||
uint8_t ack[] = {0x0a};
|
||||
EmSendCmd(ack, sizeof(ack));
|
||||
EmSend4bit(CARD_ACK);
|
||||
CARD_ACK
|
||||
}
|
||||
}
|
||||
p_response = NULL;
|
||||
|
@ -1176,8 +1173,7 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
|
|||
uint8_t index = receivedCmd[1];
|
||||
if (index > 2) {
|
||||
// send NACK 0x0 == invalid argument
|
||||
uint8_t nack[] = {0x00};
|
||||
EmSendCmd(nack, sizeof(nack));
|
||||
EmSend4bit(0x00);
|
||||
} else {
|
||||
emlGetMemBt(emdata, 10 + index, 1);
|
||||
AddCrc14A(emdata, sizeof(emdata) - 2);
|
||||
|
|
Loading…
Reference in a new issue