mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 07:16:14 +08:00
style
This commit is contained in:
parent
49f7ae57dc
commit
e22776a7e0
|
@ -2133,7 +2133,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
|||
BigBuf_free_keep_EM();
|
||||
// Init early to be sure FPGA is loaded before any EML operation
|
||||
// usefull when eml memory is empty (UID supplied)
|
||||
Iso15693InitTag(); // to be sure FPGA is loaded before any EML operation
|
||||
Iso15693InitTag(); // to be sure FPGA is loaded before any EML operation
|
||||
|
||||
iso15_tag_t *tag = (iso15_tag_t *) BigBuf_get_EM_addr();
|
||||
if (tag == NULL) {
|
||||
|
|
|
@ -1183,9 +1183,9 @@ static int CmdHF15ELoad(const char *Cmd) {
|
|||
}
|
||||
|
||||
if ((tag->pagesCount > ISO15693_TAG_MAX_PAGES) ||
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
PrintAndLogEx(FAILED, "Tag size error: pagesCount=%d, bytesPerPage=%d",
|
||||
tag->pagesCount, tag->bytesPerPage);
|
||||
free(tag);
|
||||
|
@ -1212,7 +1212,7 @@ static int CmdHF15ELoad(const char *Cmd) {
|
|||
}
|
||||
|
||||
uint16_t bytestosend = MIN(chuncksize, bytes_read);
|
||||
if (hf15EmlSetMem((uint8_t*)tag + offset, bytestosend, offset) != PM3_SUCCESS) {
|
||||
if (hf15EmlSetMem((uint8_t *)tag + offset, bytestosend, offset) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(FAILED, "Can't set emulator memory at offest: %zu / 0x%zx", offset, offset);
|
||||
free(tag);
|
||||
return PM3_ESOFT;
|
||||
|
@ -1364,10 +1364,10 @@ static void print_emltag_15693(iso15_tag_t *tag, bool dense_output) {
|
|||
print_emltag_info_15693(tag);
|
||||
|
||||
print_blocks_15693(tag->data
|
||||
, (tag->pagesCount * tag->bytesPerPage)
|
||||
, tag->bytesPerPage
|
||||
, dense_output
|
||||
);
|
||||
, (tag->pagesCount * tag->bytesPerPage)
|
||||
, tag->bytesPerPage
|
||||
, dense_output
|
||||
);
|
||||
}
|
||||
|
||||
static int CmdHF15EView(const char *Cmd) {
|
||||
|
@ -1951,7 +1951,7 @@ static int CmdHF15Dump(const char *Cmd) {
|
|||
DropField();
|
||||
|
||||
|
||||
print_emltag_15693(tag, dense_output);
|
||||
print_emltag_15693(tag, dense_output);
|
||||
|
||||
if (tag->bytesPerPage != blocksize) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
@ -2131,7 +2131,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
|
|||
argtable[arglen++] = arg_int1("b", NULL, "<dec>", "first page number (0-255)");
|
||||
argtable[arglen++] = arg_int1(NULL, "cnt", "<dec>", "number of pages (1-6)");
|
||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)");
|
||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||
argtable[arglen++] = arg_param_end;
|
||||
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
@ -2288,7 +2288,7 @@ static int CmdHF15Readblock(const char *Cmd) {
|
|||
uint8_t arglen = arg_add_default(argtable);
|
||||
argtable[arglen++] = arg_int1("b", "blk", "<dec>", "page number (0-255)");
|
||||
argtable[arglen++] = arg_int0(NULL, "bs", "<dec>", "block size (def 4)");
|
||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||
argtable[arglen++] = arg_param_end;
|
||||
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
@ -2583,7 +2583,7 @@ static int CmdHF15Restore(const char *Cmd) {
|
|||
uint8_t arglen = arg_add_default(argtable);
|
||||
argtable[arglen++] = arg_str0("f", "file", "<fn>", "Specify a filename for dump file");
|
||||
argtable[arglen++] = arg_int0("r", "retry", "<dec>", "number of retries (def 3)");
|
||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||
argtable[arglen++] = arg_lit0("v", "verbose", "verbose output");
|
||||
argtable[arglen++] = arg_param_end;
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
|
@ -2651,7 +2651,7 @@ static int CmdHF15Restore(const char *Cmd) {
|
|||
return res;
|
||||
}
|
||||
|
||||
if (bytes_read != sizeof(iso15_tag_t)) {
|
||||
if (bytes_read != sizeof(iso15_tag_t)) {
|
||||
PrintAndLogEx(FAILED, "Memory image is not matching tag structure.");
|
||||
free(tag);
|
||||
return PM3_EINVARG;
|
||||
|
@ -2663,9 +2663,9 @@ static int CmdHF15Restore(const char *Cmd) {
|
|||
}
|
||||
|
||||
if ((tag->pagesCount > ISO15693_TAG_MAX_PAGES) ||
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
PrintAndLogEx(FAILED, "Tag size error: pagesCount=%d, bytesPerPage=%d",
|
||||
tag->pagesCount, tag->bytesPerPage);
|
||||
free(tag);
|
||||
|
@ -3317,9 +3317,9 @@ static int CmdHF15View(const char *Cmd) {
|
|||
}
|
||||
|
||||
if ((tag->pagesCount > ISO15693_TAG_MAX_PAGES) ||
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
PrintAndLogEx(FAILED, "Tag size error: pagesCount=%d, bytesPerPage=%d",
|
||||
tag->pagesCount, tag->bytesPerPage);
|
||||
free(tag);
|
||||
|
|
|
@ -8447,7 +8447,7 @@ static int CmdHF14AGen4ChangePwd(const char *Cmd) {
|
|||
static void parse_gdm_cfg(const uint8_t *d) {
|
||||
PrintAndLogEx(SUCCESS, "Config... " _YELLOW_("%s"), sprint_hex(d, MFBLOCK_SIZE));
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%02X %02X") " .......................................... %s %s", d[0], d[1], (d[0] == 0x85 && d[1] == 0x00) ? "Magic wakeup disabled" : _GREEN_("Magic wakeup enabled"), (d[0] == 0x85 && d[1] == 0x00) ? "" : ((d[0] == 0x7A && d[1] == 0xFF) ? _GREEN_("with GDM config block access") : _RED_("without GDM config block access")));
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%02X") " ....................................... Magic wakeup style %s", d[2], ((d[2] == 0x85) ? "GDM 20(7)/23": "Gen1a 40(7)/43"));
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%02X") " ....................................... Magic wakeup style %s", d[2], ((d[2] == 0x85) ? "GDM 20(7)/23" : "Gen1a 40(7)/43"));
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%02X %02X %02X") " .............................. Unknown", d[3], d[4], d[5]);
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%02X") " ........................... %s", d[6], (d[6] == 0x5A) ? "Key B use blocked when readable by ACL" : "Key B use allowed when readable by ACL");
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%02X") " ........................ %s", d[7], (d[7] == 0x5A) ? _GREEN_("Block 0 Direct Write Enabled (CUID)") : "Block 0 Direct Write Disabled (CUID)");
|
||||
|
|
|
@ -448,7 +448,7 @@ int detectGProxII(uint8_t *bits, size_t *size) {
|
|||
return (int) startIdx;
|
||||
}
|
||||
|
||||
// spacer bits not found - not a valid gproxII
|
||||
// spacer bits not found - not a valid gproxII
|
||||
return -5;
|
||||
}
|
||||
|
||||
|
|
|
@ -795,14 +795,14 @@ int saveFileWAVE(const char *preferredName, const int *data, size_t datalen) {
|
|||
.type = "WAVE",
|
||||
.format.tag = "fmt ",
|
||||
.format.size = sizeof(wave_info.format) - sizeof(wave_info.format.tag) - sizeof(wave_info.format.size),
|
||||
.format.codec = 1, // PCM
|
||||
.format.nb_channel = 1,
|
||||
.format.sample_per_sec = 125000, // TODO update for other tag types
|
||||
.format.byte_per_sec = 125000, // TODO update for other tag types
|
||||
.format.block_align = 1,
|
||||
.format.bit_per_sample = 8,
|
||||
.audio_data.tag = "data",
|
||||
.audio_data.size = datalen,
|
||||
.format.codec = 1, // PCM
|
||||
.format.nb_channel = 1,
|
||||
.format.sample_per_sec = 125000, // TODO update for other tag types
|
||||
.format.byte_per_sec = 125000, // TODO update for other tag types
|
||||
.format.block_align = 1,
|
||||
.format.bit_per_sample = 8,
|
||||
.audio_data.tag = "data",
|
||||
.audio_data.size = datalen,
|
||||
};
|
||||
|
||||
FILE *wave_file = fopen(fileName, "wb");
|
||||
|
@ -1783,9 +1783,9 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
|
|||
JsonLoadBufAsHex(root, "$.Card.pagescount", &tag->pagesCount, 1, datalen);
|
||||
|
||||
if ((tag->pagesCount > ISO15693_TAG_MAX_PAGES) ||
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||
(tag->pagesCount == 0) ||
|
||||
(tag->bytesPerPage == 0)) {
|
||||
PrintAndLogEx(ERR, "loadFileJSONex: pagesCount=%u (%04x) bytesPerPage=%u (%04x) -- invalid tag memory layout"
|
||||
, tag->pagesCount
|
||||
, tag->pagesCount
|
||||
|
|
|
@ -63,8 +63,8 @@ typedef struct {
|
|||
uint64_t current_key; // Use 64 bit and truncate when needed.
|
||||
uint8_t mode;
|
||||
uint8_t charset[
|
||||
BF_CHARSET_DIGITS_SIZE
|
||||
+ BF_CHARSET_UPPERCASE_SIZE
|
||||
BF_CHARSET_DIGITS_SIZE
|
||||
+ BF_CHARSET_UPPERCASE_SIZE
|
||||
];
|
||||
uint8_t charset_length;
|
||||
|
||||
|
|
|
@ -73,14 +73,14 @@
|
|||
|
||||
static const int Iso15693FrameSOF[] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
-1, -1, -1, -1,
|
||||
-1, -1, -1, -1,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1
|
||||
};
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
-1, -1, -1, -1,
|
||||
-1, -1, -1, -1,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1
|
||||
};
|
||||
static const int Iso15693Logic0[] = {
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1,
|
||||
|
@ -89,10 +89,10 @@ static const int Iso15693Logic0[] = {
|
|||
};
|
||||
static const int Iso15693Logic1[] = {
|
||||
-1, -1, -1, -1,
|
||||
-1, -1, -1, -1,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1
|
||||
};
|
||||
-1, -1, -1, -1,
|
||||
1, 1, 1, 1,
|
||||
1, 1, 1, 1
|
||||
};
|
||||
|
||||
// EOF defined as
|
||||
// 1) logic '0' (8 pulses of 423.75kHz followed by unmodulated for 18.88us)
|
||||
|
|
|
@ -280,7 +280,7 @@ typedef struct {
|
|||
|
||||
typedef struct {
|
||||
// 64KB SRAM -> 524288 bits(max sample num) < 2^30
|
||||
uint32_t samples :
|
||||
uint32_t samples :
|
||||
LF_SAMPLES_BITS;
|
||||
bool realtime : 1;
|
||||
bool verbose : 1;
|
||||
|
|
Loading…
Reference in a new issue