make style
This commit is contained in:
1 parent
9648c078c1
commit
c00e4801b7
48 files changed
+1479
-1490
No files matched your search
@@ -467,7 +467,7 @@ static int CmdFlashMemSpiFFSWipe(const char *Cmd) {
|
||||
CLIParserInit(&ctx, "mem spiffs wipe",
|
||||
_RED_("* * * Warning * * *") " \n"
|
||||
_CYAN_("This command wipes all files on the device SPIFFS file system"),
|
||||
"mem spiffs wipe");
|
||||
"mem spiffs wipe");
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
||||
@@ -2989,7 +2989,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
int16_t fsci = card.ats[1] & 0x0f;
|
||||
|
||||
PrintAndLogEx(INFO, " ..." _YELLOW_("%02X") "............ T0 TA1 is%s present, TB1 is%s present, "
|
||||
"TC1 is%s present, FSCI is %d (FSC = %d)",
|
||||
"TC1 is%s present, FSCI is %d (FSC = %d)",
|
||||
card.ats[1],
|
||||
(ta1 ? "" : _RED_(" NOT")),
|
||||
(tb1 ? "" : _RED_(" NOT")),
|
||||
@@ -3011,7 +3011,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
if (strlen(ds) != 0) ds[strlen(ds) - 2] = '\0';
|
||||
if (strlen(dr) != 0) dr[strlen(dr) - 2] = '\0';
|
||||
PrintAndLogEx(INFO, " ......" _YELLOW_("%02X") "......... TA1 different divisors are%s supported, "
|
||||
"DR: [%s], DS: [%s]",
|
||||
"DR: [%s], DS: [%s]",
|
||||
card.ats[pos],
|
||||
((card.ats[pos] & 0x80) ? _RED_(" NOT") : ""),
|
||||
dr,
|
||||
|
||||
@@ -86,7 +86,7 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
|
||||
PrintAndLogEx(WARNING, "Failed to allocate memory");
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
|
||||
|
||||
// print nonce
|
||||
PrintAndLogEx(SUCCESS, "Length: %zu, Nonce: %s", nonce_length, sprint_hex_inrow(resp.data.asBytes, nonce_length));
|
||||
free(nonce);
|
||||
|
||||
+19
-19
@@ -64,10 +64,10 @@ static void print_status_flag1_interpretation(void) {
|
||||
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
|
||||
PrintAndLogEx(INFO, " 00 | Indicates the successful completion of a command.");
|
||||
PrintAndLogEx(INFO, " FF | If an error occurs during the processing of a command that includes no list in the command packet, \n"
|
||||
" | or if an error occurs independently of any list, the card returns a response by setting FFh to Status Flag1.");
|
||||
" | or if an error occurs independently of any list, the card returns a response by setting FFh to Status Flag1.");
|
||||
PrintAndLogEx(INFO, " XX | If an error occurs while processing a command that includes Service Code List or Block List \n"
|
||||
" | in the command packet, the card returns a response by setting a number in the list to Status Flag1,\n"
|
||||
" | indicating the location of the error.");
|
||||
" | in the command packet, the card returns a response by setting a number in the list to Status Flag1,\n"
|
||||
" | indicating the location of the error.");
|
||||
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@@ -76,28 +76,28 @@ static void print_status_flag2_interpration(void) {
|
||||
PrintAndLogEx(INFO, "----+--------------------------------------------------------------------------------------------------------------------");
|
||||
PrintAndLogEx(INFO, " 00 | Indicates the successful completion of a command.");
|
||||
PrintAndLogEx(INFO, " 01 | The calculated result is either less than zero when the purse data is decremented, or exceeds 4\n"
|
||||
" | Bytes when the purse data is incremented.");
|
||||
" | Bytes when the purse data is incremented.");
|
||||
PrintAndLogEx(INFO, " 02 | The specified data exceeds the value of cashback data at cashback of purse.");
|
||||
PrintAndLogEx(INFO, " 70 | Memory error (fatal error).");
|
||||
PrintAndLogEx(INFO, " 71 | The number of memory rewrites exceeds the upper limit (this is only a warning; data writing is performed as normal).\n"
|
||||
" | The maximum number of rewrites can differ, depending on the product being used.\n"
|
||||
" | In addition, Status Flag1 is either 00h or FFh depending on the product being used.");
|
||||
" | The maximum number of rewrites can differ, depending on the product being used.\n"
|
||||
" | In addition, Status Flag1 is either 00h or FFh depending on the product being used.");
|
||||
|
||||
PrintAndLogEx(INFO, " A1 | Illegal Number of Service| Number of Service or Number of Node specified by the command \n"
|
||||
" | falls outside the range of the prescribed value.");
|
||||
" | falls outside the range of the prescribed value.");
|
||||
PrintAndLogEx(INFO, " A2 | Illegal command packet (specified Number of Block) : Number of Block specified by the \n"
|
||||
" | command falls outside the range of the prescribed values for the product.");
|
||||
" | command falls outside the range of the prescribed values for the product.");
|
||||
PrintAndLogEx(INFO, " A3 | Illegal Block List (specified order of Service) : Service Code List Order specified by \n"
|
||||
" | Block List Element falls outside the Number of Service specified by the command \n"
|
||||
" | (or the Number of Service specified at the times of mutual authentication).");
|
||||
" | Block List Element falls outside the Number of Service specified by the command \n"
|
||||
" | (or the Number of Service specified at the times of mutual authentication).");
|
||||
PrintAndLogEx(INFO, " A4 | Illegal Service type : Area Attribute specified by the command or Service Attribute of Service Code is incorrect.");
|
||||
PrintAndLogEx(INFO, " A5 | Access is not allowed : Area or Service specified by the command cannot be accessed.\n"
|
||||
" | The parameter specified by the command does not satisfy the conditions for success.");
|
||||
" | The parameter specified by the command does not satisfy the conditions for success.");
|
||||
PrintAndLogEx(INFO, " A6 | Illegal Service Code List : Target to be accessed, identified by Service Code List Order, specified by Block\n"
|
||||
" | List Element does not exist. Or, Node specified by Node Code List does not exist.");
|
||||
" | List Element does not exist. Or, Node specified by Node Code List does not exist.");
|
||||
PrintAndLogEx(INFO, " A7 | Illegal Block List (Access Mode) : Access Mode specified by Block List Element is incorrect.");
|
||||
PrintAndLogEx(INFO, " A8 | Illegal Block Number Block Number (access to the specified data is inhibited) :\n"
|
||||
" | specified by Block List Element exceeds the number of Blocks assigned to Service.");
|
||||
" | specified by Block List Element exceeds the number of Blocks assigned to Service.");
|
||||
PrintAndLogEx(INFO, " A9 | Data write failure : This is the error that occurs in issuance commands.");
|
||||
PrintAndLogEx(INFO, " AA | Key-change failure : Key change failed.");
|
||||
PrintAndLogEx(INFO, " AB | Illegal Package Parity or illegal Package MAC : This is the error that occurs in issuance commands.");
|
||||
@@ -105,7 +105,7 @@ static void print_status_flag2_interpration(void) {
|
||||
PrintAndLogEx(INFO, " AD | Service exists already : This is the error that occurs in issuance commands.");
|
||||
PrintAndLogEx(INFO, " AE | Illegal System Code : This is the error that occurs in issuance commands.");
|
||||
PrintAndLogEx(INFO, " AF | Too many simultaneous cyclic write operations : Number of simultaneous write Blocks\n"
|
||||
" | specified by the command to Cyclic Service exceeds the number of Blocks assigned to Service.");
|
||||
" | specified by the command to Cyclic Service exceeds the number of Blocks assigned to Service.");
|
||||
PrintAndLogEx(INFO, " C0 | Illegal Package Identifier : This is the error that occurs in issuance commands.");
|
||||
PrintAndLogEx(INFO, " C1 | Discrepancy of parameters inside and outside Package : This is the error that occurs in issuance commands.");
|
||||
PrintAndLogEx(INFO, " C2 | Command is disabled already : This is the error that occurs in issuance commands.");
|
||||
@@ -129,16 +129,16 @@ static void print_number_of_service_constraints(void) {
|
||||
|
||||
static void print_number_of_block_constraints(void) {
|
||||
PrintAndLogEx(INFO, " - Number of Block: shall be less than or equal to the maximum number of Blocks that can be read simultaneously.\n"
|
||||
" The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used.\n"
|
||||
" Use as default 01");
|
||||
" The maximum number of Blocks that can be read simultaneously can differ, depending on the product being used.\n"
|
||||
" Use as default 01");
|
||||
}
|
||||
|
||||
static void print_service_code_list_constraints(void) {
|
||||
PrintAndLogEx(INFO, " - Service Code List: For Service Code List, only Service Code existing in the product shall be specified:");
|
||||
PrintAndLogEx(INFO, " - Even when Service Code exists in the product, Service Code not referenced from Block List shall not \n"
|
||||
" be specified to Service Code List.");
|
||||
" be specified to Service Code List.");
|
||||
PrintAndLogEx(INFO, " - For existence or nonexistence of Service in a product, please check using the Request Service \n"
|
||||
" (or Request Service v2) command.");
|
||||
" (or Request Service v2) command.");
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -565,7 +565,7 @@ int send_rd_plain(uint8_t flags, uint16_t datalen, uint8_t *data, bool verbose,
|
||||
return PM3_ERFTRANS;
|
||||
} else {
|
||||
memcpy(rd_noCry_resp, (felica_read_without_encryption_response_t *)resp.data.asBytes, sizeof(felica_read_without_encryption_response_t));
|
||||
if (rd_noCry_resp->frame_response.cmd_code[0] != 0x07) {
|
||||
if (rd_noCry_resp->frame_response.cmd_code[0] != 0x07) {
|
||||
PrintAndLogEx(FAILED, "Bad response cmd 0x%02X @ 0x%04X.",
|
||||
rd_noCry_resp->frame_response.cmd_code[0], 0x00);
|
||||
PrintAndLogEx(INFO, "This is either a normal signal issue, or an issue caused by wrong parameter. Please try again.");
|
||||
|
||||
@@ -373,7 +373,7 @@ static int hfgal_create_creds_app(DesfireContext_t *ctx, uint8_t *site_key, uint
|
||||
// UID is required for key diversification
|
||||
if (ctx->uidlen == 0) {
|
||||
PM3_RET_ERR(PM3_EINVARG, "UID is required for key diversification. "
|
||||
"Please fetch it before calling `hfgal_create_creds_app`");
|
||||
"Please fetch it before calling `hfgal_create_creds_app`");
|
||||
}
|
||||
|
||||
// Create application
|
||||
@@ -862,11 +862,11 @@ static int hfgal_read_card(uint32_t aid, uint8_t *site_key, bool verbose, bool q
|
||||
PM3_RET_IF_ERR_MAYBE_MSG(res, !quiet, "Failed reading card application credentials");
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Gallagher (AID %06X) - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
|
||||
", facility: " _GREEN_("%u")
|
||||
", card number: " _GREEN_("%u")
|
||||
", issue level: " _GREEN_("%u"),
|
||||
", facility: " _GREEN_("%u")
|
||||
", card number: " _GREEN_("%u")
|
||||
", issue level: " _GREEN_("%u"),
|
||||
current_aid,
|
||||
'A' + creds.region_code,
|
||||
'A' + creds.region_code,
|
||||
creds.region_code,
|
||||
creds.facility_code,
|
||||
creds.card_number,
|
||||
@@ -1299,10 +1299,10 @@ static int CmdGallagherDecode(const char *cmd) {
|
||||
gallagher_decode_creds(data_buf, &creds);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Gallagher - region: " _GREEN_("%c") " ( " _GREEN_("%u") " )"
|
||||
", facility: " _GREEN_("%u")
|
||||
", card number: " _GREEN_("%u")
|
||||
", issue level: " _GREEN_("%u"),
|
||||
'A' + creds.region_code,
|
||||
", facility: " _GREEN_("%u")
|
||||
", card number: " _GREEN_("%u")
|
||||
", issue level: " _GREEN_("%u"),
|
||||
'A' + creds.region_code,
|
||||
creds.region_code,
|
||||
creds.facility_code,
|
||||
creds.card_number,
|
||||
|
||||
+14
-14
@@ -1513,26 +1513,26 @@ static void iclass_decode_credentials(uint8_t *data) {
|
||||
char *pbin = binstr;
|
||||
// Strip leading zeros
|
||||
while (strlen(pbin) && *(++pbin) == '0');
|
||||
|
||||
|
||||
size_t binlen = strlen(pbin);
|
||||
|
||||
|
||||
// Check if we have a sentinel bit (leading '1' that makes length one more than common formats)
|
||||
// Common formats: 26, 30, 33, 34, 35, 36, 37, 46, 48
|
||||
// If we have 27, 31, 34, 35, 36, 37, 38, 47, 49 bits and it starts with '1',
|
||||
// it's likely a sentinel bit that should be stripped
|
||||
if (binlen > 0 && pbin[0] == '1' &&
|
||||
(binlen == 27 || binlen == 31 || binlen == 34 || binlen == 35 ||
|
||||
binlen == 36 || binlen == 37 || binlen == 38 || binlen == 47 || binlen == 49)) {
|
||||
if (binlen > 0 && pbin[0] == '1' &&
|
||||
(binlen == 27 || binlen == 31 || binlen == 34 || binlen == 35 ||
|
||||
binlen == 36 || binlen == 37 || binlen == 38 || binlen == 47 || binlen == 49)) {
|
||||
// Strip the sentinel bit by recreating u96 from binary string without leading '1'
|
||||
char *corrected_bin = pbin + 1; // Skip the leading '1'
|
||||
size_t corrected_len = strlen(corrected_bin);
|
||||
|
||||
|
||||
// Recreate u96 values from corrected binary string
|
||||
top = 0;
|
||||
mid = 0;
|
||||
bot = 0;
|
||||
binstring_to_u96(&top, &mid, &bot, corrected_bin);
|
||||
|
||||
|
||||
pbin = corrected_bin;
|
||||
binlen = corrected_len;
|
||||
}
|
||||
@@ -2954,26 +2954,26 @@ static int CmdHFiClass_ReadBlock(const char *Cmd) {
|
||||
char *pbin = binstr;
|
||||
// Strip leading zeros
|
||||
while (strlen(pbin) && *(++pbin) == '0');
|
||||
|
||||
|
||||
size_t binlen = strlen(pbin);
|
||||
|
||||
|
||||
// Check if we have a sentinel bit (leading '1' that makes length one more than common formats)
|
||||
// Common formats: 26, 30, 33, 34, 35, 36, 37, 46, 48
|
||||
// If we have 27, 31, 34, 35, 36, 37, 38, 47, 49 bits and it starts with '1',
|
||||
// it's likely a sentinel bit that should be stripped
|
||||
if (binlen > 0 && pbin[0] == '1' &&
|
||||
(binlen == 27 || binlen == 31 || binlen == 34 || binlen == 35 ||
|
||||
binlen == 36 || binlen == 37 || binlen == 38 || binlen == 47 || binlen == 49)) {
|
||||
if (binlen > 0 && pbin[0] == '1' &&
|
||||
(binlen == 27 || binlen == 31 || binlen == 34 || binlen == 35 ||
|
||||
binlen == 36 || binlen == 37 || binlen == 38 || binlen == 47 || binlen == 49)) {
|
||||
// Strip the sentinel bit by recreating u96 from binary string without leading '1'
|
||||
char *corrected_bin = pbin + 1; // Skip the leading '1'
|
||||
size_t corrected_len = strlen(corrected_bin);
|
||||
|
||||
|
||||
// Recreate u96 values from corrected binary string
|
||||
top = 0;
|
||||
mid = 0;
|
||||
bot = 0;
|
||||
binstring_to_u96(&top, &mid, &bot, corrected_bin);
|
||||
|
||||
|
||||
pbin = corrected_bin;
|
||||
binlen = corrected_len;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff
|
||||
// for printing the complete segment we need at least wrc + wrp_len + remain_seg_payload_len bytes
|
||||
if ((i + wrc + wrp_len + remain_seg_payload_len) > card_size) {
|
||||
PrintAndLogEx(FAILED, "Cannot read segment body, because the input buffer is too small. "
|
||||
"Please check that the data is correct and properly aligned. ");
|
||||
"Please check that the data is correct and properly aligned. ");
|
||||
return_value = PM3_EOUTOFBOUND;
|
||||
goto out;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ static int decode_and_print_memory(uint16_t card_size, const uint8_t *input_buff
|
||||
// for printing the complete segment we need at least wrc + wrp_len + remain_seg_payload_len bytes
|
||||
if ((i + wrc + wrp_len + remain_seg_payload_len) > card_size) {
|
||||
PrintAndLogEx(FAILED, "Cannot read segment body, because the input buffer is too small. "
|
||||
"Please check that the data is correct and properly aligned. ");
|
||||
"Please check that the data is correct and properly aligned. ");
|
||||
return_value = PM3_EOUTOFBOUND;
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2507,7 +2507,7 @@ static int CmdHF14AMfNestedStatic(const char *Cmd) {
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
||||
if (e_sector[sectorNo].foundKey[trgKeyType]) continue;
|
||||
|
||||
|
||||
int16_t isOK = mf_static_nested(blockNo, keyType, key, mfFirstBlockOfSector(sectorNo), trgKeyType, keyBlock, forceDetectDist);
|
||||
switch (isOK) {
|
||||
case PM3_ETIMEOUT :
|
||||
@@ -5030,7 +5030,7 @@ void printKeyTableEx(size_t sectorscnt, sector_t *e_sector, uint8_t start_sector
|
||||
_YELLOW_("H") ":Hardnested / "
|
||||
_YELLOW_("C") ":statiCnested / "
|
||||
_YELLOW_("A") ":keyA "
|
||||
" )"
|
||||
" )"
|
||||
);
|
||||
if (sectorscnt == 18) {
|
||||
PrintAndLogEx(INFO, "( " _MAGENTA_("*") " ) These sectors used for signature. Lays outside of user memory");
|
||||
|
||||
@@ -2027,7 +2027,7 @@ static int mfulc_fingerprint(void) {
|
||||
if ((status > 0) && (data[2] == 0x09)) {
|
||||
cmd[1] = 3;
|
||||
status = ul_send_cmd_raw(cmd, sizeof(cmd), data, 4, false);
|
||||
if ((status > 0) && (data[0] == 0xE1) && (data[1] == 0x10) && (data[2] == 0x12) && (data[3] == 0x00) ) {
|
||||
if ((status > 0) && (data[0] == 0xE1) && (data[1] == 0x10) && (data[2] == 0x12) && (data[3] == 0x00)) {
|
||||
PrintAndLogEx(INFO, "MIFARE Hospitality (MF0ICU2(H))");
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
@@ -5054,7 +5054,7 @@ static int CmdHF14AMfUCSetUid(const char *Cmd) {
|
||||
}
|
||||
|
||||
// block 1.
|
||||
memcpy(packetw.data, uid+3, 4);
|
||||
memcpy(packetw.data, uid + 3, 4);
|
||||
packetw.block_no = 1;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFAREU_WRITEBL, (uint8_t *)&packetw, sizeof(packetw));
|
||||
@@ -5065,7 +5065,7 @@ static int CmdHF14AMfUCSetUid(const char *Cmd) {
|
||||
|
||||
// block 2.
|
||||
packetw.data[0] = uid[3] ^ uid[4] ^ uid[5] ^ uid[6];
|
||||
memcpy(packetw.data+1, oldblock2+1, 3);
|
||||
memcpy(packetw.data + 1, oldblock2 + 1, 3);
|
||||
packetw.block_no = 2;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFAREU_WRITEBL, (uint8_t *)&packetw, sizeof(packetw));
|
||||
@@ -5469,7 +5469,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
if (use_data) {
|
||||
SendCommandNG(CMD_HF_MIFAREU_WRITEBL, (uint8_t *)&packetw, sizeof(packetw));
|
||||
if ((WaitForResponseTimeout(CMD_HF_MIFAREU_WRITEBL, &resp, 1500) == false) ||
|
||||
(resp.status != PM3_SUCCESS)) {
|
||||
(resp.status != PM3_SUCCESS)) {
|
||||
PrintAndLogEx(FAILED, "Failed to write block BEFORE");
|
||||
error_retries++;
|
||||
continue; // try again
|
||||
@@ -5478,8 +5478,8 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
|
||||
packetr.block_no = blockno;
|
||||
SendCommandNG(CMD_HF_MIFAREU_READBL, (uint8_t *)&packetr, sizeof(packetr));
|
||||
if ((WaitForResponseTimeout(CMD_HF_MIFAREU_READBL, &resp, 1500) == false ) ||
|
||||
(resp.status != PM3_SUCCESS)) {
|
||||
if ((WaitForResponseTimeout(CMD_HF_MIFAREU_READBL, &resp, 1500) == false) ||
|
||||
(resp.status != PM3_SUCCESS)) {
|
||||
PrintAndLogEx(FAILED, "Failed to read block BEFORE");
|
||||
error_retries++;
|
||||
continue; // try again
|
||||
@@ -5504,8 +5504,8 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFAREU_READBL, (uint8_t *)&packetr, sizeof(packetr));
|
||||
if ((WaitForResponseTimeout(CMD_HF_MIFAREU_READBL, &resp, 1500) == false ) ||
|
||||
(resp.status != PM3_SUCCESS)) {
|
||||
if ((WaitForResponseTimeout(CMD_HF_MIFAREU_READBL, &resp, 1500) == false) ||
|
||||
(resp.status != PM3_SUCCESS)) {
|
||||
PrintAndLogEx(FAILED, "Failed to read block BEFORE");
|
||||
error_retries++;
|
||||
continue; // try again
|
||||
|
||||
@@ -723,8 +723,8 @@ static int ntag424_authenticate_ev2_first(uint8_t keyno, uint8_t *key, ntag424_s
|
||||
if (memcmp(response.rnd_a, &rnd_a_clear[1], 15) != 0 ||
|
||||
response.rnd_a[15] != rnd_a_clear[0]) {
|
||||
PrintAndLogEx(ERR, "Incorrect response from card\n"
|
||||
"expected: %s\n"
|
||||
"got: %s"
|
||||
"expected: %s\n"
|
||||
"got: %s"
|
||||
, sprint_hex(rnd_a_clear, 16),
|
||||
sprint_hex(response.rnd_a, 16));
|
||||
return PM3_ESOFT;
|
||||
|
||||
+549
-546
File diff suppressed because it is too large.
Load diff
+14
-14
@@ -159,7 +159,7 @@ static int decrypt_cryptogram(uint8_t *key, uint8_t *input, uint8_t *out, int in
|
||||
|
||||
static void increment_command_wrapper(uint8_t *input, int input_len) {
|
||||
// Increment the end of the header by 1
|
||||
uint8_t* offset = &input[input_len - sizeof(uint32_t)];
|
||||
uint8_t *offset = &input[input_len - sizeof(uint32_t)];
|
||||
uint32_t value = MemBeToUint4byte(offset);
|
||||
value++;
|
||||
Uint4byteToMemBe(offset, value);
|
||||
@@ -192,12 +192,12 @@ static void generate_command_wrapping(uint8_t *command_Header, int command_heade
|
||||
|
||||
// Command Header is for the APDU Command to be sent
|
||||
int padded_Command_Header_len = command_header_len;
|
||||
uint8_t padded_Command_Header[padded_Command_Header_len+block_size];
|
||||
uint8_t padded_Command_Header[padded_Command_Header_len + block_size];
|
||||
padToBlockSize(command_Header, &padded_Command_Header_len, block_size, padded_Command_Header);
|
||||
|
||||
// Unencrypted Command is our actual command data
|
||||
int padded_unencrypted_Command_len = unencrypted_command_len;
|
||||
uint8_t padded_unencrypted_Command[padded_unencrypted_Command_len+block_size];
|
||||
uint8_t padded_unencrypted_Command[padded_unencrypted_Command_len + block_size];
|
||||
padToBlockSize(unencrypted_Command, &padded_unencrypted_Command_len, block_size, padded_unencrypted_Command);
|
||||
|
||||
uint8_t padded_encrypted_Command[padded_unencrypted_Command_len];
|
||||
@@ -216,7 +216,7 @@ static void generate_command_wrapping(uint8_t *command_Header, int command_heade
|
||||
memcpy(toEncrypt + ARRAYLEN(rndCounter) + padded_Command_Header_len + ARRAYLEN(asn1_tag_cryptograph) + ARRAYLEN(padded_encrypted_Command), command_trailer, ARRAYLEN(command_trailer));
|
||||
|
||||
int padded_toEncrypt_len = ARRAYLEN(toEncrypt);
|
||||
uint8_t padded_toEncrypt[padded_toEncrypt_len+block_size];
|
||||
uint8_t padded_toEncrypt[padded_toEncrypt_len + block_size];
|
||||
padToBlockSize(toEncrypt, &padded_toEncrypt_len, block_size, padded_toEncrypt);
|
||||
|
||||
// Breakdown
|
||||
@@ -286,10 +286,10 @@ static int seos_get_data(uint8_t *rndICC, uint8_t *rndIFD, uint8_t *diversified_
|
||||
// uint8_t unencrypted_command[4] = {0x5c,0x02,0xff,0x00};
|
||||
// Modification of the tags 2nd place from 00 can return other data
|
||||
|
||||
uint8_t unencrypted_command[data_tag_len+2];
|
||||
uint8_t unencrypted_command[data_tag_len + 2];
|
||||
unencrypted_command[0] = 0x5c;
|
||||
unencrypted_command[1] = data_tag_len;
|
||||
memcpy(unencrypted_command+2, data_tag, data_tag_len);
|
||||
memcpy(unencrypted_command + 2, data_tag, data_tag_len);
|
||||
|
||||
int unencrypted_command_len = ARRAYLEN(unencrypted_command);
|
||||
|
||||
@@ -402,11 +402,11 @@ static int seos_write_data(uint8_t *rndICC, uint8_t *rndIFD, uint8_t *diversifie
|
||||
// ff 00 [04] 12 34 56 78
|
||||
// ff 00 = BER-TLV tag of the data object to be written
|
||||
|
||||
uint8_t unencrypted_command[write_data_tag_len+1+sio_size];
|
||||
uint8_t unencrypted_command[write_data_tag_len + 1 + sio_size];
|
||||
memcpy(unencrypted_command, write_data_tag, write_data_tag_len);
|
||||
|
||||
unencrypted_command[write_data_tag_len] = sio_size;
|
||||
memcpy(unencrypted_command+write_data_tag_len+1, sio, sio_size);
|
||||
memcpy(unencrypted_command + write_data_tag_len + 1, sio, sio_size);
|
||||
|
||||
int unencrypted_command_len = ARRAYLEN(unencrypted_command);
|
||||
|
||||
@@ -650,12 +650,12 @@ static int select_DF_verify(uint8_t *response, uint8_t response_length, uint8_t
|
||||
for (int i = 0; i < response_length - 2;) {
|
||||
// extract MAC
|
||||
if (response[i] == 0x8E) {
|
||||
if (response[i+1] != MAC_value_len) {
|
||||
if (response[i + 1] != MAC_value_len) {
|
||||
goto out;
|
||||
}
|
||||
// Ensure there's enough bytes remaining
|
||||
// in the response for the full MAC
|
||||
if (i+2+MAC_value_len > response_length) {
|
||||
if (i + 2 + MAC_value_len > response_length) {
|
||||
goto out;
|
||||
}
|
||||
input_len = i;
|
||||
@@ -665,7 +665,7 @@ static int select_DF_verify(uint8_t *response, uint8_t response_length, uint8_t
|
||||
break;
|
||||
}
|
||||
// skip to next tag
|
||||
i += 2 + response[i+1];
|
||||
i += 2 + response[i + 1];
|
||||
}
|
||||
if (res != PM3_SUCCESS) {
|
||||
goto out;
|
||||
@@ -821,7 +821,7 @@ static int select_ADF_decrypt(const char *selectADFOID, uint8_t *CRYPTOGRAM_encr
|
||||
uint8_t MAC_key[24] = {0x00};
|
||||
memcpy(MAC_key, keys[key_index].privMacKey, 16);
|
||||
create_cmac(MAC_key, CRYPTOGRAM_encrypted_data_raw, mac, iv_size, sizeof(mac), encryption_algorithm);
|
||||
if (memcmp(CRYPTOGRAM_encrypted_data_raw+iv_size, mac, iv_size) != 0) {
|
||||
if (memcmp(CRYPTOGRAM_encrypted_data_raw + iv_size, mac, iv_size) != 0) {
|
||||
PrintAndLogEx(ERR, "Synthesized IV Verification Failed");
|
||||
PrintAndLogEx(ERR, _YELLOW_("Likely wrong Priv Mac Key"));
|
||||
return PM3_ESOFT;
|
||||
@@ -1234,7 +1234,7 @@ static int seos_pacs_adf_select(char *oid, int oid_len, uint8_t *data_tag, int d
|
||||
return res;
|
||||
}
|
||||
create_mutual_auth_key(KeyIFD, KeyICC, RNDICC, RNDIFD, Diversified_New_EncryptionKey, Diversified_New_MACKey, ALGORITHM_INFO_value1, ALGORITHM_INFO_value2);
|
||||
|
||||
|
||||
if (write == NULL) {
|
||||
uint8_t sio_buffer_out[PM3_CMD_DATA_SIZE];
|
||||
int sio_size = 0;
|
||||
@@ -1819,7 +1819,7 @@ static int CmdHfSeosSim(const char *Cmd) {
|
||||
return PM3_EOPABORTED;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -948,9 +948,9 @@ static int CmdT55xxReadBlock(const char *Cmd) {
|
||||
_CYAN_("Use of read with password on a tag not configured") "\n"
|
||||
_CYAN_("for a password can damage the tag") "\n"
|
||||
_RED_(" * * * * * * * * * *"),
|
||||
"lf t55xx read -b 0 --> read data from block 0\n"
|
||||
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
|
||||
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
|
||||
"lf t55xx read -b 0 --> read data from block 0\n"
|
||||
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
|
||||
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
|
||||
);
|
||||
|
||||
// 1 (help) + 4(four user specified params) + (5 T55XX_DLMODE_SINGLE)
|
||||
|
||||
@@ -1469,7 +1469,7 @@ int CmdTraceList(const char *Cmd) {
|
||||
|
||||
if (protocol == LEGIC)
|
||||
PrintAndLogEx(INFO, _YELLOW_("LEGIC") " - Reader Mode: Timings are in ticks (1us == 1.5ticks)\n"
|
||||
" Tag Mode: Timings are in sub carrier periods (1/212 kHz == 4.7us)");
|
||||
" Tag Mode: Timings are in sub carrier periods (1/212 kHz == 4.7us)");
|
||||
|
||||
if (protocol == ISO_14443B || protocol == PROTO_CRYPTORF) {
|
||||
if (use_us)
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ static int build_segs_from_phdrs(flash_file_t *ctx, uint32_t flash_size) {
|
||||
offset);
|
||||
if (filesz != memsz) {
|
||||
PrintAndLogEx(ERR, "Error: PHDR file size does not equal memory size\n"
|
||||
"(DATA+BSS PHDRs do not make sense on ROM platforms!)");
|
||||
"(DATA+BSS PHDRs do not make sense on ROM platforms!)");
|
||||
return PM3_EFILE;
|
||||
}
|
||||
if (paddr < last_end) {
|
||||
|
||||
@@ -2756,9 +2756,9 @@ static int _wrap_new_pm3(lua_State *L) {
|
||||
}
|
||||
|
||||
SWIG_Lua_pusherrstring(L, "Wrong arguments for overloaded function 'new_pm3'\n"
|
||||
" Possible C/C++ prototypes are:\n"
|
||||
" pm3::pm3()\n"
|
||||
" pm3::pm3(char *)\n");
|
||||
" Possible C/C++ prototypes are:\n"
|
||||
" pm3::pm3()\n"
|
||||
" pm3::pm3(char *)\n");
|
||||
lua_error(L);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -841,7 +841,7 @@ static int dumpmem_pm3(char *serial_port_name, const char *filename, uint32_t ad
|
||||
PrintAndLogEx(INFO, "Device is running the bootloader.");
|
||||
} else {
|
||||
PrintAndLogEx(ERR, "Device is running the bootloader, but the bootloader"
|
||||
" doesn't understand the READ MEM command.");
|
||||
" doesn't understand the READ MEM command.");
|
||||
goto finish2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user