mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -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;
|
return 0;
|
||||||
}
|
}
|
||||||
int mfCheckKeys (uint8_t blockNo, uint8_t keyType, bool clear_trace, uint8_t keycnt, uint8_t * keyBlock, uint64_t * key){
|
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}};
|
UsbCommand c = {CMD_MIFARE_CHKKEYS, { (blockNo | (keyType << 8)), clear_trace, keycnt}};
|
||||||
memcpy(c.d.asBytes, keyBlock, 6 * keycnt);
|
memcpy(c.d.asBytes, keyBlock, 6 * keycnt);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -441,10 +441,10 @@ uint32_t ks2 = 0;
|
||||||
uint32_t ks3 = 0;
|
uint32_t ks3 = 0;
|
||||||
|
|
||||||
uint32_t cuid = 0; // serial number
|
uint32_t cuid = 0; // serial number
|
||||||
uint32_t nt =0; // tag challenge
|
uint32_t nt = 0; // tag challenge
|
||||||
uint32_t nr_enc =0; // encrypted reader challenge
|
uint32_t nr_enc = 0; // encrypted reader challenge
|
||||||
uint32_t ar_enc =0; // encrypted reader response
|
uint32_t ar_enc = 0; // encrypted reader response
|
||||||
uint32_t at_enc =0; // encrypted tag response
|
uint32_t at_enc = 0; // encrypted tag response
|
||||||
|
|
||||||
int isTraceCardEmpty(void) {
|
int isTraceCardEmpty(void) {
|
||||||
return ((traceCard[0] == 0) && (traceCard[1] == 0) && (traceCard[2] == 0) && (traceCard[3] == 0));
|
return ((traceCard[0] == 0) && (traceCard[1] == 0) && (traceCard[2] == 0) && (traceCard[3] == 0));
|
||||||
|
@ -766,14 +766,27 @@ bool detect_classic_prng(void){
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
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 select tag failed.
|
||||||
if ( resp.arg[0] == 0 ) {
|
if ( resp.arg[0] == 0 ) {
|
||||||
printf("Error: selecting tag failed, can't detect prng\n");
|
printf("Error: selecting tag failed, can't detect prng\n");
|
||||||
return false;
|
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]);
|
uint32_t nonce = bytes_to_num(respA.d.asBytes, respA.arg[0]);
|
||||||
return validate_prng_nonce(nonce);
|
return validate_prng_nonce(nonce);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue