diff --git a/lib/nfc_protocols/mifare_classic.c b/lib/nfc_protocols/mifare_classic.c index 21d470bc..e35a1d6c 100644 --- a/lib/nfc_protocols/mifare_classic.c +++ b/lib/nfc_protocols/mifare_classic.c @@ -622,6 +622,19 @@ bool mf_classic_emulator(MfClassicEmulator* emulator, FuriHalNfcTxRxContext* tx_ break; } + uint32_t nr = nfc_util_bytes2num(tx_rx->rx_data, 4); + uint32_t ar = nfc_util_bytes2num(&tx_rx->rx_data[4], 4); + + FURI_LOG_D( + TAG, + "%08x key%c block %d nt/nr/ar: %08x %08x %08x", + emulator->cuid, + access_key == MfClassicKeyA ? 'A' : 'B', + sector_trailer_block, + nonce, + nr, + ar); + // Check if we store valid key if(access_key == MfClassicKeyA) { if(FURI_BIT(emulator->data.key_a_mask, mf_classic_get_sector_by_block(block)) == @@ -637,8 +650,6 @@ bool mf_classic_emulator(MfClassicEmulator* emulator, FuriHalNfcTxRxContext* tx_ } } - uint32_t nr = nfc_util_bytes2num(tx_rx->rx_data, 4); - uint32_t ar = nfc_util_bytes2num(&tx_rx->rx_data[4], 4); crypto1_word(&emulator->crypto, nr, 1); uint32_t cardRr = ar ^ crypto1_word(&emulator->crypto, 0, 0); if(cardRr != prng_successor(nonce, 64)) {