From 82352705dd0121c8e53bf7cfb13f50e4137df736 Mon Sep 17 00:00:00 2001 From: Chris van Marle Date: Tue, 11 Oct 2022 22:12:54 +0200 Subject: [PATCH] MRTD rename mrtd_data.auth.bac to mrtd_data.auth --- .../nfc/scenes/nfc_scene_passport_bac.c | 12 ++++++------ .../nfc/scenes/nfc_scene_passport_date.c | 8 ++++---- lib/nfc/protocols/mrtd.h | 17 +++++++---------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/applications/nfc/scenes/nfc_scene_passport_bac.c b/applications/nfc/scenes/nfc_scene_passport_bac.c index bc27a91f5..ba3b3dfd0 100644 --- a/applications/nfc/scenes/nfc_scene_passport_bac.c +++ b/applications/nfc/scenes/nfc_scene_passport_bac.c @@ -40,17 +40,17 @@ void nfc_scene_passport_bac_on_enter(void* context) { const size_t temp_str_size = 10; char temp_str[temp_str_size]; snprintf(temp_str, temp_str_size, "%02u%02u%02u", - nfc->dev->dev_data.mrtd_data.auth.bac.birth_date.year, - nfc->dev->dev_data.mrtd_data.auth.bac.birth_date.month, - nfc->dev->dev_data.mrtd_data.auth.bac.birth_date.day); + nfc->dev->dev_data.mrtd_data.auth.birth_date.year, + nfc->dev->dev_data.mrtd_data.auth.birth_date.month, + nfc->dev->dev_data.mrtd_data.auth.birth_date.day); item = variable_item_list_add(variable_item_list, "Birth Date", 1, NULL, NULL); variable_item_set_current_value_text(item, temp_str); snprintf(temp_str, temp_str_size, "%02u%02u%02u", - nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date.year, - nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date.month, - nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date.day); + nfc->dev->dev_data.mrtd_data.auth.expiry_date.year, + nfc->dev->dev_data.mrtd_data.auth.expiry_date.month, + nfc->dev->dev_data.mrtd_data.auth.expiry_date.day); item = variable_item_list_add(variable_item_list, "Expiry Date", 1, NULL, NULL); variable_item_set_current_value_text(item, temp_str); diff --git a/applications/nfc/scenes/nfc_scene_passport_date.c b/applications/nfc/scenes/nfc_scene_passport_date.c index 45ef86486..cee59038f 100644 --- a/applications/nfc/scenes/nfc_scene_passport_date.c +++ b/applications/nfc/scenes/nfc_scene_passport_date.c @@ -29,11 +29,11 @@ void nfc_scene_passport_date_on_enter(void* context) { switch(date_type) { case NFC_PASSPORT_DATE_BIRTH: text_input_set_header_text(text_input, "Birth Date"); - date_value = nfc->dev->dev_data.mrtd_data.auth.bac.birth_date; + date_value = nfc->dev->dev_data.mrtd_data.auth.birth_date; break; case NFC_PASSPORT_DATE_EXPIRY: text_input_set_header_text(text_input, "Expiry Date"); - date_value = nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date; + date_value = nfc->dev->dev_data.mrtd_data.auth.expiry_date; break; } @@ -90,10 +90,10 @@ bool nfc_scene_passport_date_save(Nfc* nfc) { //TODO: use types in .h file? also in nfc_scene_passport_bac.c switch(date_type) { case NFC_PASSPORT_DATE_BIRTH: - nfc->dev->dev_data.mrtd_data.auth.bac.birth_date = date_value; + nfc->dev->dev_data.mrtd_data.auth.birth_date = date_value; break; case NFC_PASSPORT_DATE_EXPIRY: - nfc->dev->dev_data.mrtd_data.auth.bac.expiry_date = date_value; + nfc->dev->dev_data.mrtd_data.auth.expiry_date = date_value; break; } diff --git a/lib/nfc/protocols/mrtd.h b/lib/nfc/protocols/mrtd.h index 6963439b0..87f856b08 100644 --- a/lib/nfc/protocols/mrtd.h +++ b/lib/nfc/protocols/mrtd.h @@ -18,13 +18,6 @@ typedef struct { // NULL terminated document ID #define MRTD_DOCNR_MAX_LENGTH 21 -typedef struct { - // BAC input fields - MrtdDate birth_date; - MrtdDate expiry_date; - char doc_number[MRTD_DOCNR_MAX_LENGTH]; -} MrtdBacData; - typedef enum { MrtdAuthMethodBac, MrtdAuthMethodPace, @@ -32,9 +25,13 @@ typedef enum { typedef struct { MrtdAuthMethod method; - union { - MrtdBacData bac; - }; + + // BAC input fields + MrtdDate birth_date; + MrtdDate expiry_date; + char doc_number[MRTD_DOCNR_MAX_LENGTH]; + + //TODO: PACE } MrtdAuthData; typedef struct {