mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-19 11:33:51 +08:00
chg: 'hf mf nack' - adjustments in return values..
add: 'hf 14a info -n' added new parameter, to enable test for nack bug.
This commit is contained in:
parent
01e1442bf8
commit
56dbf3ea15
3 changed files with 16 additions and 8 deletions
|
@ -2606,7 +2606,7 @@ void DetectNACKbug() {
|
|||
|
||||
// Test if the action was cancelled
|
||||
if(BUTTON_PRESS()) {
|
||||
isOK = -1;
|
||||
isOK = 99;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2675,7 +2675,7 @@ void DetectNACKbug() {
|
|||
unexpected_random++;
|
||||
if (unexpected_random > MAX_UNEXPECTED_RANDOM) {
|
||||
// Card has an unpredictable PRNG. Give up
|
||||
isOK = -3;
|
||||
isOK = 98;
|
||||
break;
|
||||
} else {
|
||||
if (sync_cycles <= 0) {
|
||||
|
@ -2687,7 +2687,7 @@ void DetectNACKbug() {
|
|||
}
|
||||
|
||||
if (++sync_tries > MAX_SYNC_TRIES) {
|
||||
isOK = -4; // Card's PRNG runs at an unexpected frequency or resets unexpectedly
|
||||
isOK = 97; // Card's PRNG runs at an unexpected frequency or resets unexpectedly
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2697,7 +2697,7 @@ void DetectNACKbug() {
|
|||
sync_cycles += PRNG_SEQUENCE_LENGTH;
|
||||
|
||||
if (sync_cycles > PRNG_SEQUENCE_LENGTH * 2 ) {
|
||||
isOK = -4; // Card's PRNG runs at an unexpected frequency or resets unexpectedly
|
||||
isOK = 96; // Card's PRNG runs at an unexpected frequency or resets unexpectedly
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,7 @@ int usage_hf_14a_info(void){
|
|||
PrintAndLog("This command makes more extensive tests against a ISO14443a tag in order to collect information");
|
||||
PrintAndLog("Usage: hf 14a info [h|s]");
|
||||
PrintAndLog(" s silent (no messages)");
|
||||
PrintAndLog(" n test for nack bug");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -274,6 +275,8 @@ int CmdHF14AInfo(const char *Cmd) {
|
|||
if (Cmd[0] == 'h' || Cmd[0] == 'H') return usage_hf_14a_info();
|
||||
|
||||
bool silent = (Cmd[0] == 's' || Cmd[0] == 'S');
|
||||
bool do_nack_test = (Cmd[0] == 'n' || Cmd[0] == 'N');
|
||||
|
||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||
clearCommandBuffer();
|
||||
SendCommand(&c);
|
||||
|
@ -494,7 +497,10 @@ int CmdHF14AInfo(const char *Cmd) {
|
|||
if ( detect_classic_prng() )
|
||||
PrintAndLog("Prng detection: WEAK");
|
||||
else
|
||||
PrintAndLog("Prng detection: HARDEND (hardnested)");
|
||||
PrintAndLog("Prng detection: HARDEND (hardnested)");
|
||||
|
||||
if ( do_nack_test )
|
||||
detect_classic_nackbug(silent);
|
||||
}
|
||||
|
||||
return select_status;
|
||||
|
|
|
@ -890,13 +890,15 @@ int detect_classic_nackbug(bool verbose){
|
|||
PrintAndLog("Num of received NACK : %u", nacks);
|
||||
}
|
||||
switch( ok ) {
|
||||
case -1 : if (verbose) PrintAndLog("Button pressed. Aborted."); return 0;
|
||||
case -3 : if (verbose) PrintAndLog("Card random number generator is not predictable)."); return 0;
|
||||
case -4 : if (verbose) {
|
||||
case 99 : if (verbose) PrintAndLog("Button pressed. Aborted."); return 0;
|
||||
case 96 :
|
||||
case 98 : if (verbose) PrintAndLog("Card random number generator is not predictable)."); return 0;
|
||||
case 97 : if (verbose) {
|
||||
PrintAndLog("Card random number generator seems to be based on the well-known generating polynomial");
|
||||
PrintAndLog("with 16 effective bits only, but shows unexpected behavior, try again.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
case 2 : PrintAndLog("Always leak NACK detected"); return 3;
|
||||
case 1 : PrintAndLog("NACK bug detected"); return 1;
|
||||
case 0 : PrintAndLog("No NACK bug detected"); return 2;
|
||||
|
|
Loading…
Add table
Reference in a new issue