Skip to content

Commit 6e3febd

Browse files
authored
Merge pull request #2584 from solletichino999/feature/staticnested
Static Nested for cards with offset 0
2 parents 6034f11 + c81ef77 commit 6e3febd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

armsrc/mifarecmd.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ void MifareStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo,
15341534
continue;
15351535
};
15361536

1537-
if (mifare_classic_authex(pcs, cuid, blockNo, keyType, ui64Key, AUTH_NESTED, NULL, NULL)) {
1537+
if (mifare_classic_authex(pcs, cuid, blockNo, keyType, ui64Key, AUTH_NESTED, &nt2, NULL)) {
15381538
continue;
15391539
};
15401540

@@ -1544,6 +1544,12 @@ void MifareStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo,
15441544
};
15451545

15461546
nt3 = bytes_to_num(receivedAnswer, 4);
1547+
// fix for cards with distance 0
1548+
if (nt1 == nt2) {
1549+
target_nt[0] = nt1;
1550+
target_nt[1] = nt1;
1551+
target_ks[0] = nt3 ^ target_nt[0];
1552+
}
15471553
target_ks[1] = nt3 ^ target_nt[1];
15481554

15491555
isOK = PM3_SUCCESS;

0 commit comments

Comments
 (0)