// check last used key
if (mfLastKey) {
if (NestedCheckKey(mfLastKey, &AuthData, cmd, cmdsize)) {
+ traceCrypto1 = lfsr_recovery64(AuthData.ks2, AuthData.ks3);
};
}
if (!traceCrypto1) {
for (int defaultKeyCounter = 0; defaultKeyCounter < MifareDefaultKeysSize; defaultKeyCounter++){
if (NestedCheckKey(MifareDefaultKeys[defaultKeyCounter], &AuthData, cmd, cmdsize)) {
-
+ traceCrypto1 = lfsr_recovery64(AuthData.ks2, AuthData.ks3);
break;
};
}
crypto1_destroy(pcs);
- return CheckCrc14443(CRC_14443_A, buf, cmdsize);
+ if(CheckCrc14443(CRC_14443_A, buf, cmdsize)) {
+ AuthData.ks2 = AuthData.ar_enc ^ ar;
+ AuthData.ks3 = AuthData.at_enc ^ at;
+ return true;
+ } else {
+ return false;
+ }
}
\ No newline at end of file