make style
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "legicrf.h"
|
||||
#include "legicrfsim.h"
|
||||
#include "legic.h" // legic_card_select_t struct
|
||||
#include "spiffs.h" // flashmem
|
||||
#include "spiffs.h" // flashmem
|
||||
|
||||
|
||||
/*
|
||||
@@ -47,7 +47,7 @@
|
||||
void DownloadLogInstructions() {
|
||||
Dbprintf("");
|
||||
Dbprintf("[=] List all dumps from flash:");
|
||||
Dbprintf("[=] " _YELLOW_("-") "mem spiffs tree");
|
||||
Dbprintf("[=] " _YELLOW_("-") "mem spiffs tree");
|
||||
Dbprintf("");
|
||||
Dbprintf("[=] To save a dump file from flash to client:");
|
||||
Dbprintf("[=] " _YELLOW_("-") "mem spiffs dump o hf-legic-UID-dump.bin f hf-legic-UID-dump.bin");
|
||||
@@ -60,15 +60,15 @@ void save_dump_to_file(legic_card_select_t *p_card) {
|
||||
// legic functions puts it memory in Emulator reserved memory.
|
||||
uint8_t *mem = BigBuf_get_EM_addr();
|
||||
|
||||
char *preferredName = (char*)BigBuf_malloc(30);
|
||||
char *preferredName = (char *)BigBuf_malloc(30);
|
||||
if (preferredName == NULL) {
|
||||
goto OUT;
|
||||
}
|
||||
|
||||
|
||||
sprintf(preferredName, "hf-legic-%02X%02X%02X%02X-dump", p_card->uid[0], p_card->uid[1], p_card->uid[2], p_card->uid[3]);
|
||||
uint16_t preferredNameLen = strlen(preferredName);
|
||||
|
||||
char *filename = (char*)BigBuf_malloc(preferredNameLen + 4 + 1 + 10);
|
||||
char *filename = (char *)BigBuf_malloc(preferredNameLen + 4 + 1 + 10);
|
||||
if (filename == NULL) {
|
||||
goto OUT;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void RunMod() {
|
||||
DbpString("[=] press and HOLD button to exit standalone mode");
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
|
||||
|
||||
//exit from hf_legic, send usbcommand
|
||||
if (data_available()) break;
|
||||
|
||||
@@ -136,18 +136,18 @@ void RunMod() {
|
||||
|
||||
//simulate if read successfully
|
||||
if (read_success != PM3_ESOFT) {
|
||||
|
||||
|
||||
legic_card_select_t *p_card;
|
||||
p_card = getLegicCardInfo();
|
||||
if (p_card->cardsize == 0)
|
||||
if (p_card->cardsize == 0)
|
||||
continue;
|
||||
|
||||
|
||||
save_dump_to_file(p_card);
|
||||
|
||||
LED_D_ON();
|
||||
uint8_t ct;
|
||||
switch(p_card->tagtype) {
|
||||
case 0x0D:
|
||||
switch (p_card->tagtype) {
|
||||
case 0x0D:
|
||||
ct = 0;
|
||||
break;
|
||||
case 0x1D:
|
||||
@@ -156,7 +156,7 @@ void RunMod() {
|
||||
case 0x3D:
|
||||
ct = 2;
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void RunMod() {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf("[=] >> LF EM4100 simulator started <<");
|
||||
|
||||
|
||||
int selected = 0; //selected slot after start
|
||||
slots_count = sizeof(low) / sizeof(low[0]);
|
||||
bba = BigBuf_get_addr();
|
||||
|
||||
@@ -122,7 +122,7 @@ void RunMod() {
|
||||
StandAloneMode();
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||
Dbprintf("[=] >> LF EM4100 read/write/clone started <<");
|
||||
|
||||
|
||||
int selected = 0;
|
||||
//state 0 - select slot
|
||||
// 1 - read tag to selected slot,
|
||||
|
||||
@@ -524,7 +524,7 @@ int EPA_Setup() {
|
||||
}
|
||||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
|
||||
|
||||
// if we're here, there is no type A card, so we look for type B
|
||||
// power up the field
|
||||
iso14443b_setup();
|
||||
|
||||
@@ -52,8 +52,8 @@ size_t blocknr;
|
||||
bool end = false;
|
||||
//#define SENDBIT_TEST
|
||||
|
||||
/* array index 3 2 1 0 // bytes in sim.bin file are 0 1 2 3
|
||||
// UID is 0 1 2 3 // tag.uid is 3210
|
||||
/* array index 3 2 1 0 // bytes in sim.bin file are 0 1 2 3
|
||||
// UID is 0 1 2 3 // tag.uid is 3210
|
||||
// datasheet HitagS_V11.pdf bytes in tables printed 3 2 1 0
|
||||
|
||||
#db# UID: 5F C2 11 84
|
||||
@@ -977,7 +977,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
||||
// TC1: Capture mode, default timer source = MCK/2 (TIMER_CLOCK1), TIOA is external trigger,
|
||||
// external trigger rising edge, load RA on rising edge of TIOA.
|
||||
AT91C_BASE_TC1->TC_CMR = AT91C_TC_CLKS_TIMER_DIV1_CLOCK
|
||||
| AT91C_TC_ETRGEDG_RISING | AT91C_TC_ABETRG | AT91C_TC_LDRA_RISING;
|
||||
| AT91C_TC_ETRGEDG_RISING | AT91C_TC_ABETRG | AT91C_TC_LDRA_RISING;
|
||||
|
||||
// Enable and reset counter
|
||||
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
||||
@@ -1051,7 +1051,7 @@ void SimulateHitagSTag(bool tag_mem_supplied, uint8_t *data) {
|
||||
|
||||
// Enable and reset external trigger in timer for capturing future frames
|
||||
AT91C_BASE_TC1->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
|
||||
|
||||
|
||||
// Reset the received frame and response timing info
|
||||
memset(rx, 0x00, sizeof(rx));
|
||||
response = 0;
|
||||
|
||||
@@ -404,7 +404,7 @@ bool write_byte(uint16_t index, uint8_t byte, uint8_t addr_sz) {
|
||||
//
|
||||
// Only this functions are public / called from appmain.c
|
||||
//-----------------------------------------------------------------------------
|
||||
legic_card_select_t* getLegicCardInfo(void) {
|
||||
legic_card_select_t *getLegicCardInfo(void) {
|
||||
return &card;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ int LegicRfReaderEx(uint16_t offset, uint16_t len, uint8_t iv) {
|
||||
goto OUT;
|
||||
}
|
||||
legic_mem[i] = byte;
|
||||
|
||||
|
||||
if (i < 4) {
|
||||
card.uid[i] = byte;
|
||||
}
|
||||
@@ -506,7 +506,7 @@ void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv) {
|
||||
goto OUT;
|
||||
}
|
||||
legic_mem[i] = byte;
|
||||
|
||||
|
||||
if (i < 4) {
|
||||
card.uid[i] = byte;
|
||||
}
|
||||
|
||||
@@ -21,5 +21,5 @@ int LegicRfReaderEx(uint16_t offset, uint16_t len, uint8_t iv);
|
||||
void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv);
|
||||
void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data);
|
||||
|
||||
legic_card_select_t* getLegicCardInfo(void);
|
||||
legic_card_select_t *getLegicCardInfo(void);
|
||||
#endif /* __LEGICRF_H */
|
||||
|
||||
@@ -2405,7 +2405,7 @@ void SendForward(uint8_t fwd_bit_count) {
|
||||
WaitUS(32 * 8);
|
||||
} else {
|
||||
TurnReadLF_off(23 * 8);
|
||||
TurnReadLFOn((32-23) * 8);
|
||||
TurnReadLFOn((32 - 23) * 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,16 +334,16 @@ void MifareDES_Auth1(uint8_t *datain) {
|
||||
return;
|
||||
}
|
||||
|
||||
int rndlen=8;
|
||||
int rndlen = 8;
|
||||
int expectedlen = 1 + 8 + 2 + 2;
|
||||
if (payload->algo == MFDES_ALGO_AES || payload->algo == MFDES_ALGO_3K3DES) {
|
||||
expectedlen = 1 + 16 + 2 + 2;
|
||||
rndlen=16;
|
||||
rndlen = 16;
|
||||
}
|
||||
|
||||
if (payload->mode == MFDES_AUTH_PICC) {
|
||||
expectedlen = 1 + 1 + 8 + 2;
|
||||
rndlen=8;
|
||||
rndlen = 8;
|
||||
}
|
||||
|
||||
if (len != expectedlen) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
// PRIx64 definition missing with gcc-arm-none-eabi v8?
|
||||
#ifndef PRIx64
|
||||
#define PRIx64 "llx"
|
||||
#define PRIx64 "llx"
|
||||
#endif
|
||||
|
||||
// Basic macros
|
||||
|
||||
Reference in New Issue
Block a user