Skip to content

Commit ea142fe

Browse files
committed
mf mfu sim ULC/ULAES: force tag response if --1a2 is provided
1 parent a0a114f commit ea142fe

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

armsrc/iso14443a.c

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2214,10 +2214,14 @@ void SimulateIso14443aTagEx(uint8_t tagType, uint16_t flags, uint8_t *useruid, u
22142214
ror(rnd_ab + 8, 8);
22152215

22162216
if (memcmp(rnd_ab + 8, ULC_TAG_NONCE, 8) != 0) {
2217-
Dbprintf("failed authentication");
2218-
EmSend4bit(CARD_NACK_IV);
2219-
p_response = NULL;
2220-
goto jump;
2217+
if (ulauth_1a2_len == 8 && ulauth_1a2 != NULL) {
2218+
Dbprintf("failed authentication but --1a2 is set, responding with it anyway");
2219+
} else {
2220+
Dbprintf("failed authentication");
2221+
EmSend4bit(CARD_NACK_IV);
2222+
p_response = NULL;
2223+
goto jump;
2224+
}
22212225
}
22222226

22232227
// OK response
@@ -2289,10 +2293,14 @@ void SimulateIso14443aTagEx(uint8_t tagType, uint16_t flags, uint8_t *useruid, u
22892293

22902294
// Remember our tag nonce is twice the ULC_TAG_NONCE
22912295
if ((memcmp(rnd_ab + 16, ULC_TAG_NONCE, 8) != 0) || (memcmp(rnd_ab + 24, ULC_TAG_NONCE, 8) != 0)) {
2292-
Dbprintf("failed authentication");
2293-
EmSend4bit(CARD_NACK_IV);
2294-
p_response = NULL;
2295-
goto jump;
2296+
if (ulauth_1a2_len == 16 && ulauth_1a2 != NULL) {
2297+
Dbprintf("failed authentication but --1a2 is set, responding with it anyway");
2298+
} else {
2299+
Dbprintf("failed authentication");
2300+
EmSend4bit(CARD_NACK_IV);
2301+
p_response = NULL;
2302+
goto jump;
2303+
}
22962304
}
22972305

22982306
// OK response

0 commit comments

Comments
 (0)