Skip to content

Commit

Permalink
Merge pull request #2584 from solletichino999/feature/staticnested
Browse files Browse the repository at this point in the history
Static Nested for cards with offset 0
  • Loading branch information
doegox authored Oct 22, 2024
2 parents 6034f11 + c81ef77 commit 6e3febd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion armsrc/mifarecmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ void MifareStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t targetBlockNo,
continue;
};

if (mifare_classic_authex(pcs, cuid, blockNo, keyType, ui64Key, AUTH_NESTED, NULL, NULL)) {
if (mifare_classic_authex(pcs, cuid, blockNo, keyType, ui64Key, AUTH_NESTED, &nt2, NULL)) {
continue;
};

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

nt3 = bytes_to_num(receivedAnswer, 4);
// fix for cards with distance 0
if (nt1 == nt2) {
target_nt[0] = nt1;
target_nt[1] = nt1;
target_ks[0] = nt3 ^ target_nt[0];
}
target_ks[1] = nt3 ^ target_nt[1];

isOK = PM3_SUCCESS;
Expand Down

0 comments on commit 6e3febd

Please sign in to comment.