mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
style
This commit is contained in:
parent
d11fe80038
commit
3f92d5ee67
7 changed files with 803 additions and 803 deletions
|
@ -1477,7 +1477,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
EPA_PACE_Simulate(packet);
|
EPA_PACE_Simulate(packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CMD_HF_MIFARE_READER: {
|
case CMD_HF_MIFARE_READER: {
|
||||||
struct p {
|
struct p {
|
||||||
uint8_t first_run;
|
uint8_t first_run;
|
||||||
|
@ -2319,22 +2319,22 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
uint8_t *em = BigBuf_get_EM_addr();
|
uint8_t *em = BigBuf_get_EM_addr();
|
||||||
if (em == NULL) {
|
if (em == NULL) {
|
||||||
reply_ng(CMD_SPIFFS_ELOAD, PM3_EMALLOC, NULL, 0);
|
reply_ng(CMD_SPIFFS_ELOAD, PM3_EMALLOC, NULL, 0);
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *fn = (char *)packet->data.asBytes;
|
char *fn = (char *)packet->data.asBytes;
|
||||||
|
|
||||||
uint32_t size = size_in_spiffs(fn);
|
uint32_t size = size_in_spiffs(fn);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
reply_ng(CMD_SPIFFS_ELOAD, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_SPIFFS_ELOAD, PM3_SUCCESS, NULL, 0);
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rdv40_spiffs_read_as_filetype(fn, em, size, RDV40_SPIFFS_SAFETY_SAFE);
|
rdv40_spiffs_read_as_filetype(fn, em, size, RDV40_SPIFFS_SAFETY_SAFE);
|
||||||
reply_ng(CMD_SPIFFS_ELOAD, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_SPIFFS_ELOAD, PM3_SUCCESS, NULL, 0);
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_FLASHMEM_SET_SPIBAUDRATE: {
|
case CMD_FLASHMEM_SET_SPIBAUDRATE: {
|
||||||
|
|
60
armsrc/epa.c
60
armsrc/epa.c
|
@ -594,42 +594,42 @@ int EPA_Setup(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EPA_PACE_Simulate(PacketCommandNG *c) {
|
void EPA_PACE_Simulate(PacketCommandNG *c) {
|
||||||
|
|
||||||
//---------Initializing---------
|
|
||||||
|
|
||||||
// Get password from arguments
|
//---------Initializing---------
|
||||||
unsigned char pwd[6];
|
|
||||||
memcpy(pwd, c->data.asBytes, 6);
|
|
||||||
|
|
||||||
// Set up communication with the card
|
// Get password from arguments
|
||||||
int res = EPA_Setup();
|
unsigned char pwd[6];
|
||||||
if (res != 0){
|
memcpy(pwd, c->data.asBytes, 6);
|
||||||
EPA_PACE_Collect_Nonce_Abort(CMD_HF_EPA_PACE_SIMULATE, 1, res);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read EF.CardAccess
|
// Set up communication with the card
|
||||||
uint8_t card_access[210] = {0};
|
int res = EPA_Setup();
|
||||||
int card_access_length = EPA_Read_CardAccess(card_access, 210);
|
if (res != 0) {
|
||||||
|
EPA_PACE_Collect_Nonce_Abort(CMD_HF_EPA_PACE_SIMULATE, 1, res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// The response has to be at least this big to hold the OID
|
// Read EF.CardAccess
|
||||||
if (card_access_length < 18) {
|
uint8_t card_access[210] = {0};
|
||||||
EPA_PACE_Collect_Nonce_Abort(CMD_HF_EPA_PACE_SIMULATE, 2, card_access_length);
|
int card_access_length = EPA_Read_CardAccess(card_access, 210);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// PACEInfo of the card
|
// The response has to be at least this big to hold the OID
|
||||||
pace_version_info_t pace_version_info;
|
if (card_access_length < 18) {
|
||||||
|
EPA_PACE_Collect_Nonce_Abort(CMD_HF_EPA_PACE_SIMULATE, 2, card_access_length);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Search for the PACE OID
|
// PACEInfo of the card
|
||||||
res = EPA_Parse_CardAccess(card_access, card_access_length, &pace_version_info);
|
pace_version_info_t pace_version_info;
|
||||||
|
|
||||||
if (res != 0 || pace_version_info.version == 0) {
|
// Search for the PACE OID
|
||||||
EPA_PACE_Collect_Nonce_Abort(CMD_HF_EPA_PACE_SIMULATE, 3, res);
|
res = EPA_Parse_CardAccess(card_access, card_access_length, &pace_version_info);
|
||||||
return;
|
|
||||||
}
|
if (res != 0 || pace_version_info.version == 0) {
|
||||||
|
EPA_PACE_Collect_Nonce_Abort(CMD_HF_EPA_PACE_SIMULATE, 3, res);
|
||||||
Dbprintf("Standardized Domain Parameter: %i", pace_version_info.parameter_id);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Dbprintf("Standardized Domain Parameter: %i", pace_version_info.parameter_id);
|
||||||
DbpString("");
|
DbpString("");
|
||||||
DbpString("finished");
|
DbpString("finished");
|
||||||
}
|
}
|
||||||
|
|
|
@ -578,18 +578,18 @@ int rdv40_spiffs_make_symlink(char *linkdest, char *filename, RDV40SpiFFSSafetyL
|
||||||
int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
int rdv40_spiffs_read_as_filetype(char *filename, uint8_t *dst, uint32_t size, RDV40SpiFFSSafetyLevel level) {
|
||||||
RDV40_SPIFFS_SAFE_FUNCTION(
|
RDV40_SPIFFS_SAFE_FUNCTION(
|
||||||
RDV40SpiFFSFileType filetype = filetype_in_spiffs((char *)filename);
|
RDV40SpiFFSFileType filetype = filetype_in_spiffs((char *)filename);
|
||||||
switch (filetype) {
|
switch (filetype) {
|
||||||
case RDV40_SPIFFS_FILETYPE_REAL:
|
case RDV40_SPIFFS_FILETYPE_REAL:
|
||||||
rdv40_spiffs_read((char *)filename, (uint8_t *)dst, size, level);
|
rdv40_spiffs_read((char *)filename, (uint8_t *)dst, size, level);
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_SYMLINK:
|
case RDV40_SPIFFS_FILETYPE_SYMLINK:
|
||||||
rdv40_spiffs_read_as_symlink(filename, (uint8_t *)dst, size, level);
|
rdv40_spiffs_read_as_symlink(filename, (uint8_t *)dst, size, level);
|
||||||
break;
|
break;
|
||||||
case RDV40_SPIFFS_FILETYPE_BOTH:
|
case RDV40_SPIFFS_FILETYPE_BOTH:
|
||||||
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
case RDV40_SPIFFS_FILETYPE_UNKNOWN:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
|
||||||
CLIParserInit(&ctx, "hf epa replay",
|
CLIParserInit(&ctx, "hf epa replay",
|
||||||
"Perform PACE protocol by replaying given APDUs",
|
"Perform PACE protocol by replaying given APDUs",
|
||||||
"hf epa replay --mse 0022C1A4 --get 1068000000 --map 1086000002 --pka 1234ABCDEF --ma 1A2B3C4D"
|
"hf epa replay --mse 0022C1A4 --get 1068000000 --map 1086000002 --pka 1234ABCDEF --ma 1A2B3C4D"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -216,7 +216,7 @@ static int CmdHFEPAPACESimulate(const char *Cmd) {
|
||||||
"The crypto is performed on pc or proxmark",
|
"The crypto is performed on pc or proxmark",
|
||||||
"hf epa sim --pwd 112233445566\n"
|
"hf epa sim --pwd 112233445566\n"
|
||||||
"hf epa sim --pc --pty 1 --pwd 112233445566"
|
"hf epa sim --pc --pty 1 --pwd 112233445566"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -232,40 +232,40 @@ static int CmdHFEPAPACESimulate(const char *Cmd) {
|
||||||
|
|
||||||
int plen = 0;
|
int plen = 0;
|
||||||
uint8_t pwd[6] = {0};
|
uint8_t pwd[6] = {0};
|
||||||
CLIGetHexWithReturn(ctx, 3, pwd, &plen);
|
CLIGetHexWithReturn(ctx, 3, pwd, &plen);
|
||||||
|
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Starting PACE simulation...");
|
PrintAndLogEx(INFO, "Starting PACE simulation...");
|
||||||
|
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandMIX(CMD_HF_EPA_PACE_SIMULATE, 0, 0, 0, pwd, plen);
|
SendCommandMIX(CMD_HF_EPA_PACE_SIMULATE, 0, 0, 0, pwd, plen);
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
WaitForResponse(CMD_ACK, &resp);
|
WaitForResponse(CMD_ACK, &resp);
|
||||||
|
|
||||||
uint32_t *data = resp.data.asDwords;
|
uint32_t *data = resp.data.asDwords;
|
||||||
|
|
||||||
if (resp.oldarg[0] != 0) {
|
if (resp.oldarg[0] != 0) {
|
||||||
PrintAndLogEx(INFO, "\nPACE failed in step %u!", (uint32_t)resp.oldarg[0]);
|
PrintAndLogEx(INFO, "\nPACE failed in step %u!", (uint32_t)resp.oldarg[0]);
|
||||||
PrintAndLogEx(INFO, "MSE Set AT: %u us", data[0]);
|
PrintAndLogEx(INFO, "MSE Set AT: %u us", data[0]);
|
||||||
PrintAndLogEx(INFO, "GA Get Nonce: %u us", data[1]);
|
PrintAndLogEx(INFO, "GA Get Nonce: %u us", data[1]);
|
||||||
PrintAndLogEx(INFO, "GA Map Nonce: %u us", data[2]);
|
PrintAndLogEx(INFO, "GA Map Nonce: %u us", data[2]);
|
||||||
PrintAndLogEx(INFO, "GA Perform Key Agreement: %u us", data[3]);
|
PrintAndLogEx(INFO, "GA Perform Key Agreement: %u us", data[3]);
|
||||||
PrintAndLogEx(INFO, "GA Mutual Authenticate: %u us", data[4]);
|
PrintAndLogEx(INFO, "GA Mutual Authenticate: %u us", data[4]);
|
||||||
PrintAndLogEx(INFO, "----------------");
|
PrintAndLogEx(INFO, "----------------");
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(INFO, "PACE successful!");
|
PrintAndLogEx(INFO, "PACE successful!");
|
||||||
PrintAndLogEx(INFO, "MSE Set AT: %u us", data[0]);
|
PrintAndLogEx(INFO, "MSE Set AT: %u us", data[0]);
|
||||||
PrintAndLogEx(INFO, "GA Get Nonce: %u us", data[1]);
|
PrintAndLogEx(INFO, "GA Get Nonce: %u us", data[1]);
|
||||||
PrintAndLogEx(INFO, "GA Map Nonce: %u us", data[2]);
|
PrintAndLogEx(INFO, "GA Map Nonce: %u us", data[2]);
|
||||||
PrintAndLogEx(INFO, "GA Perform Key Agreement: %u us", data[3]);
|
PrintAndLogEx(INFO, "GA Perform Key Agreement: %u us", data[3]);
|
||||||
PrintAndLogEx(INFO, "GA Mutual Authenticate: %u us", data[4]);
|
PrintAndLogEx(INFO, "GA Mutual Authenticate: %u us", data[4]);
|
||||||
PrintAndLogEx(INFO, "----------------");
|
PrintAndLogEx(INFO, "----------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ static command_t CommandTable[] = {
|
||||||
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
{"help", CmdHelp, AlwaysAvailable, "This help"},
|
||||||
{"cnonces", CmdHFEPACollectPACENonces, IfPm3Iso14443, "Acquire encrypted PACE nonces of specific size"},
|
{"cnonces", CmdHFEPACollectPACENonces, IfPm3Iso14443, "Acquire encrypted PACE nonces of specific size"},
|
||||||
{"replay", CmdHFEPAPACEReplay, IfPm3Iso14443, "Perform PACE protocol by replaying given APDUs"},
|
{"replay", CmdHFEPAPACEReplay, IfPm3Iso14443, "Perform PACE protocol by replaying given APDUs"},
|
||||||
{"sim", CmdHFEPAPACESimulate, IfPm3Iso14443, "Simulate PACE protocol"},
|
{"sim", CmdHFEPAPACESimulate, IfPm3Iso14443, "Simulate PACE protocol"},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1015,7 +1015,7 @@ static int CmdHFiClassELoad(const char *Cmd) {
|
||||||
bool use_spiffs = arg_get_lit(ctx, 2);
|
bool use_spiffs = arg_get_lit(ctx, 2);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
// use RDV4 spiffs
|
// use RDV4 spiffs
|
||||||
if (use_spiffs && IfPm3Flash() == false) {
|
if (use_spiffs && IfPm3Flash() == false) {
|
||||||
PrintAndLogEx(WARNING, "Device not compiled to support spiffs");
|
PrintAndLogEx(WARNING, "Device not compiled to support spiffs");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
|
|
|
@ -3947,7 +3947,7 @@ int CmdHF14AMfELoad(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "overriding number of blocks, will use %d blocks ( %u bytes )", block_cnt, block_cnt * block_width);
|
PrintAndLogEx(INFO, "overriding number of blocks, will use %d blocks ( %u bytes )", block_cnt, block_cnt * block_width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// use RDV4 spiffs
|
// use RDV4 spiffs
|
||||||
if (use_spiffs && IfPm3Flash() == false) {
|
if (use_spiffs && IfPm3Flash() == false) {
|
||||||
PrintAndLogEx(WARNING, "Device not compiled to support spiffs");
|
PrintAndLogEx(WARNING, "Device not compiled to support spiffs");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue