From 0397dd0a40895d58bce4381f897fc926cb01c4da Mon Sep 17 00:00:00 2001 From: Methodius Date: Wed, 14 Feb 2024 17:41:45 +0900 Subject: [PATCH] fix false-positive emv protocol detect --- .../main/nfc/helpers/protocol_support/emv/emv_render.c | 5 ----- lib/nfc/protocols/emv/emv.h | 2 ++ lib/nfc/protocols/emv/emv_poller.c | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/applications/main/nfc/helpers/protocol_support/emv/emv_render.c b/applications/main/nfc/helpers/protocol_support/emv/emv_render.c index 6b571e7b8..d5c1e5105 100644 --- a/applications/main/nfc/helpers/protocol_support/emv/emv_render.c +++ b/applications/main/nfc/helpers/protocol_support/emv/emv_render.c @@ -66,11 +66,6 @@ void nfc_render_emv_country(uint16_t country_code, FuriString* str) { void nfc_render_emv_application(const EmvApplication* apl, FuriString* str) { const uint8_t len = apl->aid_len; - if(!len) { - furi_string_cat_printf(str, "No Pay Application found\n"); - return; - } - furi_string_cat_printf(str, "AID: "); for(uint8_t i = 0; i < len; i++) furi_string_cat_printf(str, "%02X", apl->aid[i]); furi_string_cat_printf(str, "\n"); diff --git a/lib/nfc/protocols/emv/emv.h b/lib/nfc/protocols/emv/emv.h index d7708e049..e09eacaa4 100644 --- a/lib/nfc/protocols/emv/emv.h +++ b/lib/nfc/protocols/emv/emv.h @@ -10,6 +10,8 @@ extern "C" { #define EMV_REQ_GET_DATA 0x80CA +#define UNKNOWN_TAG 0x0B + #define EMV_TAG_AID 0x4F #define EMV_TAG_PRIORITY 0x87 #define EMV_TAG_APPL_INTERCHANGE_PROFILE 0x82 diff --git a/lib/nfc/protocols/emv/emv_poller.c b/lib/nfc/protocols/emv/emv_poller.c index 6ca21df1c..9acb854d6 100644 --- a/lib/nfc/protocols/emv/emv_poller.c +++ b/lib/nfc/protocols/emv/emv_poller.c @@ -186,7 +186,7 @@ static bool emv_poller_detect(NfcGenericEvent event, void* context) { if(iso14443_4a_event->type == Iso14443_4aPollerEventTypeReady) { const EmvError error = emv_poller_select_ppse(instance); - protocol_detected = (error == EmvErrorNone); + protocol_detected = (error == EmvErrorNone) && (instance->data->emv_application.aid_len); } return protocol_detected;