[FL-1723, FL-1662, FL-1870] NFC bug fixes (#745)

* nfc: fix notifications in read EMV sequence
* nfc: set focus on previously saved card
* nfc: add incorrect file format message
* mifare ultralight: increase size of max dump
* elements: draw multiline text only until it fits screen
* nfc: support variable PAN number length
* nfc: change AID display
* nfc: change worker custom event to prevent scene reenter
* nfc: double check for PAN tag
* nfc: fix edit card name appearance
* Nfc: read EMV card without name if PDOL is present.
* Desktop: increase unlock key press interval, switch to OS ticks instead of HAL.
* Desktop: remove debug logging

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
gornekich
2021-10-05 08:14:19 +03:00
committed by GitHub
parent 73a13f584f
commit 42e553bad5
24 changed files with 89 additions and 57 deletions

View File

@@ -198,7 +198,8 @@ uint16_t emv_prepare_get_proc_opt(uint8_t* dest, EmvApplication* app) {
bool emv_decode_get_proc_opt(uint8_t* buff, uint16_t len, EmvApplication* app) {
for(uint16_t i = 0; i < len; i++) {
if(buff[i] == EMV_TAG_CARD_NUM) {
memcpy(app->card_number, &buff[i + 2], 8);
app->card_number_len = 8;
memcpy(app->card_number, &buff[i + 2], app->card_number_len);
return true;
} else if(buff[i] == EMV_TAG_AFL) {
app->afl.size = emv_parse_TLV(app->afl.data, buff, &i);
@@ -225,8 +226,11 @@ bool emv_decode_read_sfi_record(uint8_t* buff, uint16_t len, EmvApplication* app
bool pan_parsed = false;
for(uint16_t i = 0; i < len; i++) {
if(buff[i] == EMV_TAG_PAN) {
memcpy(app->card_number, &buff[i + 2], 8);
pan_parsed = true;
if(buff[i + 1] == 8 || buff[i + 1] == 10) {
app->card_number_len = buff[i + 1];
memcpy(app->card_number, &buff[i + 2], app->card_number_len);
pan_parsed = true;
}
} else if(emv_decode_search_tag_u16_r(EMV_TAG_EXP_DATE, buff, &i)) {
app->exp_year = buff[i++];
app->exp_month = buff[i++];

View File

@@ -38,7 +38,8 @@ typedef struct {
uint8_t aid[16];
uint8_t aid_len;
char name[32];
uint8_t card_number[8];
uint8_t card_number[10];
uint8_t card_number_len;
uint8_t exp_month;
uint8_t exp_year;
uint16_t country_code;

View File

@@ -4,7 +4,7 @@
#include <stdbool.h>
#include <string.h>
#define MF_UL_MAX_DUMP_SIZE 255
#define MF_UL_MAX_DUMP_SIZE 1024
#define MF_UL_TEARING_FLAG_DEFAULT (0xBD)