diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 26a743114..da1bfbc2f 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -143,62 +143,62 @@ Default HF 14a config is set to: static hf14a_config hf14aconfig = { 0, 0, 0, 0, 0 } ; -// Polling frames and configurations +// Polling frames and configurations -/*static iso14a_polling_frame REQA_FRAME = { - { 0x26 }, 1, 7, 0 +/*static iso14a_polling_frame REQA_FRAME = { + { 0x26 }, 1, 7, 0 };*/ -static const iso14a_polling_frame WUPA_FRAME = { +static const iso14a_polling_frame WUPA_FRAME = { { 0x52 }, 1, 7, 0, }; -static const iso14a_polling_frame MAGWUPA1_FRAME = { - { 0x7A }, 1, 7, 0 +static const iso14a_polling_frame MAGWUPA1_FRAME = { + { 0x7A }, 1, 7, 0 }; -static const iso14a_polling_frame MAGWUPA2_FRAME = { - { 0x7B }, 1, 7, 0 +static const iso14a_polling_frame MAGWUPA2_FRAME = { + { 0x7B }, 1, 7, 0 }; -static const iso14a_polling_frame MAGWUPA3_FRAME = { - { 0x7C }, 1, 7, 0 +static const iso14a_polling_frame MAGWUPA3_FRAME = { + { 0x7C }, 1, 7, 0 }; -static const iso14a_polling_frame MAGWUPA4_FRAME = { - { 0x7D }, 1, 7, 0 +static const iso14a_polling_frame MAGWUPA4_FRAME = { + { 0x7D }, 1, 7, 0 }; -static const iso14a_polling_frame ECP_FRAME = { - .frame={ 0x6a, 0x02, 0xC8, 0x01, 0x00, 0x03, 0x00, 0x02, 0x79, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xD8}, - .frame_length=15, - .last_byte_bits=8, - .extra_delay=0 +static const iso14a_polling_frame ECP_FRAME = { + .frame = { 0x6a, 0x02, 0xC8, 0x01, 0x00, 0x03, 0x00, 0x02, 0x79, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xD8}, + .frame_length = 15, + .last_byte_bits = 8, + .extra_delay = 0 }; static iso14a_polling_parameters WUPA_POLLING_PARAMETERS = { - .frames={ WUPA_FRAME }, - .frame_count=1, - .extra_timeout=0, + .frames = { WUPA_FRAME }, + .frame_count = 1, + .extra_timeout = 0, }; static iso14a_polling_parameters MAGSAFE_POLLING_PARAMETERS = { - .frames={ WUPA_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME }, - .frame_count=5, - .extra_timeout=0 + .frames = { WUPA_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME }, + .frame_count = 5, + .extra_timeout = 0 }; // Extra 100ms give enough time for Apple devices to proccess field info and make a decision static iso14a_polling_parameters ECP_POLLING_PARAMETERS = { - .frames={ WUPA_FRAME, ECP_FRAME }, - .frame_count=2, - .extra_timeout=100 + .frames = { WUPA_FRAME, ECP_FRAME }, + .frame_count = 2, + .extra_timeout = 100 }; static iso14a_polling_parameters FULL_POLLING_PARAMETERS = { - .frames={ WUPA_FRAME, ECP_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME }, - .frame_count=6, - .extra_timeout=100 + .frames = { WUPA_FRAME, ECP_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME }, + .frame_count = 6, + .extra_timeout = 100 }; @@ -2570,7 +2570,7 @@ static void iso14a_set_ATS_times(const uint8_t *ats) { static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters parameters) { - #define WUPA_RETRY_TIMEOUT 10 +#define WUPA_RETRY_TIMEOUT 10 uint32_t save_iso14a_timeout = iso14a_get_timeout(); iso14a_set_timeout(1236 / 128 + 1); // response to WUPA is expected at exactly 1236/fc. No need to wait longer. @@ -2587,7 +2587,7 @@ static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters p if (frame_parameters.last_byte_bits == 8) { ReaderTransmit(frame_parameters.frame, frame_parameters.frame_length, NULL); - + } else { ReaderTransmitBitsPar(frame_parameters.frame, frame_parameters.last_byte_bits, NULL, NULL); } @@ -2595,7 +2595,7 @@ static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters p if (frame_parameters.extra_delay) { SpinDelay(frame_parameters.extra_delay); } - + // Receive the ATQA len = ReaderReceive(resp, resp_par); @@ -2628,7 +2628,7 @@ iso14a_polling_parameters iso14a_get_polling_parameters(bool use_ecp, bool use_m return ECP_POLLING_PARAMETERS; } else if (use_magsafe) { return MAGSAFE_POLLING_PARAMETERS; - } + } return WUPA_POLLING_PARAMETERS; } diff --git a/armsrc/iso14443a.h b/armsrc/iso14443a.h index 186bebfb4..80a223379 100644 --- a/armsrc/iso14443a.h +++ b/armsrc/iso14443a.h @@ -120,9 +120,9 @@ typedef struct { // Defines polling sequence configuration // 4 magsafe, 1 wupa, 1 reqa, 1 ecp, 1 extra typedef struct { - iso14a_polling_frame frames[8]; - uint8_t frame_count; - uint16_t extra_timeout; + iso14a_polling_frame frames[8]; + uint8_t frame_count; + uint16_t extra_timeout; } iso14a_polling_parameters; diff --git a/doc/commands.json b/doc/commands.json index 40ae8cbc9..775087e22 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -4806,7 +4806,7 @@ }, "hf mf staticnested": { "command": "hf mf staticnested", - "description": "Execute Nested attack against MIFARE Classic card with static nonce for key recovery. Supply a known key from one block to recover all keys", + "description": "Execute static nested attack against MIFARE Classic card with static nonce for key recovery. Supply a known key from one block to recover all keys", "notes": [ "hf mf staticnested --mini --blk 0 -a -k FFFFFFFFFFFF", "hf mf staticnested --1k --blk 0 -a -k FFFFFFFFFFFF", @@ -11689,6 +11689,6 @@ "metadata": { "commands_extracted": 679, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2023-07-14T16:33:40" + "extracted_on": "2023-07-16T13:30:30" } } \ No newline at end of file