[FL-2470, FL-2385, FL-2411] NFC fixes (#1138)

* mifare classic: increase data exchange timeout
* nfc: exit from app if can't parse file
* furi_hal_nfc: allow to switch context during detect

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
gornekich
2022-04-20 17:08:36 +03:00
committed by GitHub
parent d530d164b9
commit cea118cf2d
3 changed files with 13 additions and 8 deletions

View File

@@ -118,7 +118,7 @@ static bool mf_classic_auth(
tx_rx->tx_data[1] = block;
tx_rx->tx_rx_type = FuriHalNfcTxRxTypeRxNoCrc;
tx_rx->tx_bits = 2 * 8;
if(!furi_hal_nfc_tx_rx(tx_rx, 4)) break;
if(!furi_hal_nfc_tx_rx(tx_rx, 5)) break;
uint32_t nt = (uint32_t)nfc_util_bytes2num(tx_rx->rx_data, 4);
crypto1_init(crypto, key);
@@ -140,7 +140,7 @@ static bool mf_classic_auth(
}
tx_rx->tx_rx_type = FuriHalNfcTxRxTypeRaw;
tx_rx->tx_bits = 8 * 8;
if(!furi_hal_nfc_tx_rx(tx_rx, 4)) break;
if(!furi_hal_nfc_tx_rx(tx_rx, 5)) break;
if(tx_rx->rx_bits == 32) {
crypto1_word(crypto, 0, 0);
auth_success = true;
@@ -220,7 +220,7 @@ bool mf_classic_read_block(
tx_rx->tx_bits = 4 * 9;
tx_rx->tx_rx_type = FuriHalNfcTxRxTypeRaw;
if(furi_hal_nfc_tx_rx(tx_rx, 4)) {
if(furi_hal_nfc_tx_rx(tx_rx, 5)) {
if(tx_rx->rx_bits == 8 * 18) {
for(uint8_t i = 0; i < 18; i++) {
block->value[i] = crypto1_byte(crypto, 0, 0) ^ tx_rx->rx_data[i];