[FL-3241] NFC disable EMV support (#2571)
* nfc: remove read emv from extra actions * nfc: remove read emv Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
b9ccb274a7
commit
7ac7b70884
@ -85,11 +85,6 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfDesfireReadSuccess);
|
||||
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventReadBankCard) {
|
||||
notification_message(nfc->notifications, &sequence_success);
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneEmvReadSuccess);
|
||||
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventReadMfClassicDictAttackRequired) {
|
||||
if(mf_classic_dict_check_presence(MfClassicDictTypeSystem)) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicDictAttack);
|
||||
|
@ -5,7 +5,6 @@ enum SubmenuIndex {
|
||||
SubmenuIndexReadMifareClassic,
|
||||
SubmenuIndexReadMifareDesfire,
|
||||
SubmenuIndexReadMfUltralight,
|
||||
SubmenuIndexReadEMV,
|
||||
SubmenuIndexReadNFCA,
|
||||
};
|
||||
|
||||
@ -37,12 +36,6 @@ void nfc_scene_read_card_type_on_enter(void* context) {
|
||||
SubmenuIndexReadMfUltralight,
|
||||
nfc_scene_read_card_type_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read EMV card",
|
||||
SubmenuIndexReadEMV,
|
||||
nfc_scene_read_card_type_submenu_callback,
|
||||
nfc);
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Read NFC-A data",
|
||||
@ -75,11 +68,6 @@ bool nfc_scene_read_card_type_on_event(void* context, SceneManagerEvent event) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
consumed = true;
|
||||
}
|
||||
if(event.event == SubmenuIndexReadEMV) {
|
||||
nfc->dev->dev_data.read_mode = NfcReadModeEMV;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
consumed = true;
|
||||
}
|
||||
if(event.event == SubmenuIndexReadNFCA) {
|
||||
nfc->dev->dev_data.read_mode = NfcReadModeNFCA;
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
|
||||
|
@ -56,7 +56,6 @@ typedef enum {
|
||||
NfcReadModeMfClassic,
|
||||
NfcReadModeMfUltralight,
|
||||
NfcReadModeMfDesfire,
|
||||
NfcReadModeEMV,
|
||||
NfcReadModeNFCA,
|
||||
} NfcReadMode;
|
||||
|
||||
|
@ -229,69 +229,6 @@ static bool nfc_worker_read_mf_desfire(NfcWorker* nfc_worker, FuriHalNfcTxRxCont
|
||||
return read_success;
|
||||
}
|
||||
|
||||
static bool nfc_worker_read_bank_card(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* tx_rx) {
|
||||
bool read_success = false;
|
||||
EmvApplication emv_app = {};
|
||||
EmvData* result = &nfc_worker->dev_data->emv_data;
|
||||
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
||||
reader_analyzer_prepare_tx_rx(nfc_worker->reader_analyzer, tx_rx, false);
|
||||
reader_analyzer_start(nfc_worker->reader_analyzer, ReaderAnalyzerModeDebugLog);
|
||||
}
|
||||
|
||||
// Bank cards require strong field to start application. If we find AID, try at least several
|
||||
// times to start EMV application
|
||||
uint8_t start_application_attempts = 0;
|
||||
while(start_application_attempts < 3) {
|
||||
if(nfc_worker->state != NfcWorkerStateRead) break;
|
||||
start_application_attempts++;
|
||||
if(!furi_hal_nfc_detect(&nfc_worker->dev_data->nfc_data, 300)) break;
|
||||
if(emv_read_bank_card(tx_rx, &emv_app)) {
|
||||
FURI_LOG_D(TAG, "Bank card number read from %d attempt", start_application_attempts);
|
||||
break;
|
||||
} else if(emv_app.aid_len && !emv_app.app_started) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"AID found but failed to start EMV app from %d attempt",
|
||||
start_application_attempts);
|
||||
furi_hal_nfc_sleep();
|
||||
continue;
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "Failed to find AID");
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Copy data
|
||||
if(emv_app.aid_len) {
|
||||
result->aid_len = emv_app.aid_len;
|
||||
memcpy(result->aid, emv_app.aid, result->aid_len);
|
||||
read_success = true;
|
||||
}
|
||||
if(emv_app.card_number_len) {
|
||||
result->number_len = emv_app.card_number_len;
|
||||
memcpy(result->number, emv_app.card_number, result->number_len);
|
||||
}
|
||||
if(emv_app.name_found) {
|
||||
memcpy(result->name, emv_app.name, sizeof(emv_app.name));
|
||||
}
|
||||
if(emv_app.exp_month) {
|
||||
result->exp_mon = emv_app.exp_month;
|
||||
result->exp_year = emv_app.exp_year;
|
||||
}
|
||||
if(emv_app.country_code) {
|
||||
result->country_code = emv_app.country_code;
|
||||
}
|
||||
if(emv_app.currency_code) {
|
||||
result->currency_code = emv_app.currency_code;
|
||||
}
|
||||
|
||||
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
|
||||
reader_analyzer_stop(nfc_worker->reader_analyzer);
|
||||
}
|
||||
|
||||
return read_success;
|
||||
}
|
||||
|
||||
static bool nfc_worker_read_nfca(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* tx_rx) {
|
||||
FuriHalNfcDevData* nfc_data = &nfc_worker->dev_data->nfc_data;
|
||||
|
||||
@ -315,14 +252,6 @@ static bool nfc_worker_read_nfca(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* t
|
||||
nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
|
||||
}
|
||||
card_read = true;
|
||||
} else if(nfc_data->interface == FuriHalNfcInterfaceIsoDep) {
|
||||
FURI_LOG_I(TAG, "ISO14443-4 card detected");
|
||||
nfc_worker->dev_data->protocol = NfcDeviceProtocolEMV;
|
||||
if(!nfc_worker_read_bank_card(nfc_worker, tx_rx)) {
|
||||
FURI_LOG_I(TAG, "Unknown card. Save UID");
|
||||
nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
|
||||
}
|
||||
card_read = true;
|
||||
} else {
|
||||
nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
|
||||
card_read = true;
|
||||
@ -358,9 +287,6 @@ void nfc_worker_read(NfcWorker* nfc_worker) {
|
||||
} else if(dev_data->protocol == NfcDeviceProtocolMifareDesfire) {
|
||||
event = NfcWorkerEventReadMfDesfire;
|
||||
break;
|
||||
} else if(dev_data->protocol == NfcDeviceProtocolEMV) {
|
||||
event = NfcWorkerEventReadBankCard;
|
||||
break;
|
||||
} else if(dev_data->protocol == NfcDeviceProtocolUnknown) {
|
||||
event = NfcWorkerEventReadUidNfcA;
|
||||
break;
|
||||
@ -444,12 +370,6 @@ void nfc_worker_read_type(NfcWorker* nfc_worker) {
|
||||
event = NfcWorkerEventReadMfDesfire;
|
||||
break;
|
||||
}
|
||||
} else if(read_mode == NfcReadModeEMV) {
|
||||
nfc_worker->dev_data->protocol = NfcDeviceProtocolEMV;
|
||||
if(nfc_worker_read_bank_card(nfc_worker, &tx_rx)) {
|
||||
event = NfcWorkerEventReadBankCard;
|
||||
break;
|
||||
}
|
||||
} else if(read_mode == NfcReadModeNFCA) {
|
||||
nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
|
||||
event = NfcWorkerEventReadUidNfcA;
|
||||
|
@ -39,7 +39,6 @@ typedef enum {
|
||||
NfcWorkerEventReadMfClassicDone,
|
||||
NfcWorkerEventReadMfClassicLoadKeyCache,
|
||||
NfcWorkerEventReadMfClassicDictAttackRequired,
|
||||
NfcWorkerEventReadBankCard,
|
||||
|
||||
// Nfc worker common events
|
||||
NfcWorkerEventSuccess,
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include <lib/toolbox/stream/file_stream.h>
|
||||
|
||||
#include <lib/nfc/protocols/nfc_util.h>
|
||||
#include <lib/nfc/protocols/emv.h>
|
||||
#include <lib/nfc/protocols/mifare_common.h>
|
||||
#include <lib/nfc/protocols/mifare_ultralight.h>
|
||||
#include <lib/nfc/protocols/mifare_classic.h>
|
||||
|
Loading…
Reference in New Issue
Block a user