make style

This commit is contained in:
iceman1001 committed 2022-10-16 17:56:12 +02:00
1 parent 2d25716704
commit 71f96ba1e7
12 files changed
+1184 -841

No files matched your search

+1 -1
View File
@@ -2770,7 +2770,7 @@ static int try_detect_modulation(void) {
#define LF_NUM_OF_TESTS 6
lf_modulation_t tests[LF_NUM_OF_TESTS];
for (int i=0; i< ARRAYLEN(tests); i++) {
for (int i = 0; i < ARRAYLEN(tests); i++) {
memset(&tests[i], 0, sizeof(lf_modulation_t));
}
+12 -11
View File
@@ -789,8 +789,8 @@ static void print_ct_blocks(uint8_t *data, size_t len) {
static void print_sr_blocks(uint8_t *data, size_t len, const uint8_t *uid) {
size_t blocks = (len / ST25TB_SR_BLOCK_SIZE) -1 ;
uint8_t * systemblock = data + blocks * ST25TB_SR_BLOCK_SIZE ;
size_t blocks = (len / ST25TB_SR_BLOCK_SIZE) - 1 ;
uint8_t *systemblock = data + blocks * ST25TB_SR_BLOCK_SIZE ;
uint8_t chipid = get_st_chipid(uid);
PrintAndLogEx(SUCCESS, _GREEN_("%s") " tag", get_st_chip_model(chipid));
@@ -1486,7 +1486,7 @@ static int CmdHF14BDump(const char *Cmd) {
// last read
if (blocknum == 0xFF) {
// we reserved space for this block after 0x0F and 0x7F, ie 0x10, 0x80
memcpy(data + ((lastblock+1) * ST25TB_SR_BLOCK_SIZE), recv, ST25TB_SR_BLOCK_SIZE);
memcpy(data + ((lastblock + 1) * ST25TB_SR_BLOCK_SIZE), recv, ST25TB_SR_BLOCK_SIZE);
break;
}
memcpy(data + (blocknum * ST25TB_SR_BLOCK_SIZE), recv, ST25TB_SR_BLOCK_SIZE);
@@ -2105,25 +2105,26 @@ out:
/* extract uid from filename
* filename must match '^hf-14b-[0-9A-F]{16}'
*/
uint8_t * get_uid_from_filename(const char *filename) {
*/
uint8_t *get_uid_from_filename(const char *filename) {
static uint8_t uid[8] ;
memset(uid, 0, 8) ;
char uidinhex[17] ;
if (strlen(filename)<23 || strncmp(filename, "hf-14b-", 7)) {
if (strlen(filename) < 23 || strncmp(filename, "hf-14b-", 7)) {
PrintAndLogEx(ERR, "can't get uid from filename '%s'. Expected format is hf-14b-<uid>...", filename);
return uid ;
}
// extract uid part from filename
strncpy(uidinhex, filename+7, 16) ; uidinhex[16]='\0' ;
int len=hex_to_bytes(uidinhex, uid, 8);
// extract uid part from filename
strncpy(uidinhex, filename + 7, 16) ;
uidinhex[16] = '\0' ;
int len = hex_to_bytes(uidinhex, uid, 8);
if (len == 8)
return SwapEndian64(uid , 8, 8);
return SwapEndian64(uid, 8, 8);
else {
PrintAndLogEx(ERR, "get_uid_from_filename failed: hex_to_bytes returned %d", len);
memset(uid, 0, 8);
}
return uid ;
return uid ;
}
static int CmdHF14BView(const char *Cmd) {
+1 -1
View File
@@ -25,7 +25,7 @@
int CmdHF14B(const char *Cmd);
int CmdHF14BNdefRead(const char *Cmd);
uint8_t * get_uid_from_filename(const char *filename);
uint8_t *get_uid_from_filename(const char *filename);
int exchange_14b_apdu(uint8_t *datain, int datainlen, bool activate_field, bool leave_signal_on, uint8_t *dataout, int maxdataoutlen, int *dataoutlen, int user_timeout);
int select_card_14443b_4(bool disconnect, iso14b_card_select_t *card);
+2 -2
View File
@@ -1147,7 +1147,7 @@ static int CmdHF15ESave(const char *Cmd) {
static void print_hrule(int blocksize) {
char dashes[] = "------------------------------------------------------------";
PrintAndLogEx(INFO, "-----+%.*s-+-%.*s-", 3*blocksize, dashes, blocksize, dashes);
PrintAndLogEx(INFO, "-----+%.*s-+-%.*s-", 3 * blocksize, dashes, blocksize, dashes);
}
static void print_blocks_15693(uint8_t *data, uint16_t bytes, int blocksize) {
@@ -1155,7 +1155,7 @@ static void print_blocks_15693(uint8_t *data, uint16_t bytes, int blocksize) {
PrintAndLogEx(NORMAL, "");
print_hrule(blocksize);
char spaces[] = " ";
PrintAndLogEx(INFO, " blk | data %.*s| ascii", MAX(0, 3*blocksize - 5), spaces);
PrintAndLogEx(INFO, " blk | data %.*s| ascii", MAX(0, 3 * blocksize - 5), spaces);
print_hrule(blocksize);
for (int i = 0; i < blocks; i++) {
PrintAndLogEx(INFO, "%4d | %s ", i, sprint_hex_ascii(data + (i * blocksize), blocksize));
+11 -11
View File
@@ -5706,7 +5706,7 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
"hf mf ndefformat --2k --> MIFARE 2k\n"
"hf mf ndefformat --4k --> MIFARE 4k\n"
"hf mf ndefformat --keys hf-mf-066C8B78-key.bin --> MIFARE 1k with keys from specified file\n"
);
);
void *argtable[] = {
arg_param_begin,
@@ -5774,9 +5774,9 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
// init keys to default key
uint8_t keyA[MIFARE_4K_MAXSECTOR][MFKEY_SIZE];
uint8_t keyB[MIFARE_4K_MAXSECTOR][MFKEY_SIZE];
for (uint8_t i = 0; i < MIFARE_4K_MAXSECTOR; i++ ) {
uint8_t keyB[MIFARE_4K_MAXSECTOR][MFKEY_SIZE];
for (uint8_t i = 0; i < MIFARE_4K_MAXSECTOR; i++) {
memcpy(keyA[i], g_mifare_default_key, sizeof(g_mifare_default_key));
memcpy(keyB[i], g_mifare_default_key, sizeof(g_mifare_default_key));
}
@@ -5785,15 +5785,15 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
uint64_t key64 = 0;
// check if we can authenticate to sector
if (mfCheckKeys(0, MF_KEY_A, true, 1, (uint8_t*)g_mifare_mad_key, &key64) == PM3_SUCCESS) {
if (mfCheckKeys(0, MF_KEY_A, true, 1, (uint8_t *)g_mifare_mad_key, &key64) == PM3_SUCCESS) {
// if used, assume KEY A is MAD/NDEF set.
memcpy(keyA[0], g_mifare_mad_key, sizeof(g_mifare_mad_key));
memcpy(keyB[0], g_mifare_mad_key_b, sizeof(g_mifare_mad_key_b));
for (uint8_t i = 1; i < MIFARE_4K_MAXSECTOR; i++ ) {
memcpy(keyA[i], g_mifare_ndef_key, sizeof(g_mifare_ndef_key));
for (uint8_t i = 1; i < MIFARE_4K_MAXSECTOR; i++) {
memcpy(keyA[i], g_mifare_ndef_key, sizeof(g_mifare_ndef_key));
}
}
}
// Do we have a keyfile based from UID?
if (strlen(keyFilename) == 0) {
@@ -5850,7 +5850,7 @@ skipfile:
{ 0x03, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7, 0x7F, 0x07, 0x88, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
{ 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7, 0x7F, 0x07, 0x88, 0x40, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF },
};
// main loop
@@ -5860,7 +5860,7 @@ skipfile:
uint8_t b = (mfFirstBlockOfSector(i) + j);
uint8_t block[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
switch(b) {
switch (b) {
case 0:
continue;
case 1:
@@ -5873,7 +5873,7 @@ skipfile:
memcpy(block, firstblocks[b], MFBLOCK_SIZE);
break;
default: {
if (mfIsSectorTrailer(j) ) {
if (mfIsSectorTrailer(j)) {
// ST NDEF
memcpy(block, firstblocks[7], MFBLOCK_SIZE);
}
File diff suppressed because it is too large. Load diff