make style

This commit is contained in:
Philippe Teuwen 2021-05-30 14:29:05 +02:00
commit 4c44138557
9 changed files with 127 additions and 44 deletions

View file

@ -1319,8 +1319,7 @@ static int mifare_desfire_change_key(uint8_t key_no, uint8_t *new_key, uint8_t n
size_t sn = recv_len; size_t sn = recv_len;
if (new_algo == MFDES_ALGO_AES) if (new_algo == MFDES_ALGO_AES) {
{
// AES expects us to Calculate CMAC for status byte : OK 0x00 (0x91 00) // AES expects us to Calculate CMAC for status byte : OK 0x00 (0x91 00)
// As such if we get this far without an error, we should be good // As such if we get this far without an error, we should be good
// Since we are dropping the field, we dont need to maintain the CMAC etc. // Since we are dropping the field, we dont need to maintain the CMAC etc.
@ -1969,7 +1968,7 @@ static int handler_desfire_getvalue(mfdes_value_t *value, uint32_t *resplen, uin
DropFieldDesfire(); DropFieldDesfire();
return res; return res;
} }
size_t dlen = (size_t)*resplen; size_t dlen = (size_t) * resplen;
p = mifare_cryto_postprocess_data(tag, value->value, &dlen, cs | CMAC_COMMAND | CMAC_VERIFY | MAC_VERIFY); p = mifare_cryto_postprocess_data(tag, value->value, &dlen, cs | CMAC_COMMAND | CMAC_VERIFY | MAC_VERIFY);
(void)p; (void)p;
return res; return res;

View file

@ -4014,7 +4014,7 @@ static command_t CommandTable[] = {
{"cauth", CmdHF14AMfUCAuth, IfPm3Iso14443a, "Authentication - Ultralight-C"}, {"cauth", CmdHF14AMfUCAuth, IfPm3Iso14443a, "Authentication - Ultralight-C"},
{"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump MIFARE Ultralight family tag to binary file"}, {"dump", CmdHF14AMfUDump, IfPm3Iso14443a, "Dump MIFARE Ultralight family tag to binary file"},
{"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"}, {"info", CmdHF14AMfUInfo, IfPm3Iso14443a, "Tag information"},
{"ndefread",CmdHF14MfuNDEFRead, IfPm3Iso14443a, "Prints NDEF records from card"}, {"ndefread", CmdHF14MfuNDEFRead, IfPm3Iso14443a, "Prints NDEF records from card"},
{"rdbl", CmdHF14AMfURdBl, IfPm3Iso14443a, "Read block"}, {"rdbl", CmdHF14AMfURdBl, IfPm3Iso14443a, "Read block"},
{"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"}, {"restore", CmdHF14AMfURestore, IfPm3Iso14443a, "Restore a dump onto a MFU MAGIC tag"},
{"wrbl", CmdHF14AMfUWrBl, IfPm3Iso14443a, "Write block"}, {"wrbl", CmdHF14AMfUWrBl, IfPm3Iso14443a, "Write block"},

View file

@ -795,7 +795,7 @@ static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"help", CmdHelp, AlwaysAvailable, "This help"},
{"info", CmdHFSTInfo, IfPm3Iso14443a, "Tag information"}, {"info", CmdHFSTInfo, IfPm3Iso14443a, "Tag information"},
{"list", CmdHFSTList, AlwaysAvailable, "List ISO 14443A/7816 history"}, {"list", CmdHFSTList, AlwaysAvailable, "List ISO 14443A/7816 history"},
{"ndefread",CmdHFSTNdefRead, AlwaysAvailable, "read NDEF file on tag"}, {"ndefread", CmdHFSTNdefRead, AlwaysAvailable, "read NDEF file on tag"},
{"protect", CmdHFSTProtect, IfPm3Iso14443a, "change protection on tag"}, {"protect", CmdHFSTProtect, IfPm3Iso14443a, "change protection on tag"},
{"pwd", CmdHFSTPwd, IfPm3Iso14443a, "change password on tag"}, {"pwd", CmdHFSTPwd, IfPm3Iso14443a, "change password on tag"},
{"sim", CmdHFSTSim, IfPm3Iso14443a, "Fake ISO 14443A/ST tag"}, {"sim", CmdHFSTSim, IfPm3Iso14443a, "Fake ISO 14443A/ST tag"},

View file

@ -255,7 +255,7 @@ int CmdLFCommandRead(const char *Cmd) {
if (session.pm3_present == false) if (session.pm3_present == false)
return PM3_ENOTTY; return PM3_ENOTTY;
#define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS)) #define PAYLOAD_HEADER_SIZE (12 + (3 * LF_CMDREAD_MAX_EXTRA_SYMBOLS))
struct p { struct p {
uint32_t delay; uint32_t delay;
uint16_t period_0; uint16_t period_0;

View file

@ -122,7 +122,6 @@ Check column "offline" for their availability.
|`data hexsamples `|N |`Dump big buffer as hex bytes` |`data hexsamples `|N |`Dump big buffer as hex bytes`
|`data hex2bin `|Y |`Converts hexadecimal to binary` |`data hex2bin `|Y |`Converts hexadecimal to binary`
|`data load `|Y |`Load contents of file into graph window` |`data load `|Y |`Load contents of file into graph window`
|`data ndef `|Y |`Decode NDEF records`
|`data print `|Y |`Print the data in the DemodBuffer` |`data print `|Y |`Print the data in the DemodBuffer`
|`data samples `|N |`Get raw samples for graph window (GraphBuffer)` |`data samples `|N |`Get raw samples for graph window (GraphBuffer)`
|`data save `|Y |`Save signal trace data (from graph window)` |`data save `|Y |`Save signal trace data (from graph window)`
@ -176,6 +175,7 @@ Check column "offline" for their availability.
|`hf 14a list `|Y |`List ISO 14443-a history` |`hf 14a list `|Y |`List ISO 14443-a history`
|`hf 14a info `|N |`Tag information` |`hf 14a info `|N |`Tag information`
|`hf 14a reader `|N |`Act like an ISO14443-a reader` |`hf 14a reader `|N |`Act like an ISO14443-a reader`
|`hf 14a ndefread `|N |`Read an NDEF file from ISO 14443-A Type 4 tag`
|`hf 14a cuids `|N |`Collect n>0 ISO14443-a UIDs in one go` |`hf 14a cuids `|N |`Collect n>0 ISO14443-a UIDs in one go`
|`hf 14a sim `|N |`Simulate ISO 14443-a tag` |`hf 14a sim `|N |`Simulate ISO 14443-a tag`
|`hf 14a sniff `|N |`sniff ISO 14443-a traffic` |`hf 14a sniff `|N |`sniff ISO 14443-a traffic`
@ -198,7 +198,7 @@ Check column "offline" for their availability.
|`hf 14b dump `|N |`Read all memory pages of an ISO-14443-B tag, save to file` |`hf 14b dump `|N |`Read all memory pages of an ISO-14443-B tag, save to file`
|`hf 14b info `|N |`Tag information` |`hf 14b info `|N |`Tag information`
|`hf 14b list `|Y |`List ISO-14443-B history` |`hf 14b list `|Y |`List ISO-14443-B history`
|`hf 14b ndef `|N |`Read NDEF file on tag` |`hf 14b ndefread `|N |`Read NDEF file on tag`
|`hf 14b raw `|N |`Send raw hex data to tag` |`hf 14b raw `|N |`Send raw hex data to tag`
|`hf 14b reader `|N |`Act as a ISO-14443-B reader to identify a tag` |`hf 14b reader `|N |`Act as a ISO-14443-B reader to identify a tag`
|`hf 14b sim `|N |`Fake ISO ISO-14443-B tag` |`hf 14b sim `|N |`Fake ISO ISO-14443-B tag`
@ -400,7 +400,7 @@ Check column "offline" for their availability.
|`hf mf auth4 `|N |`ISO14443-4 AES authentication` |`hf mf auth4 `|N |`ISO14443-4 AES authentication`
|`hf mf dump `|N |`Dump MIFARE Classic tag to binary file` |`hf mf dump `|N |`Dump MIFARE Classic tag to binary file`
|`hf mf mad `|N |`Checks and prints MAD` |`hf mf mad `|N |`Checks and prints MAD`
|`hf mf ndef `|N |`Prints NDEF records from card` |`hf mf ndefread `|N |`Prints NDEF records from card`
|`hf mf personalize `|N |`Personalize UID (MIFARE Classic EV1 only)` |`hf mf personalize `|N |`Personalize UID (MIFARE Classic EV1 only)`
|`hf mf rdbl `|N |`Read MIFARE Classic block` |`hf mf rdbl `|N |`Read MIFARE Classic block`
|`hf mf rdsc `|N |`Read MIFARE Classic sector` |`hf mf rdsc `|N |`Read MIFARE Classic sector`
@ -449,7 +449,7 @@ Check column "offline" for their availability.
|`hf mfp wrbl `|N |`Write blocks` |`hf mfp wrbl `|N |`Write blocks`
|`hf mfp chk `|N |`Check keys` |`hf mfp chk `|N |`Check keys`
|`hf mfp mad `|N |`Checks and prints MAD` |`hf mfp mad `|N |`Checks and prints MAD`
|`hf mfp ndef `|N |`Prints NDEF records from card` |`hf mfp ndefread `|N |`Prints NDEF records from card`
### hf mfu ### hf mfu
@ -465,7 +465,7 @@ Check column "offline" for their availability.
|`hf mfu cauth `|N |`Authentication - Ultralight-C` |`hf mfu cauth `|N |`Authentication - Ultralight-C`
|`hf mfu dump `|N |`Dump MIFARE Ultralight family tag to binary file` |`hf mfu dump `|N |`Dump MIFARE Ultralight family tag to binary file`
|`hf mfu info `|N |`Tag information` |`hf mfu info `|N |`Tag information`
|`hf mfu ndef `|N |`Prints NDEF records from card` |`hf mfu ndefread `|N |`Prints NDEF records from card`
|`hf mfu rdbl `|N |`Read block` |`hf mfu rdbl `|N |`Read block`
|`hf mfu restore `|N |`Restore a dump onto a MFU MAGIC tag` |`hf mfu restore `|N |`Restore a dump onto a MFU MAGIC tag`
|`hf mfu wrbl `|N |`Write block` |`hf mfu wrbl `|N |`Write block`
@ -507,6 +507,17 @@ Check column "offline" for their availability.
|`hf mfdes writedata `|N |`Write data to standard/backup/record file` |`hf mfdes writedata `|N |`Write data to standard/backup/record file`
### hf seos
{ SEOS RFIDs... }
|command |offline |description
|------- |------- |-----------
|`hf seos help `|Y |`This help`
|`hf seos info `|N |`Tag information`
|`hf seos list `|Y |`List SEOS history`
### hf st ### hf st
{ ST Rothult RFIDs... } { ST Rothult RFIDs... }
@ -516,7 +527,7 @@ Check column "offline" for their availability.
|`hf st help `|Y |`This help` |`hf st help `|Y |`This help`
|`hf st info `|N |`Tag information` |`hf st info `|N |`Tag information`
|`hf st list `|Y |`List ISO 14443A/7816 history` |`hf st list `|Y |`List ISO 14443A/7816 history`
|`hf st ndef `|Y |`read NDEF file on tag` |`hf st ndefread `|Y |`read NDEF file on tag`
|`hf st protect `|N |`change protection on tag` |`hf st protect `|N |`change protection on tag`
|`hf st pwd `|N |`change password on tag` |`hf st pwd `|N |`change password on tag`
|`hf st sim `|N |`Fake ISO 14443A/ST tag` |`hf st sim `|N |`Fake ISO 14443A/ST tag`
@ -1100,6 +1111,79 @@ Check column "offline" for their availability.
|`mem spiffs wipe `|N |`Wipe all files from SPIFFS file system * dangerous *` |`mem spiffs wipe `|N |`Wipe all files from SPIFFS file system * dangerous *`
### nfc
{ NFC commands... }
|command |offline |description
|------- |------- |-----------
|`nfc help `|Y |`This help`
|`nfc decode `|Y |`Decode NDEF records`
### nfc type1
{ NFC Forum Tag Type 1... }
|command |offline |description
|------- |------- |-----------
|`nfc type1 read `|N |`read NFC Forum Tag Type 1`
|`nfc type1 help `|Y |`This help`
### nfc type2
{ NFC Forum Tag Type 2... }
|command |offline |description
|------- |------- |-----------
|`nfc type2 read `|N |`read NFC Forum Tag Type 2`
|`nfc type2 help `|Y |`This help`
### nfc type4a
{ NFC Forum Tag Type 4 ISO14443A... }
|command |offline |description
|------- |------- |-----------
|`nfc type4a read `|N |`read NFC Forum Tag Type 4 A`
|`nfc type4a st25taread `|N |`read ST25TA as NFC Forum Tag Type 4`
|`nfc type4a help `|Y |`This help`
### nfc type4b
{ NFC Forum Tag Type 4 ISO14443B... }
|command |offline |description
|------- |------- |-----------
|`nfc type4b read `|N |`read NFC Forum Tag Type 4 B`
|`nfc type4b help `|Y |`This help`
### nfc mf
{ NFC Type MIFARE Classic/Plus Tag... }
|command |offline |description
|------- |------- |-----------
|`nfc mf cread `|N |`read NFC Type MIFARE Classic Tag`
|`nfc mf pread `|N |`read NFC Type MIFARE Plus Tag`
|`nfc mf help `|Y |`This help`
### nfc barcode
{ NFC Barcode Tag... }
|command |offline |description
|------- |------- |-----------
|`nfc barcode read `|N |`read NFC Barcode`
|`nfc barcode sim `|N |`simulate NFC Barcode`
|`nfc barcode help `|Y |`This help`
### reveng ### reveng
{ CRC calculations from RevEng software... } { CRC calculations from RevEng software... }

View file

@ -101,7 +101,7 @@ static int zlib_compress(FILE *infile[], uint8_t num_infiles, FILE *outfile) {
memcpy(ring_buffer, fpga_config + current_in, bytes_to_copy); memcpy(ring_buffer, fpga_config + current_in, bytes_to_copy);
int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max); int cmp_bytes = LZ4_compress_HC_continue(lz4_streamhc, ring_buffer, outbuf, bytes_to_copy, outsize_max);
if (cmp_bytes < 0 ){ if (cmp_bytes < 0) {
fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes); fprintf(stderr, "(lz4 - zlib_compress) error, got negative number of bytes from LZ4_compress_HC_continue call. got %d ", cmp_bytes);
free(ring_buffer); free(ring_buffer);
free(outbuf); free(outbuf);
@ -220,7 +220,7 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int *
/* Four byte length field */ /* Four byte length field */
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
tmp = fgetc(infile); tmp = fgetc(infile);
if (tmp < 0 ) { if (tmp < 0) {
break; break;
} }
current_length += tmp << (24 - (i * 8)); current_length += tmp << (24 - (i * 8));
@ -230,7 +230,7 @@ static int bitparse_find_section(FILE *infile, char section_name, unsigned int *
default: /* Fall through, two byte length field */ default: /* Fall through, two byte length field */
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
tmp = fgetc(infile); tmp = fgetc(infile);
if (tmp < 0 ) { if (tmp < 0) {
break; break;
} }
current_length += tmp << (8 - (i * 8)); current_length += tmp << (8 - (i * 8));