mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-18 00:38:10 -07:00
code cleanup, gui fixes
This commit is contained in:
committed by
Nikita Vostokov
parent
b1674711a1
commit
ec356626fa
@@ -80,8 +80,8 @@ bool emv_load(EmvData* data, FlipperFormat* ff, uint32_t version) {
|
||||
strcpy(app->name, furi_string_get_cstr(temp_str));
|
||||
|
||||
//Read label
|
||||
if(!flipper_format_read_string(ff, "Label", temp_str)) break;
|
||||
strcpy(app->label, furi_string_get_cstr(temp_str));
|
||||
if(!flipper_format_read_string(ff, "Payment system", temp_str)) break;
|
||||
strcpy(app->payment_sys, furi_string_get_cstr(temp_str));
|
||||
|
||||
uint32_t pan_len;
|
||||
if(!flipper_format_read_uint32(ff, "PAN length", &pan_len, 1)) break;
|
||||
@@ -103,9 +103,9 @@ bool emv_load(EmvData* data, FlipperFormat* ff, uint32_t version) {
|
||||
if(!flipper_format_read_hex(ff, "Expiration month", &app->exp_month, 1)) break;
|
||||
if(!flipper_format_read_hex(ff, "Expiration day", &app->exp_day, 1)) break;
|
||||
|
||||
if(!flipper_format_read_hex(ff, "Effective year", &app->eff_year, 1)) break;
|
||||
if(!flipper_format_read_hex(ff, "Effective month", &app->eff_month, 1)) break;
|
||||
if(!flipper_format_read_hex(ff, "Effective day", &app->eff_day, 1)) break;
|
||||
if(!flipper_format_read_hex(ff, "Issue year", &app->issue_year, 1)) break;
|
||||
if(!flipper_format_read_hex(ff, "Issue month", &app->issue_month, 1)) break;
|
||||
if(!flipper_format_read_hex(ff, "Issue day", &app->issue_day, 1)) break;
|
||||
|
||||
uint32_t pin_try_counter;
|
||||
if(!flipper_format_read_uint32(ff, "PIN counter", &pin_try_counter, 1)) break;
|
||||
@@ -133,7 +133,7 @@ bool emv_save(const EmvData* data, FlipperFormat* ff) {
|
||||
|
||||
if(!flipper_format_write_string_cstr(ff, "Name", app.name)) break;
|
||||
|
||||
if(!flipper_format_write_string_cstr(ff, "Label", app.label)) break;
|
||||
if(!flipper_format_write_string_cstr(ff, "Payment system", app.payment_sys)) break;
|
||||
|
||||
uint32_t pan_len = app.pan_len;
|
||||
if(!flipper_format_write_uint32(ff, "PAN length", &pan_len, 1)) break;
|
||||
@@ -153,9 +153,9 @@ bool emv_save(const EmvData* data, FlipperFormat* ff) {
|
||||
if(!flipper_format_write_hex(ff, "Expiration month", (uint8_t*)&app.exp_month, 1)) break;
|
||||
if(!flipper_format_write_hex(ff, "Expiration day", (uint8_t*)&app.exp_day, 1)) break;
|
||||
|
||||
if(!flipper_format_write_hex(ff, "Effective year", (uint8_t*)&app.eff_year, 1)) break;
|
||||
if(!flipper_format_write_hex(ff, "Effective month", (uint8_t*)&app.eff_month, 1)) break;
|
||||
if(!flipper_format_write_hex(ff, "Effective day", (uint8_t*)&app.eff_day, 1)) break;
|
||||
if(!flipper_format_write_hex(ff, "Issue year", (uint8_t*)&app.issue_year, 1)) break;
|
||||
if(!flipper_format_write_hex(ff, "Issue month", (uint8_t*)&app.issue_month, 1)) break;
|
||||
if(!flipper_format_write_hex(ff, "Issue day", (uint8_t*)&app.issue_day, 1)) break;
|
||||
|
||||
if(!flipper_format_write_uint32(ff, "PIN counter", (uint32_t*)&app.pin_try_counter, 1))
|
||||
break;
|
||||
|
||||
@@ -13,9 +13,9 @@ extern "C" {
|
||||
#define EMV_TAG_AID 0x4F
|
||||
#define EMV_TAG_PRIORITY 0x87
|
||||
#define EMV_TAG_PDOL 0x9F38
|
||||
#define EMV_TAG_APPL_LABEL 0x50
|
||||
#define EMV_TAG_APPL_PAYMENT_SYS 0x50
|
||||
#define EMV_TAG_APPL_NAME 0x9F12
|
||||
#define EMV_TAG_APPL_EFFECTIVE 0x5F25
|
||||
#define EMV_TAG_APPL_ISSUE 0x5F25
|
||||
#define EMV_TAG_PIN_TRY_COUNTER 0x9F17
|
||||
#define EMV_TAG_LOG_ENTRY 0x9F4D
|
||||
#define EMV_TAG_LOG_FMT 0x9F4F
|
||||
@@ -79,15 +79,15 @@ typedef struct {
|
||||
uint8_t aid[16];
|
||||
uint8_t aid_len;
|
||||
char name[16 + 1];
|
||||
char label[16 + 1];
|
||||
char payment_sys[16 + 1];
|
||||
uint8_t pan[10]; // card_number
|
||||
uint8_t pan_len;
|
||||
uint8_t exp_day;
|
||||
uint8_t exp_month;
|
||||
uint8_t exp_year;
|
||||
uint8_t eff_day;
|
||||
uint8_t eff_month;
|
||||
uint8_t eff_year;
|
||||
uint8_t issue_day;
|
||||
uint8_t issue_month;
|
||||
uint8_t issue_year;
|
||||
uint16_t country_code;
|
||||
uint16_t currency_code;
|
||||
uint8_t pin_try_counter;
|
||||
|
||||
@@ -114,11 +114,11 @@ static bool
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APP_PRIORITY %X: %d", tag, app->priority);
|
||||
break;
|
||||
case EMV_TAG_APPL_LABEL:
|
||||
memcpy(app->label, &buff[i], tlen);
|
||||
app->label[tlen] = '\0';
|
||||
case EMV_TAG_APPL_PAYMENT_SYS:
|
||||
memcpy(app->payment_sys, &buff[i], tlen);
|
||||
app->payment_sys[tlen] = '\0';
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_LABEL %x: %s", tag, app->label);
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_PAYMENT_SYS %x: %s", tag, app->payment_sys);
|
||||
break;
|
||||
case EMV_TAG_APPL_NAME:
|
||||
furi_check(tlen < sizeof(app->name));
|
||||
@@ -127,12 +127,12 @@ static bool
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_NAME %x: %s", tag, app->name);
|
||||
break;
|
||||
case EMV_TAG_APPL_EFFECTIVE:
|
||||
app->eff_year = buff[i];
|
||||
app->eff_month = buff[i + 1];
|
||||
app->eff_day = buff[i + 2];
|
||||
case EMV_TAG_APPL_ISSUE:
|
||||
app->issue_year = buff[i];
|
||||
app->issue_month = buff[i + 1];
|
||||
app->issue_day = buff[i + 2];
|
||||
success = true;
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_EFFECTIVE %x:", tag);
|
||||
FURI_LOG_T(TAG, "found EMV_TAG_APPL_ISSUE %x:", tag);
|
||||
break;
|
||||
case EMV_TAG_PDOL:
|
||||
memcpy(app->pdol.data, &buff[i], tlen);
|
||||
|
||||
Reference in New Issue
Block a user