flipperzero-firmware_official_dev 835 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. commit 7ac7b708840d29daf8f358f629119f61b859aaa0
  2. Author: gornekich <n.gorbadey@gmail.com>
  3. Date: Mon Apr 10 19:51:55 2023 +0400
  4. [FL-3241] NFC disable EMV support (#2571)
  5. * nfc: remove read emv from extra actions
  6. * nfc: remove read emv
  7. Co-authored-by: あく <alleteam@gmail.com>
  8. diff --git a/applications/main/nfc/scenes/nfc_scene_read.c b/applications/main/nfc/scenes/nfc_scene_read.c
  9. index 4252883b2..938f2da67 100644
  10. --- a/applications/main/nfc/scenes/nfc_scene_read.c
  11. +++ b/applications/main/nfc/scenes/nfc_scene_read.c
  12. @@ -85,11 +85,6 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
  13. scene_manager_next_scene(nfc->scene_manager, NfcSceneMfDesfireReadSuccess);
  14. DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
  15. consumed = true;
  16. - } else if(event.event == NfcWorkerEventReadBankCard) {
  17. - notification_message(nfc->notifications, &sequence_success);
  18. - scene_manager_next_scene(nfc->scene_manager, NfcSceneEmvReadSuccess);
  19. - DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
  20. - consumed = true;
  21. } else if(event.event == NfcWorkerEventReadMfClassicDictAttackRequired) {
  22. if(mf_classic_dict_check_presence(MfClassicDictTypeSystem)) {
  23. scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicDictAttack);
  24. diff --git a/applications/main/nfc/scenes/nfc_scene_read_card_type.c b/applications/main/nfc/scenes/nfc_scene_read_card_type.c
  25. index 94262aa1e..8023026c3 100644
  26. --- a/applications/main/nfc/scenes/nfc_scene_read_card_type.c
  27. +++ b/applications/main/nfc/scenes/nfc_scene_read_card_type.c
  28. @@ -5,7 +5,6 @@ enum SubmenuIndex {
  29. SubmenuIndexReadMifareClassic,
  30. SubmenuIndexReadMifareDesfire,
  31. SubmenuIndexReadMfUltralight,
  32. - SubmenuIndexReadEMV,
  33. SubmenuIndexReadNFCA,
  34. };
  35. @@ -37,12 +36,6 @@ void nfc_scene_read_card_type_on_enter(void* context) {
  36. SubmenuIndexReadMfUltralight,
  37. nfc_scene_read_card_type_submenu_callback,
  38. nfc);
  39. - submenu_add_item(
  40. - submenu,
  41. - "Read EMV card",
  42. - SubmenuIndexReadEMV,
  43. - nfc_scene_read_card_type_submenu_callback,
  44. - nfc);
  45. submenu_add_item(
  46. submenu,
  47. "Read NFC-A data",
  48. @@ -75,11 +68,6 @@ bool nfc_scene_read_card_type_on_event(void* context, SceneManagerEvent event) {
  49. scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
  50. consumed = true;
  51. }
  52. - if(event.event == SubmenuIndexReadEMV) {
  53. - nfc->dev->dev_data.read_mode = NfcReadModeEMV;
  54. - scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
  55. - consumed = true;
  56. - }
  57. if(event.event == SubmenuIndexReadNFCA) {
  58. nfc->dev->dev_data.read_mode = NfcReadModeNFCA;
  59. scene_manager_next_scene(nfc->scene_manager, NfcSceneRead);
  60. diff --git a/lib/nfc/nfc_device.h b/lib/nfc/nfc_device.h
  61. index 8b2e6e5ba..df37ec3df 100644
  62. --- a/lib/nfc/nfc_device.h
  63. +++ b/lib/nfc/nfc_device.h
  64. @@ -56,7 +56,6 @@ typedef enum {
  65. NfcReadModeMfClassic,
  66. NfcReadModeMfUltralight,
  67. NfcReadModeMfDesfire,
  68. - NfcReadModeEMV,
  69. NfcReadModeNFCA,
  70. } NfcReadMode;
  71. diff --git a/lib/nfc/nfc_worker.c b/lib/nfc/nfc_worker.c
  72. index c2b89c71a..28a1f6827 100644
  73. --- a/lib/nfc/nfc_worker.c
  74. +++ b/lib/nfc/nfc_worker.c
  75. @@ -229,69 +229,6 @@ static bool nfc_worker_read_mf_desfire(NfcWorker* nfc_worker, FuriHalNfcTxRxCont
  76. return read_success;
  77. }
  78. -static bool nfc_worker_read_bank_card(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* tx_rx) {
  79. - bool read_success = false;
  80. - EmvApplication emv_app = {};
  81. - EmvData* result = &nfc_worker->dev_data->emv_data;
  82. -
  83. - if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
  84. - reader_analyzer_prepare_tx_rx(nfc_worker->reader_analyzer, tx_rx, false);
  85. - reader_analyzer_start(nfc_worker->reader_analyzer, ReaderAnalyzerModeDebugLog);
  86. - }
  87. -
  88. - // Bank cards require strong field to start application. If we find AID, try at least several
  89. - // times to start EMV application
  90. - uint8_t start_application_attempts = 0;
  91. - while(start_application_attempts < 3) {
  92. - if(nfc_worker->state != NfcWorkerStateRead) break;
  93. - start_application_attempts++;
  94. - if(!furi_hal_nfc_detect(&nfc_worker->dev_data->nfc_data, 300)) break;
  95. - if(emv_read_bank_card(tx_rx, &emv_app)) {
  96. - FURI_LOG_D(TAG, "Bank card number read from %d attempt", start_application_attempts);
  97. - break;
  98. - } else if(emv_app.aid_len && !emv_app.app_started) {
  99. - FURI_LOG_D(
  100. - TAG,
  101. - "AID found but failed to start EMV app from %d attempt",
  102. - start_application_attempts);
  103. - furi_hal_nfc_sleep();
  104. - continue;
  105. - } else {
  106. - FURI_LOG_D(TAG, "Failed to find AID");
  107. - break;
  108. - }
  109. - }
  110. - // Copy data
  111. - if(emv_app.aid_len) {
  112. - result->aid_len = emv_app.aid_len;
  113. - memcpy(result->aid, emv_app.aid, result->aid_len);
  114. - read_success = true;
  115. - }
  116. - if(emv_app.card_number_len) {
  117. - result->number_len = emv_app.card_number_len;
  118. - memcpy(result->number, emv_app.card_number, result->number_len);
  119. - }
  120. - if(emv_app.name_found) {
  121. - memcpy(result->name, emv_app.name, sizeof(emv_app.name));
  122. - }
  123. - if(emv_app.exp_month) {
  124. - result->exp_mon = emv_app.exp_month;
  125. - result->exp_year = emv_app.exp_year;
  126. - }
  127. - if(emv_app.country_code) {
  128. - result->country_code = emv_app.country_code;
  129. - }
  130. - if(emv_app.currency_code) {
  131. - result->currency_code = emv_app.currency_code;
  132. - }
  133. -
  134. - if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) {
  135. - reader_analyzer_stop(nfc_worker->reader_analyzer);
  136. - }
  137. -
  138. - return read_success;
  139. -}
  140. -
  141. static bool nfc_worker_read_nfca(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* tx_rx) {
  142. FuriHalNfcDevData* nfc_data = &nfc_worker->dev_data->nfc_data;
  143. @@ -315,14 +252,6 @@ static bool nfc_worker_read_nfca(NfcWorker* nfc_worker, FuriHalNfcTxRxContext* t
  144. nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
  145. }
  146. card_read = true;
  147. - } else if(nfc_data->interface == FuriHalNfcInterfaceIsoDep) {
  148. - FURI_LOG_I(TAG, "ISO14443-4 card detected");
  149. - nfc_worker->dev_data->protocol = NfcDeviceProtocolEMV;
  150. - if(!nfc_worker_read_bank_card(nfc_worker, tx_rx)) {
  151. - FURI_LOG_I(TAG, "Unknown card. Save UID");
  152. - nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
  153. - }
  154. - card_read = true;
  155. } else {
  156. nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
  157. card_read = true;
  158. @@ -358,9 +287,6 @@ void nfc_worker_read(NfcWorker* nfc_worker) {
  159. } else if(dev_data->protocol == NfcDeviceProtocolMifareDesfire) {
  160. event = NfcWorkerEventReadMfDesfire;
  161. break;
  162. - } else if(dev_data->protocol == NfcDeviceProtocolEMV) {
  163. - event = NfcWorkerEventReadBankCard;
  164. - break;
  165. } else if(dev_data->protocol == NfcDeviceProtocolUnknown) {
  166. event = NfcWorkerEventReadUidNfcA;
  167. break;
  168. @@ -444,12 +370,6 @@ void nfc_worker_read_type(NfcWorker* nfc_worker) {
  169. event = NfcWorkerEventReadMfDesfire;
  170. break;
  171. }
  172. - } else if(read_mode == NfcReadModeEMV) {
  173. - nfc_worker->dev_data->protocol = NfcDeviceProtocolEMV;
  174. - if(nfc_worker_read_bank_card(nfc_worker, &tx_rx)) {
  175. - event = NfcWorkerEventReadBankCard;
  176. - break;
  177. - }
  178. } else if(read_mode == NfcReadModeNFCA) {
  179. nfc_worker->dev_data->protocol = NfcDeviceProtocolUnknown;
  180. event = NfcWorkerEventReadUidNfcA;
  181. diff --git a/lib/nfc/nfc_worker.h b/lib/nfc/nfc_worker.h
  182. index ce542828a..8e993fc6a 100644
  183. --- a/lib/nfc/nfc_worker.h
  184. +++ b/lib/nfc/nfc_worker.h
  185. @@ -39,7 +39,6 @@ typedef enum {
  186. NfcWorkerEventReadMfClassicDone,
  187. NfcWorkerEventReadMfClassicLoadKeyCache,
  188. NfcWorkerEventReadMfClassicDictAttackRequired,
  189. - NfcWorkerEventReadBankCard,
  190. // Nfc worker common events
  191. NfcWorkerEventSuccess,
  192. diff --git a/lib/nfc/nfc_worker_i.h b/lib/nfc/nfc_worker_i.h
  193. index 9733426ab..701ecb90c 100644
  194. --- a/lib/nfc/nfc_worker_i.h
  195. +++ b/lib/nfc/nfc_worker_i.h
  196. @@ -6,7 +6,6 @@
  197. #include <lib/toolbox/stream/file_stream.h>
  198. #include <lib/nfc/protocols/nfc_util.h>
  199. -#include <lib/nfc/protocols/emv.h>
  200. #include <lib/nfc/protocols/mifare_common.h>
  201. #include <lib/nfc/protocols/mifare_ultralight.h>
  202. #include <lib/nfc/protocols/mifare_classic.h>