mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-15 01:07:22 +00:00
Fix emulating empty keys as 0s
This commit is contained in:
parent
0a32cd2528
commit
102dd690b7
1 changed files with 18 additions and 4 deletions
|
@ -892,11 +892,25 @@ bool mf_classic_emulator(MfClassicEmulator* emulator, FuriHalNfcTxRxContext* tx_
|
|||
MfClassicSectorTrailer* sector_trailer =
|
||||
(MfClassicSectorTrailer*)emulator->data.block[sector_trailer_block].value;
|
||||
if(cmd == MF_CLASSIC_AUTH_KEY_A_CMD) {
|
||||
key = nfc_util_bytes2num(sector_trailer->key_a, 6);
|
||||
access_key = MfClassicKeyA;
|
||||
if(mf_classic_is_key_found(
|
||||
&emulator->data, mf_classic_get_sector_by_block(block), MfClassicKeyA)) {
|
||||
key = nfc_util_bytes2num(sector_trailer->key_a, 6);
|
||||
access_key = MfClassicKeyA;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "Key not known");
|
||||
command_processed = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
key = nfc_util_bytes2num(sector_trailer->key_b, 6);
|
||||
access_key = MfClassicKeyB;
|
||||
if(mf_classic_is_key_found(
|
||||
&emulator->data, mf_classic_get_sector_by_block(block), MfClassicKeyB)) {
|
||||
key = nfc_util_bytes2num(sector_trailer->key_b, 6);
|
||||
access_key = MfClassicKeyB;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "Key not known");
|
||||
command_processed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t nonce = prng_successor(DWT->CYCCNT, 32) ^ 0xAA;
|
||||
|
|
Loading…
Reference in a new issue