diff options
author | Kevin Wallace <184975+kevinwallace@users.noreply.github.com> | 2022-06-09 11:35:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 11:35:34 +0300 |
commit | 9c9f66a30fd2797f761f33cee0b8839c250b690e (patch) | |
tree | de73eb30ac31954bb4584e9c9ea001246de55b40 /lib | |
parent | d5df4027d771dc654339e9d7a0c6c3c256165572 (diff) |
nfc: add debug PCAP output, refactor Mifare DESFire following #1095 (#1294)
* nfc: refactor nfc_worker_read_mifare_desfire to use furi_hal_nfc_tx_rx
Renames furi_hal_nfc_exchange_full to furi_hal_nfc_tx_rx_full, and
rewrites it to use furi_hal_nfc_tx_rx. This eliminates the final
remaining use of furi_hal_nfc_exchange, so remove that.
* nfc: write debug.pcap when debug mode enabled
Limited to NFC protocols that use furi_hal_nfc_tx_rx to communicate.
* switch to Doxygen style comment
Co-authored-by: Kevin Wallace <git+flipperzero@kevin.wallace.seattle.wa.us>
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/nfc_protocols/emv.c | 3 | ||||
-rw-r--r-- | lib/nfc_protocols/mifare_classic.c | 7 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/nfc_protocols/emv.c b/lib/nfc_protocols/emv.c index 416e63a5..b69675fd 100644 --- a/lib/nfc_protocols/emv.c +++ b/lib/nfc_protocols/emv.c @@ -397,7 +397,8 @@ bool emv_read_bank_card(FuriHalNfcTxRxContext* tx_rx, EmvApplication* emv_app) { bool emv_card_emulation(FuriHalNfcTxRxContext* tx_rx) { furi_assert(tx_rx); bool emulation_complete = false; - memset(tx_rx, 0, sizeof(FuriHalNfcTxRxContext)); + tx_rx->tx_bits = 0; + tx_rx->tx_rx_type = FuriHalNfcTxRxTypeDefault; do { FURI_LOG_D(TAG, "Read select PPSE command"); diff --git a/lib/nfc_protocols/mifare_classic.c b/lib/nfc_protocols/mifare_classic.c index 38c47127..b44f77cb 100644 --- a/lib/nfc_protocols/mifare_classic.c +++ b/lib/nfc_protocols/mifare_classic.c @@ -270,7 +270,9 @@ static bool mf_classic_auth( MfClassicKey key_type, Crypto1* crypto) { bool auth_success = false; - memset(tx_rx, 0, sizeof(FuriHalNfcTxRxContext)); + memset(tx_rx->tx_data, 0, sizeof(tx_rx->tx_data)); + memset(tx_rx->tx_parity, 0, sizeof(tx_rx->tx_parity)); + tx_rx->tx_rx_type = FuriHalNfcTxRxTypeDefault; do { if(key_type == MfClassicKeyA) { @@ -372,7 +374,8 @@ bool mf_classic_read_block( bool read_block_success = false; uint8_t plain_cmd[4] = {MF_CLASSIC_READ_SECT_CMD, block_num, 0x00, 0x00}; nfca_append_crc16(plain_cmd, 2); - memset(tx_rx, 0, sizeof(FuriHalNfcTxRxContext)); + memset(tx_rx->tx_data, 0, sizeof(tx_rx->tx_data)); + memset(tx_rx->tx_parity, 0, sizeof(tx_rx->tx_parity)); for(uint8_t i = 0; i < 4; i++) { tx_rx->tx_data[i] = crypto1_byte(crypto, 0x00, 0) ^ plain_cmd[i]; |