mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 13:00:42 -07:00
fix: 'hf mf mifare' -1 bug...
fix: some better timeouts for prng detection (@merlokk)
This commit is contained in:
parent
1f637d726f
commit
c6a7cbfc1e
1 changed files with 21 additions and 8 deletions
|
@ -117,7 +117,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) {
|
|||
return 0;
|
||||
}
|
||||
int mfCheckKeys (uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t * keyBlock, uint64_t * key){
|
||||
*key = 0;
|
||||
*key = -1;
|
||||
UsbCommand c = {CMD_MIFARE_CHKKEYS, { (blockNo | (keyType << 8)), clear_trace, keycnt}};
|
||||
memcpy(c.d.asBytes, keyBlock, 6 * keycnt);
|
||||
clearCommandBuffer();
|
||||
|
@ -766,14 +766,27 @@ bool detect_classic_prng(void){
|
|||
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
WaitForResponse(CMD_ACK, &resp);
|
||||
WaitForResponse(CMD_ACK, &respA);
|
||||
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||
PrintAndLog("PRNG UID: Reply timeout.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// if select tag failed.
|
||||
if ( resp.arg[0] == 0 ) {
|
||||
printf("Error: selecting tag failed, can't detect prng\n");
|
||||
return false;
|
||||
}
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &respA, 2500)) {
|
||||
PrintAndLog("PRNG data: Reply timeout.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
// check respA
|
||||
if (respA.arg[0] != 4) {
|
||||
PrintAndLog("PRNG data error: Wrong length: %d", respA.arg[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t nonce = bytes_to_num(respA.d.asBytes, respA.arg[0]);
|
||||
return validate_prng_nonce(nonce);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue