| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212 |
- commit 7ac7b708840d29daf8f358f629119f61b859aaa0
- Author: gornekich <n.gorbadey@gmail.com>
- Date: Mon Apr 10 19:51:55 2023 +0400
- [FL-3241] NFC disable EMV support (#2571)
-
- * nfc: remove read emv from extra actions
- * nfc: remove read emv
-
- Co-authored-by: あく <alleteam@gmail.com>
- diff --git a/applications/main/nfc/scenes/nfc_scene_read.c b/applications/main/nfc/scenes/nfc_scene_read.c
- index 4252883b2..938f2da67 100644
- --- a/applications/main/nfc/scenes/nfc_scene_read.c
- +++ b/applications/main/nfc/scenes/nfc_scene_read.c
- @@ -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);
- diff --git a/applications/main/nfc/scenes/nfc_scene_read_card_type.c b/applications/main/nfc/scenes/nfc_scene_read_card_type.c
- index 94262aa1e..8023026c3 100644
- --- a/applications/main/nfc/scenes/nfc_scene_read_card_type.c
- +++ b/applications/main/nfc/scenes/nfc_scene_read_card_type.c
- @@ -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);
- diff --git a/lib/nfc/nfc_device.h b/lib/nfc/nfc_device.h
- index 8b2e6e5ba..df37ec3df 100644
- --- a/lib/nfc/nfc_device.h
- +++ b/lib/nfc/nfc_device.h
- @@ -56,7 +56,6 @@ typedef enum {
- NfcReadModeMfClassic,
- NfcReadModeMfUltralight,
- NfcReadModeMfDesfire,
- - NfcReadModeEMV,
- NfcReadModeNFCA,
- } NfcReadMode;
-
- diff --git a/lib/nfc/nfc_worker.c b/lib/nfc/nfc_worker.c
- index c2b89c71a..28a1f6827 100644
- --- a/lib/nfc/nfc_worker.c
- +++ b/lib/nfc/nfc_worker.c
- @@ -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;
- diff --git a/lib/nfc/nfc_worker.h b/lib/nfc/nfc_worker.h
- index ce542828a..8e993fc6a 100644
- --- a/lib/nfc/nfc_worker.h
- +++ b/lib/nfc/nfc_worker.h
- @@ -39,7 +39,6 @@ typedef enum {
- NfcWorkerEventReadMfClassicDone,
- NfcWorkerEventReadMfClassicLoadKeyCache,
- NfcWorkerEventReadMfClassicDictAttackRequired,
- - NfcWorkerEventReadBankCard,
-
- // Nfc worker common events
- NfcWorkerEventSuccess,
- diff --git a/lib/nfc/nfc_worker_i.h b/lib/nfc/nfc_worker_i.h
- index 9733426ab..701ecb90c 100644
- --- a/lib/nfc/nfc_worker_i.h
- +++ b/lib/nfc/nfc_worker_i.h
- @@ -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>
|