mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 15:26:13 +08:00
adapt name to match code style
This commit is contained in:
parent
d9f2d5287e
commit
5faf625032
|
@ -144,7 +144,7 @@ static hf14a_config hf14aconfig = { 0, 0, 0, 0, 0 } ;
|
|||
|
||||
|
||||
// Polling frames and configurations
|
||||
static iso14a_polling_parameters WUPA_POLLING_PARAMETERS = {
|
||||
static iso14a_polling_parameters_t WUPA_POLLING_PARAMETERS = {
|
||||
.frames = { {{ 0x52 }, 1, 7, 0} },
|
||||
.frame_count = 1,
|
||||
.extra_timeout = 0,
|
||||
|
@ -2523,7 +2523,7 @@ static void iso14a_set_ATS_times(const uint8_t *ats) {
|
|||
}
|
||||
|
||||
|
||||
static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters *polling_parameters) {
|
||||
static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters_t *polling_parameters) {
|
||||
#define WUPA_RETRY_TIMEOUT 10
|
||||
|
||||
uint32_t save_iso14a_timeout = iso14a_get_timeout();
|
||||
|
@ -2537,7 +2537,7 @@ static int GetATQA(uint8_t *resp, uint8_t *resp_par, iso14a_polling_parameters *
|
|||
uint8_t current_frame = 0;
|
||||
|
||||
do {
|
||||
iso14a_polling_frame *frame_parameters = &polling_parameters->frames[current_frame];
|
||||
iso14a_polling_frame_t *frame_parameters = &polling_parameters->frames[current_frame];
|
||||
|
||||
if (frame_parameters->last_byte_bits == 8) {
|
||||
ReaderTransmit(frame_parameters->frame, frame_parameters->frame_length, NULL);
|
||||
|
@ -2579,7 +2579,9 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
|
|||
// if anticollision is false, then the UID must be provided in uid_ptr[]
|
||||
// and num_cascades must be set (1: 4 Byte UID, 2: 7 Byte UID, 3: 10 Byte UID)
|
||||
// requests ATS unless no_rats is true
|
||||
int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats, iso14a_polling_parameters *polling_parameters) {
|
||||
int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr,
|
||||
bool anticollision, uint8_t num_cascades, bool no_rats,
|
||||
iso14a_polling_parameters_t *polling_parameters) {
|
||||
|
||||
uint8_t resp[MAX_FRAME_SIZE] = {0}; // theoretically. A usual RATS will be much smaller
|
||||
uint8_t resp_par[MAX_PARITY_SIZE] = {0};
|
||||
|
@ -3033,7 +3035,7 @@ void ReaderIso14443a(PacketCommandNG *c) {
|
|||
|
||||
arg0 = iso14443a_select_cardEx(
|
||||
NULL, card, NULL, true, 0, (param & ISO14A_NO_RATS),
|
||||
(param & ISO14A_USE_CUSTOM_POLLING) ? (iso14a_polling_parameters *)cmd : &WUPA_POLLING_PARAMETERS
|
||||
(param & ISO14A_USE_CUSTOM_POLLING) ? (iso14a_polling_parameters_t *)cmd : &WUPA_POLLING_PARAMETERS
|
||||
);
|
||||
// TODO: Improve by adding a cmd parser pointer and moving it by struct length to allow combining data with polling params
|
||||
FpgaDisableTracing();
|
||||
|
|
|
@ -151,7 +151,7 @@ uint16_t ReaderReceive(uint8_t *receivedAnswer, uint8_t *par);
|
|||
void iso14443a_setup(uint8_t fpga_minor_mode);
|
||||
int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, bool send_chaining, void *data, uint8_t *res);
|
||||
int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats);
|
||||
int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats, iso14a_polling_parameters *polling_parameters);
|
||||
int iso14443a_select_cardEx(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32_t *cuid_ptr, bool anticollision, uint8_t num_cascades, bool no_rats, iso14a_polling_parameters_t *polling_parameters);
|
||||
int iso14443a_fast_select_card(uint8_t *uid_ptr, uint8_t num_cascades);
|
||||
void iso14a_set_trigger(bool enable);
|
||||
|
||||
|
|
|
@ -55,27 +55,27 @@ static int CmdHelp(const char *Cmd);
|
|||
static int waitCmd(bool i_select, uint32_t timeout, bool verbose);
|
||||
|
||||
|
||||
static const iso14a_polling_frame WUPA_FRAME = {
|
||||
static const iso14a_polling_frame_t WUPA_FRAME = {
|
||||
{ 0x52 }, 1, 7, 0,
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame MAGWUPA1_FRAME = {
|
||||
static const iso14a_polling_frame_t MAGWUPA1_FRAME = {
|
||||
{ 0x7A }, 1, 7, 0
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame MAGWUPA2_FRAME = {
|
||||
static const iso14a_polling_frame_t MAGWUPA2_FRAME = {
|
||||
{ 0x7B }, 1, 7, 0
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame MAGWUPA3_FRAME = {
|
||||
static const iso14a_polling_frame_t MAGWUPA3_FRAME = {
|
||||
{ 0x7C }, 1, 7, 0
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame MAGWUPA4_FRAME = {
|
||||
static const iso14a_polling_frame_t MAGWUPA4_FRAME = {
|
||||
{ 0x7D }, 1, 7, 0
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame ECP_FRAME = {
|
||||
static const iso14a_polling_frame_t 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,
|
||||
|
@ -462,25 +462,25 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
iso14a_polling_parameters iso14a_get_polling_parameters(bool use_ecp, bool use_magsafe) {
|
||||
iso14a_polling_parameters_t iso14a_get_polling_parameters(bool use_ecp, bool use_magsafe) {
|
||||
// Extra 100ms give enough time for Apple (ECP) devices to proccess field info and make a decision
|
||||
|
||||
if (use_ecp && use_magsafe) {
|
||||
iso14a_polling_parameters full_polling_parameters = {
|
||||
iso14a_polling_parameters_t full_polling_parameters = {
|
||||
.frames = { WUPA_FRAME, ECP_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME },
|
||||
.frame_count = 6,
|
||||
.extra_timeout = 100
|
||||
};
|
||||
return full_polling_parameters;
|
||||
} else if (use_ecp) {
|
||||
iso14a_polling_parameters ecp_polling_parameters = {
|
||||
iso14a_polling_parameters_t ecp_polling_parameters = {
|
||||
.frames = { WUPA_FRAME, ECP_FRAME },
|
||||
.frame_count = 2,
|
||||
.extra_timeout = 100
|
||||
};
|
||||
return ecp_polling_parameters;
|
||||
} else if (use_magsafe) {
|
||||
iso14a_polling_parameters magsafe_polling_parameters = {
|
||||
iso14a_polling_parameters_t magsafe_polling_parameters = {
|
||||
.frames = { WUPA_FRAME, MAGWUPA1_FRAME, MAGWUPA2_FRAME, MAGWUPA3_FRAME, MAGWUPA4_FRAME },
|
||||
.frame_count = 5,
|
||||
.extra_timeout = 0
|
||||
|
@ -488,7 +488,7 @@ iso14a_polling_parameters iso14a_get_polling_parameters(bool use_ecp, bool use_m
|
|||
return magsafe_polling_parameters;
|
||||
}
|
||||
|
||||
iso14a_polling_parameters wupa_polling_parameters = {
|
||||
iso14a_polling_parameters_t wupa_polling_parameters = {
|
||||
.frames = { WUPA_FRAME },
|
||||
.frame_count = 1,
|
||||
.extra_timeout = 0,
|
||||
|
@ -539,8 +539,8 @@ static int CmdHF14AReader(const char *Cmd) {
|
|||
bool use_ecp = arg_get_lit(ctx, 5);
|
||||
bool use_magsafe = arg_get_lit(ctx, 6);
|
||||
|
||||
iso14a_polling_parameters *polling_parameters = NULL;
|
||||
iso14a_polling_parameters parameters = iso14a_get_polling_parameters(use_ecp, use_magsafe);
|
||||
iso14a_polling_parameters_t *polling_parameters = NULL;
|
||||
iso14a_polling_parameters_t parameters = iso14a_get_polling_parameters(use_ecp, use_magsafe);
|
||||
if (use_ecp || use_magsafe) {
|
||||
cm |= ISO14A_USE_CUSTOM_POLLING;
|
||||
polling_parameters = ¶meters;
|
||||
|
@ -562,7 +562,7 @@ static int CmdHF14AReader(const char *Cmd) {
|
|||
clearCommandBuffer();
|
||||
|
||||
if (cm & ISO14A_USE_CUSTOM_POLLING) {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, cm, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters));
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, cm, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters_t));
|
||||
} else {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, cm, 0, 0, NULL, 0);
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leav
|
|||
return 0;
|
||||
}
|
||||
|
||||
int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card_select_t *card, iso14a_polling_parameters *polling_parameters) {
|
||||
int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card_select_t *card, iso14a_polling_parameters_t *polling_parameters) {
|
||||
// global vars should be prefixed with g_
|
||||
gs_frame_len = 0;
|
||||
gs_frames_num = 0;
|
||||
|
@ -981,7 +981,7 @@ int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card
|
|||
// Anticollision + SELECT card
|
||||
PacketResponseNG resp;
|
||||
if (polling_parameters != NULL) {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_USE_CUSTOM_POLLING, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters));
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT | ISO14A_USE_CUSTOM_POLLING, 0, 0, (uint8_t *)polling_parameters, sizeof(iso14a_polling_parameters_t));
|
||||
} else {
|
||||
SendCommandMIX(CMD_HF_ISO14443A_READER, ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0, NULL, 0);
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ int Hf14443_4aGetCardData(iso14a_card_select_t *card);
|
|||
int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
|
||||
int ExchangeRAW14a(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, bool silentMode);
|
||||
|
||||
iso14a_polling_parameters iso14a_get_polling_parameters(bool use_ecp, bool use_magsafe);
|
||||
iso14a_polling_parameters_t iso14a_get_polling_parameters(bool use_ecp, bool use_magsafe);
|
||||
int SelectCard14443A_4(bool disconnect, bool verbose, iso14a_card_select_t *card);
|
||||
int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card_select_t *card, iso14a_polling_parameters *polling_parameters);
|
||||
int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card_select_t *card, iso14a_polling_parameters_t *polling_parameters);
|
||||
|
||||
bool Get_apdu_in_framing(void);
|
||||
void Set_apdu_in_framing(bool v);
|
||||
|
|
|
@ -41,14 +41,14 @@
|
|||
#include "mbedtls/ecc_point_compression.h"
|
||||
#include "mbedtls/gcm.h"
|
||||
|
||||
static const iso14a_polling_frame WUPA_FRAME = {
|
||||
static const iso14a_polling_frame_t WUPA_FRAME = {
|
||||
.frame = { 0x52 },
|
||||
.frame_length = 1,
|
||||
.last_byte_bits = 7,
|
||||
.extra_delay = 0,
|
||||
};
|
||||
|
||||
static const iso14a_polling_frame ECP_VAS_ONLY_FRAME = {
|
||||
static const iso14a_polling_frame_t ECP_VAS_ONLY_FRAME = {
|
||||
.frame = {0x6a, 0x01, 0x00, 0x00, 0x02, 0xe4, 0xd2},
|
||||
.frame_length = 7,
|
||||
.last_byte_bits = 8,
|
||||
|
@ -349,7 +349,7 @@ static int DecryptVASCryptogram(uint8_t *pidHash, uint8_t *cryptogram, size_t cr
|
|||
static int VASReader(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *cryptogram, size_t *cryptogramLen, bool verbose) {
|
||||
clearCommandBuffer();
|
||||
|
||||
iso14a_polling_parameters polling_parameters = {
|
||||
iso14a_polling_parameters_t polling_parameters = {
|
||||
.frames = { WUPA_FRAME, ECP_VAS_ONLY_FRAME },
|
||||
.frame_count = 2,
|
||||
.extra_timeout = 250
|
||||
|
|
|
@ -86,15 +86,15 @@ typedef struct {
|
|||
uint8_t frame_length;
|
||||
uint8_t last_byte_bits;
|
||||
uint16_t extra_delay;
|
||||
} iso14a_polling_frame;
|
||||
} PACKED iso14a_polling_frame_t;
|
||||
|
||||
// Defines polling sequence configuration
|
||||
// 6 would be enough for 4 magsafe, 1 wupa, 1 ecp,
|
||||
typedef struct {
|
||||
iso14a_polling_frame frames[6];
|
||||
iso14a_polling_frame_t frames[6];
|
||||
uint8_t frame_count;
|
||||
uint16_t extra_timeout;
|
||||
} iso14a_polling_parameters;
|
||||
} PACKED iso14a_polling_parameters_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t *response;
|
||||
|
|
Loading…
Reference in a new issue