mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
improved staticnonce tristate processing
This commit is contained in:
parent
bc19a532a9
commit
5b695153b6
4 changed files with 37 additions and 25 deletions
|
@ -2348,29 +2348,29 @@ OUT:
|
|||
void MifareHasStaticNonce(void) {
|
||||
|
||||
// variables
|
||||
int retval = PM3_SUCCESS, len;
|
||||
|
||||
uint32_t nt = 0 ;
|
||||
uint8_t rec[1] = {0x00};
|
||||
uint8_t recpar[1] = {0x00};
|
||||
int retval = PM3_SUCCESS;
|
||||
uint32_t nt = 0;
|
||||
uint8_t *uid = BigBuf_malloc(10);
|
||||
uint8_t data[1] = {0x00};
|
||||
|
||||
uint8_t data[1] = { NONCE_FAIL };
|
||||
struct Crypto1State mpcs = {0, 0};
|
||||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
iso14a_card_select_t card_info;
|
||||
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
uint8_t counter = 0;
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
|
||||
iso14a_card_select_t card_info;
|
||||
if (!iso14443a_select_card(uid, &card_info, NULL, true, 0, true)) {
|
||||
retval = PM3_ESOFT;
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
uint8_t rec[1] = {0x00};
|
||||
uint8_t recpar[1] = {0x00};
|
||||
// Transmit MIFARE_CLASSIC_AUTH 0x60, block 0
|
||||
len = mifare_sendcmd_short(pcs, false, MIFARE_AUTH_KEYA, 0, rec, recpar, NULL);
|
||||
int len = mifare_sendcmd_short(pcs, false, MIFARE_AUTH_KEYA, 0, rec, recpar, NULL);
|
||||
if (len != 4) {
|
||||
retval = PM3_ESOFT;
|
||||
goto OUT;
|
||||
|
@ -2378,7 +2378,7 @@ void MifareHasStaticNonce(void) {
|
|||
|
||||
// Save the tag nonce (nt)
|
||||
if (nt == bytes_to_num(rec, 4)) {
|
||||
data[0]++;
|
||||
counter++;
|
||||
}
|
||||
|
||||
nt = bytes_to_num(rec, 4);
|
||||
|
@ -2389,6 +2389,13 @@ void MifareHasStaticNonce(void) {
|
|||
CHK_TIMEOUT();
|
||||
}
|
||||
|
||||
if (counter) {
|
||||
Dbprintf("%u static nonce %08x", data[0], nt);
|
||||
data[0] = NONCE_STATIC;
|
||||
} else {
|
||||
data[0] = NONCE_NORMAL;
|
||||
}
|
||||
|
||||
OUT:
|
||||
reply_ng(CMD_HF_MIFARE_STATIC_NONCE, retval, data, sizeof(data));
|
||||
// turns off
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue