mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
make style
This commit is contained in:
parent
8a602ed99d
commit
4ed57c7c4d
57 changed files with 878 additions and 878 deletions
|
@ -159,8 +159,8 @@ void BigBuf_print_status(void) {
|
|||
Dbprintf(" traceLen ...............%d", trace_len);
|
||||
|
||||
Dbprintf(" dma8 memory.............%d", dma_8.buf - BigBuf_get_addr());
|
||||
Dbprintf(" dma16 memory............%d", (uint8_t*)dma_16.buf - BigBuf_get_addr());
|
||||
Dbprintf(" toSend memory...........%d", toSend.buf - BigBuf_get_addr() );
|
||||
Dbprintf(" dma16 memory............%d", (uint8_t *)dma_16.buf - BigBuf_get_addr());
|
||||
Dbprintf(" toSend memory...........%d", toSend.buf - BigBuf_get_addr());
|
||||
}
|
||||
|
||||
// return the maximum trace length (i.e. the unallocated size of BigBuf)
|
||||
|
@ -309,7 +309,7 @@ void tosend_stuffbit(int b) {
|
|||
|
||||
dmabuf16_t *get_dma16(void) {
|
||||
if (dma_16.buf == NULL)
|
||||
dma_16.buf = (uint16_t*)BigBuf_malloc(DMA_BUFFER_SIZE * sizeof(uint16_t));
|
||||
dma_16.buf = (uint16_t *)BigBuf_malloc(DMA_BUFFER_SIZE * sizeof(uint16_t));
|
||||
|
||||
return &dma_16;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
#define HF_ICLASS_CC_A "iceclass_cc_a.bin"
|
||||
#define HF_ICLASS_CC_B "iceclass_cc_b.bin"
|
||||
char* cc_files[] = { HF_ICLASS_CC_A, HF_ICLASS_CC_B };
|
||||
char *cc_files[] = { HF_ICLASS_CC_A, HF_ICLASS_CC_B };
|
||||
|
||||
|
||||
|
||||
|
@ -65,7 +65,7 @@ char* cc_files[] = { HF_ICLASS_CC_A, HF_ICLASS_CC_B };
|
|||
#endif
|
||||
|
||||
// iclass card descriptors
|
||||
char * card_types[] = {
|
||||
char *card_types[] = {
|
||||
"PicoPass 16K / 16", // 000
|
||||
"PicoPass 32K with current book 16K / 16", // 001
|
||||
"Unknown Card Type!", // 010
|
||||
|
@ -185,7 +185,7 @@ static int fullsim_mode(void) {
|
|||
Dbprintf("loaded " _GREEN_(HF_ICLASS_FULLSIM_ORIG_BIN) " (%u bytes)", fsize);
|
||||
}
|
||||
|
||||
iclass_simulate(ICLASS_SIM_MODE_FULL, 0 , false, NULL, NULL, NULL);
|
||||
iclass_simulate(ICLASS_SIM_MODE_FULL, 0, false, NULL, NULL, NULL);
|
||||
|
||||
LED_B_ON();
|
||||
rdv40_spiffs_lazy_mount();
|
||||
|
@ -334,7 +334,7 @@ static int reader_dump_mode(void) {
|
|||
res = authenticate_iclass_tag(&auth, hdr, &start_time, &eof_time, NULL);
|
||||
if (res == false) {
|
||||
switch_off();
|
||||
Dbprintf( _RED_("failed AA1 auth") ", skipping ");
|
||||
Dbprintf(_RED_("failed AA1 auth") ", skipping ");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,7 @@ static int reader_dump_mode(void) {
|
|||
}
|
||||
}
|
||||
switch_off();
|
||||
save_to_flash(card_data, (start_block + dumped) * 8 );
|
||||
save_to_flash(card_data, (start_block + dumped) * 8);
|
||||
Dbprintf("%u bytes saved", (start_block + dumped) * 8);
|
||||
}
|
||||
DbpString("-=[ exiting " _CYAN_("`read & dump`") " mode ]=-");
|
||||
|
@ -409,7 +409,7 @@ static int config_sim_mode(void) {
|
|||
|
||||
if (res == SPIFFS_OK) {
|
||||
Dbprintf("loaded " _GREEN_("%s") " (%u bytes) to emulator memory", cc_files[i], fsize);
|
||||
iclass_simulate(ICLASS_SIM_MODE_FULL, 0 , false, NULL, NULL, NULL);
|
||||
iclass_simulate(ICLASS_SIM_MODE_FULL, 0, false, NULL, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ void RunMod(void) {
|
|||
|
||||
// Look for config cards
|
||||
rdv40_spiffs_lazy_mount();
|
||||
for (uint8_t i =0; i < 2; i++) {
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
if (exists_in_spiffs(cc_files[i]) == false) {
|
||||
Dbprintf(_RED_("error") ", " _YELLOW_("%s") " file missing", cc_files[i]);
|
||||
mode = ICE_STATE_NONE;
|
||||
|
|
|
@ -295,7 +295,7 @@ static void TimingIntervalAcquisition(void) {
|
|||
|
||||
static void print_debug_level(void) {
|
||||
char dbglvlstr[20] = {0};
|
||||
switch(DBGLEVEL) {
|
||||
switch (DBGLEVEL) {
|
||||
case DBG_NONE:
|
||||
sprintf(dbglvlstr, "NONE");
|
||||
break;
|
||||
|
@ -364,7 +364,7 @@ static void SendStatus(void) {
|
|||
print_debug_level();
|
||||
|
||||
tosend_t *ts = get_tosend();
|
||||
Dbprintf(" ToSendMax...............%d", ts->max );
|
||||
Dbprintf(" ToSendMax...............%d", ts->max);
|
||||
Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE);
|
||||
while ((AT91C_BASE_PMC->PMC_MCFR & AT91C_CKGR_MAINRDY) == 0); // Wait for MAINF value to become available...
|
||||
uint16_t mainf = AT91C_BASE_PMC->PMC_MCFR & AT91C_CKGR_MAINF; // Get # main clocks within 16 slow clocks
|
||||
|
|
|
@ -113,7 +113,7 @@ static uint8_t bits2byte(uint8_t *bits, int length) {
|
|||
|
||||
byte |= bits[i];
|
||||
|
||||
if (i != length-1)
|
||||
if (i != length - 1)
|
||||
byte <<= 1;
|
||||
}
|
||||
|
||||
|
@ -145,17 +145,17 @@ static void save_word(int pos, uint8_t bits[EM4X50_TAG_WORD]) {
|
|||
|
||||
// data and row parities
|
||||
for (int i = 0; i < 4; i++) {
|
||||
tag.sectors[pos][i] = bits2byte(&bits[9*i],8);
|
||||
row_parity[i] = bits[9*i+8];
|
||||
tag.sectors[pos][i] = bits2byte(&bits[9 * i], 8);
|
||||
row_parity[i] = bits[9 * i + 8];
|
||||
}
|
||||
|
||||
tag.sectors[pos][4] = bits2byte(row_parity,4);
|
||||
tag.sectors[pos][4] = bits2byte(row_parity, 4);
|
||||
|
||||
// column parities
|
||||
for (int i = 0; i < 8; i++)
|
||||
col_parity[i] = bits[36+i];
|
||||
col_parity[i] = bits[36 + i];
|
||||
|
||||
tag.sectors[pos][5] = bits2byte(col_parity,8);
|
||||
tag.sectors[pos][5] = bits2byte(col_parity, 8);
|
||||
|
||||
// stop bit
|
||||
tag.sectors[pos][6] = bits[44];
|
||||
|
@ -379,7 +379,7 @@ static void em4x50_send_byte(uint8_t byte) {
|
|||
// send byte (without parity)
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
em4x50_send_bit((byte >> (7-i)) & 1);
|
||||
em4x50_send_bit((byte >> (7 - i)) & 1);
|
||||
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ static void em4x50_send_byte_with_parity(uint8_t byte) {
|
|||
int parity = 0, bit = 0;
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
bit = (byte >> (7-i)) & 1;
|
||||
bit = (byte >> (7 - i)) & 1;
|
||||
em4x50_send_bit(bit);
|
||||
parity ^= bit;
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ static int get_word_from_bitstream(uint8_t bits[EM4X50_TAG_WORD]) {
|
|||
if (check_pulse_length(pl, EM4X50_T_TAG_FULL_PERIOD)) {
|
||||
|
||||
// pulse length = 1 -> keep former bit value
|
||||
bits[i] = bits[i-1];
|
||||
bits[i] = bits[i - 1];
|
||||
|
||||
} else if (check_pulse_length(pl, 3 * EM4X50_T_TAG_HALF_PERIOD)) {
|
||||
|
||||
|
@ -625,10 +625,10 @@ static int get_word_from_bitstream(uint8_t bits[EM4X50_TAG_WORD]) {
|
|||
if (bbitchange) {
|
||||
|
||||
// if number of pulse lengths with 1.5 periods is even -> add bit
|
||||
bits[i] = (bits[i-1] == 1) ? 1 : 0;
|
||||
bits[i] = (bits[i - 1] == 1) ? 1 : 0;
|
||||
|
||||
// pulse length of 1.5 changes bit value
|
||||
bits[i+1] = (bits[i] == 1) ? 0 : 1;
|
||||
bits[i + 1] = (bits[i] == 1) ? 0 : 1;
|
||||
i++;
|
||||
|
||||
// next time add only one bit
|
||||
|
@ -636,7 +636,7 @@ static int get_word_from_bitstream(uint8_t bits[EM4X50_TAG_WORD]) {
|
|||
|
||||
} else {
|
||||
|
||||
bits[i] = (bits[i-1] == 1) ? 0 : 1;
|
||||
bits[i] = (bits[i - 1] == 1) ? 0 : 1;
|
||||
|
||||
// next time two bits have to be added
|
||||
bbitchange = true;
|
||||
|
@ -646,7 +646,7 @@ static int get_word_from_bitstream(uint8_t bits[EM4X50_TAG_WORD]) {
|
|||
|
||||
// pulse length of 2 means: adding 2 bits "01"
|
||||
bits[i] = 0;
|
||||
bits[i+1] = 1;
|
||||
bits[i + 1] = 1;
|
||||
i++;
|
||||
|
||||
} else if (check_pulse_length(pl, 3 * EM4X50_T_TAG_FULL_PERIOD)) {
|
||||
|
@ -668,7 +668,7 @@ static bool login(uint8_t password[4]) {
|
|||
// simple login to EM4x50,
|
||||
// used in operations that require authentication
|
||||
|
||||
if (request_receive_mode ()) {
|
||||
if (request_receive_mode()) {
|
||||
|
||||
// send login command
|
||||
em4x50_send_byte_with_parity(EM4X50_COMMAND_LOGIN);
|
||||
|
@ -696,7 +696,7 @@ static bool reset(void) {
|
|||
|
||||
// resets EM4x50 tag (used by write function)
|
||||
|
||||
if (request_receive_mode ()) {
|
||||
if (request_receive_mode()) {
|
||||
|
||||
// send login command
|
||||
em4x50_send_byte_with_parity(EM4X50_COMMAND_RESET);
|
||||
|
|
|
@ -97,7 +97,7 @@ int HfSniff(uint32_t samplesToSkip, uint32_t triggersToSkip, uint16_t *len) {
|
|||
}
|
||||
}
|
||||
|
||||
optimizedSniff((uint16_t*)mem, *len);
|
||||
optimizedSniff((uint16_t *)mem, *len);
|
||||
|
||||
if (DBGLEVEL >= DBG_INFO) {
|
||||
Dbprintf("Trigger kicked in (%d >= 180)", r);
|
||||
|
|
|
@ -1002,7 +1002,7 @@ void SniffHitag2(void) {
|
|||
size_t periods = 0;
|
||||
uint8_t periods_bytes[4];
|
||||
|
||||
// int16_t checked = 0;
|
||||
// int16_t checked = 0;
|
||||
|
||||
/*bool waiting_for_first_edge = true;*/
|
||||
LED_C_ON();
|
||||
|
@ -1015,7 +1015,7 @@ void SniffHitag2(void) {
|
|||
|
||||
WDT_HIT();
|
||||
|
||||
/*
|
||||
/*
|
||||
// only every 1000th times, in order to save time when collecting samples.
|
||||
if (checked == 1000) {
|
||||
if (data_available()) {
|
||||
|
|
|
@ -190,7 +190,7 @@ void iclass_simulate(uint8_t sim_type, uint8_t num_csns, bool send_reply, uint8_
|
|||
// In this mode, a number of csns are within datain. We'll simulate each one, one at a time
|
||||
// in order to collect MAC's from the reader. This can later be used in an offlne-attack
|
||||
// in order to obtain the keys, as in the "dismantling iclass"-paper.
|
||||
#define EPURSE_MAC_SIZE 16
|
||||
#define EPURSE_MAC_SIZE 16
|
||||
int i = 0;
|
||||
for (; i < num_csns && i * EPURSE_MAC_SIZE + 8 < PM3_CMD_DATA_SIZE; i++) {
|
||||
|
||||
|
@ -646,7 +646,7 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
|||
}
|
||||
|
||||
// debit key
|
||||
if (receivedCmd[0] == 0x88 ){
|
||||
if (receivedCmd[0] == 0x88) {
|
||||
cipher_state = &cipher_state_KD[current_page];
|
||||
diversified_key = diversified_kd;
|
||||
using_kc = false;
|
||||
|
@ -679,11 +679,11 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
|||
if (_mac[0] != receivedCmd[5] || _mac[1] != receivedCmd[6] || _mac[2] != receivedCmd[7] || _mac[3] != receivedCmd[8]) {
|
||||
Dbprintf("reader auth " _RED_("failed"));
|
||||
Dbprintf("hf iclass lookup u %02x%02x%02x%02x%02x%02x%02x%02x p %02x%02x%02x%02x%02x%02x%02x%02x m %02x%02x%02x%02x%02x%02x%02x%02x f iclass_default_keys.dic",
|
||||
csn_data[0],csn_data[1],csn_data[2],csn_data[3],csn_data[4],csn_data[5],csn_data[6],csn_data[7],
|
||||
card_challenge_data[0],card_challenge_data[1],card_challenge_data[2],card_challenge_data[3],
|
||||
card_challenge_data[4],card_challenge_data[5],card_challenge_data[6],card_challenge_data[7],
|
||||
receivedCmd[1],receivedCmd[2],receivedCmd[3],receivedCmd[4],
|
||||
receivedCmd[5],receivedCmd[6],receivedCmd[7],receivedCmd[8]
|
||||
csn_data[0], csn_data[1], csn_data[2], csn_data[3], csn_data[4], csn_data[5], csn_data[6], csn_data[7],
|
||||
card_challenge_data[0], card_challenge_data[1], card_challenge_data[2], card_challenge_data[3],
|
||||
card_challenge_data[4], card_challenge_data[5], card_challenge_data[6], card_challenge_data[7],
|
||||
receivedCmd[1], receivedCmd[2], receivedCmd[3], receivedCmd[4],
|
||||
receivedCmd[5], receivedCmd[6], receivedCmd[7], receivedCmd[8]
|
||||
);
|
||||
|
||||
goto send;
|
||||
|
@ -760,13 +760,13 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
|||
// is chip in ReadOnly (RO)
|
||||
if ((block_wr_lock & 0x80) == 0) goto send;
|
||||
|
||||
if ( block == 12 && (block_wr_lock & 0x40) == 0) goto send;
|
||||
if ( block == 11 && (block_wr_lock & 0x20) == 0) goto send;
|
||||
if ( block == 10 && (block_wr_lock & 0x10) == 0) goto send;
|
||||
if ( block == 9 && (block_wr_lock & 0x08) == 0) goto send;
|
||||
if ( block == 8 && (block_wr_lock & 0x04) == 0) goto send;
|
||||
if ( block == 7 && (block_wr_lock & 0x02) == 0) goto send;
|
||||
if ( block == 6 && (block_wr_lock & 0x01) == 0) goto send;
|
||||
if (block == 12 && (block_wr_lock & 0x40) == 0) goto send;
|
||||
if (block == 11 && (block_wr_lock & 0x20) == 0) goto send;
|
||||
if (block == 10 && (block_wr_lock & 0x10) == 0) goto send;
|
||||
if (block == 9 && (block_wr_lock & 0x08) == 0) goto send;
|
||||
if (block == 8 && (block_wr_lock & 0x04) == 0) goto send;
|
||||
if (block == 7 && (block_wr_lock & 0x02) == 0) goto send;
|
||||
if (block == 6 && (block_wr_lock & 0x01) == 0) goto send;
|
||||
|
||||
if (block == 2) { // update e-purse
|
||||
memcpy(card_challenge_data, receivedCmd + 2, 8);
|
||||
|
@ -830,7 +830,7 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
|||
|
||||
// if on 2k, always ignore 3msb, & 0x1F)
|
||||
uint8_t page = receivedCmd[1] & 0x1F;
|
||||
if ( page > max_page) {
|
||||
if (page > max_page) {
|
||||
goto send;
|
||||
}
|
||||
|
||||
|
@ -857,7 +857,7 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
|
|||
}
|
||||
goto send;
|
||||
|
||||
} else if(cmd == ICLASS_CMD_DETECT) { // 0x0F
|
||||
} else if (cmd == ICLASS_CMD_DETECT) { // 0x0F
|
||||
// not supported yet, ignore
|
||||
} else if (cmd == 0x26 && len == 5) {
|
||||
// standard ISO15693 INVENTORY command. Ignore.
|
||||
|
@ -1249,7 +1249,7 @@ static void iclass_send_as_reader(uint8_t *frame, int len, uint32_t *start_time,
|
|||
LogTrace_ISO15693(frame, len, (*start_time * 4), (*end_time * 4), NULL, true);
|
||||
}
|
||||
|
||||
static bool iclass_send_cmd_with_retries(uint8_t* cmd, size_t cmdsize, uint8_t* resp, size_t max_resp_size,
|
||||
static bool iclass_send_cmd_with_retries(uint8_t *cmd, size_t cmdsize, uint8_t *resp, size_t max_resp_size,
|
||||
uint8_t expected_size, uint8_t tries, uint32_t *start_time,
|
||||
uint16_t timeout, uint32_t *eof_time) {
|
||||
while (tries-- > 0) {
|
||||
|
@ -1332,7 +1332,7 @@ static bool select_iclass_tag_ex(uint8_t *card_data, bool use_credit_key, uint32
|
|||
return false;
|
||||
|
||||
// save CONF
|
||||
memcpy( (uint8_t*)&hdr->conf, resp, sizeof(hdr->conf));
|
||||
memcpy((uint8_t *)&hdr->conf, resp, sizeof(hdr->conf));
|
||||
|
||||
if (status)
|
||||
*status |= (FLAG_ICLASS_CSN | FLAG_ICLASS_CONF);
|
||||
|
@ -1492,7 +1492,7 @@ void ReaderIClass_Replay(uint8_t *rnr, uint8_t *mac) {
|
|||
Iso15693InitReader();
|
||||
|
||||
picopass_hdr hdr = {0};
|
||||
bool res = select_iclass_tag( (uint8_t *)&hdr, false, &eof_time);
|
||||
bool res = select_iclass_tag((uint8_t *)&hdr, false, &eof_time);
|
||||
if (res == false) {
|
||||
reply_ng(CMD_HF_ICLASS_REPLAY, PM3_ETIMEOUT, NULL, 0);
|
||||
switch_off();
|
||||
|
@ -1513,7 +1513,7 @@ void ReaderIClass_Replay(uint8_t *rnr, uint8_t *mac) {
|
|||
uint8_t mem = hdr.conf.mem_config;
|
||||
uint8_t cardsize = ((mem & 0x80) == 0x80) ? 255 : 32;
|
||||
|
||||
/*
|
||||
/*
|
||||
static struct memory_t {
|
||||
int k16;
|
||||
int book;
|
||||
|
@ -1522,13 +1522,13 @@ void ReaderIClass_Replay(uint8_t *rnr, uint8_t *mac) {
|
|||
int keyaccess;
|
||||
} memory;
|
||||
|
||||
// memory.k16 = ((mem & 0x80) == 0x80);
|
||||
// memory.book = ((mem & 0x20) == 0x20);
|
||||
// memory.k2 = ((mem & 0x08) == 0x08);
|
||||
// memory.lockauth = ((mem & 0x02) == 0x02);
|
||||
// memory.keyaccess = ((mem & 0x01) == 0x01);
|
||||
// uint8_t cardsize = memory.k16 ? 255 : 32;
|
||||
*/
|
||||
// memory.k16 = ((mem & 0x80) == 0x80);
|
||||
// memory.book = ((mem & 0x20) == 0x20);
|
||||
// memory.k2 = ((mem & 0x08) == 0x08);
|
||||
// memory.lockauth = ((mem & 0x02) == 0x02);
|
||||
// memory.keyaccess = ((mem & 0x01) == 0x01);
|
||||
// uint8_t cardsize = memory.k16 ? 255 : 32;
|
||||
*/
|
||||
|
||||
bool dumpsuccess = true;
|
||||
|
||||
|
@ -1721,7 +1721,7 @@ void iClass_ReadBlock(uint8_t *msg) {
|
|||
// select tag.
|
||||
uint32_t eof_time = 0;
|
||||
picopass_hdr hdr = {0};
|
||||
bool res = select_iclass_tag( (uint8_t *)&hdr, payload->use_credit_key, &eof_time);
|
||||
bool res = select_iclass_tag((uint8_t *)&hdr, payload->use_credit_key, &eof_time);
|
||||
if (res == false) {
|
||||
if (payload->send_reply) {
|
||||
response.isOK = res;
|
||||
|
@ -1794,7 +1794,7 @@ void iClass_Dump(uint8_t *msg) {
|
|||
// select tag.
|
||||
uint32_t eof_time = 0;
|
||||
picopass_hdr hdr = {0};
|
||||
bool res = select_iclass_tag( (uint8_t *)&hdr, req->use_credit_key, &eof_time);
|
||||
bool res = select_iclass_tag((uint8_t *)&hdr, req->use_credit_key, &eof_time);
|
||||
if (res == false) {
|
||||
if (req->send_reply) {
|
||||
reply_ng(CMD_HF_ICLASS_DUMP, PM3_ETIMEOUT, NULL, 0);
|
||||
|
@ -1912,7 +1912,7 @@ void iClass_WriteBlock(uint8_t *msg) {
|
|||
// select tag.
|
||||
uint32_t eof_time = 0;
|
||||
picopass_hdr hdr = {0};
|
||||
bool res = select_iclass_tag( (uint8_t *)&hdr, payload->req.use_credit_key, &eof_time);
|
||||
bool res = select_iclass_tag((uint8_t *)&hdr, payload->req.use_credit_key, &eof_time);
|
||||
if (res == false) {
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -187,12 +187,12 @@ static void CodeIso14443bAsTag(const uint8_t *cmd, int len) {
|
|||
|
||||
// Send EOF.
|
||||
// 10-11 ETU * 4 sample rate = ZEROS
|
||||
for(i = 0; i < 10; i++) {
|
||||
for (i = 0; i < 10; i++) {
|
||||
SEND4STUFFBIT(0);
|
||||
}
|
||||
|
||||
// why this?
|
||||
for(i = 0; i < 2; i++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
SEND4STUFFBIT(1);
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ static int GetIso14443bCommandFromReader(uint8_t *received, uint16_t *len) {
|
|||
while (BUTTON_PRESS() == false) {
|
||||
WDT_HIT();
|
||||
|
||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||
for (uint8_t mask = 0x80; mask != 0x00; mask >>= 1) {
|
||||
if (Handle14443bReaderUartBit(b & mask)) {
|
||||
|
@ -733,7 +733,7 @@ static RAMFUNC int Handle14443bTagSamplesDemod(uint16_t amplitude) {
|
|||
Demod.posCount = 0; // start of SOF sequence
|
||||
} else {
|
||||
// maximum length of TR1 = 200 1/fs
|
||||
if (Demod.posCount > 200 / 4){
|
||||
if (Demod.posCount > 200 / 4) {
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
}
|
||||
}
|
||||
|
@ -870,8 +870,8 @@ static int GetTagSamplesFor14443bDemod(int timeout) {
|
|||
// uint32_t dma_start_time;
|
||||
uint16_t *upTo = dma->buf;
|
||||
|
||||
for(;;) {
|
||||
uint16_t behindBy = ((uint16_t*)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
for (;;) {
|
||||
uint16_t behindBy = ((uint16_t *)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
|
||||
if (behindBy == 0) continue;
|
||||
|
||||
|
@ -904,7 +904,7 @@ static int GetTagSamplesFor14443bDemod(int timeout) {
|
|||
break;
|
||||
}
|
||||
|
||||
if(samples > timeout && Demod.state < DEMOD_PHASE_REF_TRAINING) {
|
||||
if (samples > timeout && Demod.state < DEMOD_PHASE_REF_TRAINING) {
|
||||
ret = -1;
|
||||
LED_C_OFF();
|
||||
break;
|
||||
|
@ -1419,7 +1419,7 @@ void RAMFUNC SniffIso14443b(void) {
|
|||
time_0 = GetCountSspClk();
|
||||
|
||||
// loop and listen
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
|
||||
int behindBy = (lastRxCounter - AT91C_BASE_PDC_SSC->PDC_RCR) & (DMA_BUFFER_SIZE - 1);
|
||||
if (behindBy > maxBehindBy) {
|
||||
|
|
|
@ -172,7 +172,7 @@ static void CodeIso15693AsReader256(uint8_t *cmd, int n) {
|
|||
ts->buf[++ts->max] = 0x81; //10000001
|
||||
|
||||
// data
|
||||
for(int i = 0; i < n; i++) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (int j = 0; j <= 255; j++) {
|
||||
if (cmd[i] == j) {
|
||||
tosend_stuffbit(0);
|
||||
|
@ -317,7 +317,7 @@ void TransmitTo15693Reader(const uint8_t *cmd, size_t len, uint32_t *start_time,
|
|||
|
||||
uint8_t cmd_bits = ((cmd[c] >> i) & 0x01) ? 0xff : 0x00;
|
||||
|
||||
for (int j = 0; j < (slow ? 4 : 1); ) {
|
||||
for (int j = 0; j < (slow ? 4 : 1);) {
|
||||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_TXRDY) {
|
||||
bits_to_send = bits_to_shift << (8 - shift_delay) | cmd_bits >> shift_delay;
|
||||
AT91C_BASE_SSC->SSC_THR = bits_to_send;
|
||||
|
@ -332,7 +332,7 @@ void TransmitTo15693Reader(const uint8_t *cmd, size_t len, uint32_t *start_time,
|
|||
// send the remaining bits, padded with 0:
|
||||
bits_to_send = bits_to_shift << (8 - shift_delay);
|
||||
if (bits_to_send) {
|
||||
for ( ; ; ) {
|
||||
for (; ;) {
|
||||
if (AT91C_BASE_SSC->SSC_SR & AT91C_SSC_TXRDY) {
|
||||
AT91C_BASE_SSC->SSC_THR = bits_to_send;
|
||||
break;
|
||||
|
@ -631,7 +631,7 @@ static void DecodeTagInit(DecodeTag_t *tag, uint8_t *data, uint16_t max_len) {
|
|||
/*
|
||||
* Receive and decode the tag response, also log to tracebuffer
|
||||
*/
|
||||
int GetIso15693AnswerFromTag(uint8_t* response, uint16_t max_len, uint16_t timeout, uint32_t *eof_time) {
|
||||
int GetIso15693AnswerFromTag(uint8_t *response, uint16_t max_len, uint16_t timeout, uint32_t *eof_time) {
|
||||
|
||||
int samples = 0, ret = 0;
|
||||
|
||||
|
@ -661,9 +661,9 @@ int GetIso15693AnswerFromTag(uint8_t* response, uint16_t max_len, uint16_t timeo
|
|||
uint32_t dma_start_time = 0;
|
||||
uint16_t *upTo = dma->buf;
|
||||
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
|
||||
volatile uint16_t behindBy = ((uint16_t*)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
volatile uint16_t behindBy = ((uint16_t *)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
if (behindBy == 0)
|
||||
continue;
|
||||
|
||||
|
@ -776,7 +776,7 @@ typedef struct {
|
|||
uint8_t *jam_search_string;
|
||||
} DecodeReader_t;
|
||||
|
||||
static void DecodeReaderInit(DecodeReader_t* reader, uint8_t *data, uint16_t max_len, uint8_t jam_search_len, uint8_t *jam_search_string) {
|
||||
static void DecodeReaderInit(DecodeReader_t *reader, uint8_t *data, uint16_t max_len, uint8_t jam_search_len, uint8_t *jam_search_string) {
|
||||
reader->output = data;
|
||||
reader->byteCountMax = max_len;
|
||||
reader->state = STATE_READER_UNSYNCD;
|
||||
|
@ -788,12 +788,12 @@ static void DecodeReaderInit(DecodeReader_t* reader, uint8_t *data, uint16_t max
|
|||
reader->jam_search_string = jam_search_string;
|
||||
}
|
||||
|
||||
static void DecodeReaderReset(DecodeReader_t* reader) {
|
||||
static void DecodeReaderReset(DecodeReader_t *reader) {
|
||||
reader->state = STATE_READER_UNSYNCD;
|
||||
}
|
||||
|
||||
//static inline __attribute__((always_inline))
|
||||
static int RAMFUNC Handle15693SampleFromReader(bool bit, DecodeReader_t *reader) {
|
||||
static int RAMFUNC Handle15693SampleFromReader(bool bit, DecodeReader_t *reader) {
|
||||
switch (reader->state) {
|
||||
case STATE_READER_UNSYNCD:
|
||||
// wait for unmodulated carrier
|
||||
|
@ -1098,7 +1098,7 @@ int GetIso15693CommandFromReader(uint8_t *received, size_t max_len, uint32_t *eo
|
|||
uint32_t dma_start_time = GetCountSspClk() & 0xfffffff8;
|
||||
|
||||
for (;;) {
|
||||
volatile uint16_t behindBy = ((uint8_t*)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
volatile uint16_t behindBy = ((uint8_t *)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
if (behindBy == 0) continue;
|
||||
|
||||
if (samples == 0) {
|
||||
|
@ -1192,8 +1192,8 @@ void AcquireRawAdcSamplesIso15693(void) {
|
|||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER | FPGA_HF_READER_SUBCARRIER_424_KHZ | FPGA_HF_READER_MODE_RECEIVE_AMPLITUDE);
|
||||
|
||||
for(int c = 0; c < 4000; ) {
|
||||
if(AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||
for (int c = 0; c < 4000;) {
|
||||
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||
uint16_t r = AT91C_BASE_SSC->SSC_RHR;
|
||||
dest[c++] = r >> 5;
|
||||
}
|
||||
|
@ -1252,7 +1252,7 @@ void SniffIso15693(uint8_t jam_search_len, uint8_t *jam_search_string) {
|
|||
|
||||
for (;;) {
|
||||
|
||||
volatile int behind_by = ((uint16_t*)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
volatile int behind_by = ((uint16_t *)AT91C_BASE_PDC_SSC->PDC_RPR - upTo) & (DMA_BUFFER_SIZE - 1);
|
||||
if (behind_by < 1) continue;
|
||||
|
||||
samples++;
|
||||
|
|
|
@ -31,7 +31,7 @@ void CodeIso15693AsTag(uint8_t *cmd, size_t len);
|
|||
void TransmitTo15693Reader(const uint8_t *cmd, size_t len, uint32_t *start_time, uint32_t slot_time, bool slow);
|
||||
int GetIso15693CommandFromReader(uint8_t *received, size_t max_len, uint32_t *eof_time);
|
||||
void TransmitTo15693Tag(const uint8_t *cmd, int len, uint32_t *start_time);
|
||||
int GetIso15693AnswerFromTag(uint8_t* response, uint16_t max_len, uint16_t timeout, uint32_t *eof_time);
|
||||
int GetIso15693AnswerFromTag(uint8_t *response, uint16_t max_len, uint16_t timeout, uint32_t *eof_time);
|
||||
|
||||
//void RecordRawAdcSamplesIso15693(void);
|
||||
void AcquireRawAdcSamplesIso15693(void);
|
||||
|
|
|
@ -238,9 +238,9 @@ void lf_finalize(void) {
|
|||
}
|
||||
|
||||
size_t lf_detect_field_drop(size_t max) {
|
||||
/*
|
||||
/*
|
||||
size_t periods = 0;
|
||||
// int16_t checked = 0;
|
||||
// int16_t checked = 0;
|
||||
|
||||
while (BUTTON_PRESS() == false) {
|
||||
|
||||
|
@ -271,7 +271,7 @@ size_t lf_detect_field_drop(size_t max) {
|
|||
if (periods == max) return 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -2601,12 +2601,12 @@ void Cotag(uint32_t arg0) {
|
|||
BigBuf_Clear_ext(false);
|
||||
|
||||
//send COTAG start pulse
|
||||
/*
|
||||
/*
|
||||
ON(740) OFF(2035)
|
||||
ON(3330) OFF(2035)
|
||||
ON(740) OFF(2035)
|
||||
ON(1000)
|
||||
*/
|
||||
*/
|
||||
|
||||
ON(800) OFF(2200)
|
||||
ON(3600) OFF(2200)
|
||||
|
|
|
@ -485,7 +485,7 @@ int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RD
|
|||
|
||||
read_from_spiffs((char *)linkdest, (uint8_t *)dst, size);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// BEWARE ! This function is DESTRUCTIVE as it will UPDATE an existing symlink
|
||||
// Since it creates a .lnk extension file it may be minor to mistake the order of arguments
|
||||
|
|
|
@ -157,20 +157,20 @@ void StartCountSspClk(void) {
|
|||
// synchronize the counter with the ssp_frame signal.
|
||||
// Note: FPGA must be in a FPGA mode with SSC transfer, otherwise SSC_FRAME and SSC_CLK signals would not be present
|
||||
//
|
||||
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_FRAME); // wait for ssp_frame to be low
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_FRAME)); // wait for ssp_frame to go high (start of frame)
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 1st ssp_clk after start of frame
|
||||
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 2nd ssp_clk after start of frame
|
||||
while (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_FRAME); // wait for ssp_frame to be low
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_FRAME)); // wait for ssp_frame to go high (start of frame)
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 1st ssp_clk after start of frame
|
||||
while (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 2nd ssp_clk after start of frame
|
||||
if ((AT91C_BASE_SSC->SSC_RFMR & SSC_FRAME_MODE_BITS_IN_WORD(32)) == SSC_FRAME_MODE_BITS_IN_WORD(16)) { // 16bit frame
|
||||
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 3rd ssp_clk after start of frame
|
||||
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 4th ssp_clk after start of frame
|
||||
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 5th ssp_clk after start of frame
|
||||
while(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while(!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 6th ssp_clk after start of frame
|
||||
while (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 3rd ssp_clk after start of frame
|
||||
while (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 4th ssp_clk after start of frame
|
||||
while (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 5th ssp_clk after start of frame
|
||||
while (AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK); // wait for ssp_clk to go low;
|
||||
while (!(AT91C_BASE_PIOA->PIO_PDSR & GPIO_SSC_CLK)); // wait for ssp_clk to go high; 6th ssp_clk after start of frame
|
||||
}
|
||||
|
||||
// note: up to now two ssp_clk rising edges have passed since the rising edge of ssp_frame
|
||||
|
|
|
@ -86,7 +86,7 @@ jint Console(JNIEnv *env, jobject instance, jstring cmd_) {
|
|||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
char *cmd = (char *) ((*env)->GetStringUTFChars(env, cmd_, 0));
|
||||
char *cmd = (char *)((*env)->GetStringUTFChars(env, cmd_, 0));
|
||||
int ret = CommandReceived(cmd);
|
||||
if (ret == 99) {
|
||||
// exit / quit
|
||||
|
@ -102,7 +102,7 @@ jint Console(JNIEnv *env, jobject instance, jstring cmd_) {
|
|||
* Is client running!
|
||||
* */
|
||||
jboolean IsClientRunning(JNIEnv *env, jobject instance) {
|
||||
return (jboolean) ((jboolean) conn.run);
|
||||
return (jboolean)((jboolean) conn.run);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -114,7 +114,7 @@ jboolean TestPm3(JNIEnv *env, jobject instance) {
|
|||
return false;
|
||||
}
|
||||
bool ret = (TestProxmark() == PM3_SUCCESS);
|
||||
return (jboolean) (ret);
|
||||
return (jboolean)(ret);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -385,7 +385,7 @@ static inline uint32_t countones(uint64_t a) {
|
|||
|
||||
}
|
||||
|
||||
const char * card_types[] = {
|
||||
const char *card_types[] = {
|
||||
"PicoPass 16K / 16", // 000
|
||||
"PicoPass 32K with current book 16K / 16", // 001
|
||||
"Unknown Card Type!", // 010
|
||||
|
@ -540,7 +540,7 @@ static void mem_app_config(const picopass_hdr *hdr) {
|
|||
}
|
||||
|
||||
PrintAndLogEx(INFO, " %u KBits/%u App Areas (%u bytes)", kb, app_areas, (app2_limit + 1) * 8);
|
||||
PrintAndLogEx(INFO, " AA1 blocks %u { 0x06 - 0x%02X (06 - %02d) }", app1_limit , app1_limit + 5, app1_limit + 5);
|
||||
PrintAndLogEx(INFO, " AA1 blocks %u { 0x06 - 0x%02X (06 - %02d) }", app1_limit, app1_limit + 5, app1_limit + 5);
|
||||
PrintAndLogEx(INFO, " AA2 blocks %u { 0x%02X - 0x%02X (%02d - %02d) }", app2_limit - app1_limit, app1_limit + 5 + 1, app2_limit, app1_limit + 5 + 1, app2_limit);
|
||||
|
||||
PrintAndLogEx(INFO, "------ " _CYAN_("KeyAccess") " ------");
|
||||
|
@ -594,7 +594,7 @@ static int CmdHFiClassSniff(const char *Cmd) {
|
|||
_YELLOW_("\thf iclass sniff -j") " -> jam e-purse updates\n"
|
||||
);
|
||||
|
||||
void* argtable[] = {
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("j", "jam", "Jam (prevent) e-purse updates"),
|
||||
arg_param_end
|
||||
|
@ -1510,7 +1510,7 @@ static bool select_and_auth(uint8_t *KEY, uint8_t *MAC, uint8_t *div_key, bool u
|
|||
};
|
||||
memcpy(payload.key, KEY, 8);
|
||||
|
||||
SendCommandNG(CMD_HF_ICLASS_AUTH, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_ICLASS_AUTH, (uint8_t *)&payload, sizeof(payload));
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
if (WaitForResponseTimeout(CMD_HF_ICLASS_AUTH, &resp, 2000) == 0) {
|
||||
|
@ -1682,7 +1682,7 @@ static int CmdHFiClassDump(const char *Cmd) {
|
|||
}
|
||||
|
||||
if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) {
|
||||
PrintAndLogEx(INFO, "Dumping all available memory, block 3 - %u (0x%02x)",app_limit1 , app_limit1);
|
||||
PrintAndLogEx(INFO, "Dumping all available memory, block 3 - %u (0x%02x)", app_limit1, app_limit1);
|
||||
if (auth) {
|
||||
PrintAndLogEx(INFO, "No keys needed, ignoring user supplied key");
|
||||
}
|
||||
|
@ -1713,7 +1713,7 @@ static int CmdHFiClassDump(const char *Cmd) {
|
|||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_ICLASS_DUMP, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_ICLASS_DUMP, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
while (true) {
|
||||
printf(".");
|
||||
|
@ -1759,14 +1759,14 @@ static int CmdHFiClassDump(const char *Cmd) {
|
|||
|
||||
if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) {
|
||||
// all memory available
|
||||
memcpy(tag_data + (8 * 3), tempbuf + (8 * 3), (blocks_read * 8) );
|
||||
memcpy(tag_data + (8 * 3), tempbuf + (8 * 3), (blocks_read * 8));
|
||||
} else {
|
||||
// div key KD
|
||||
memcpy(tag_data + (8 * 3), tempbuf + (8 * 3), 8);
|
||||
// AIA data
|
||||
memcpy(tag_data + (8 * 5), tempbuf + (8 * 5), 8);
|
||||
// AA1 data
|
||||
memcpy(tag_data + (8 * 6), tempbuf + (8 * 6), (blocks_read * 8) );
|
||||
memcpy(tag_data + (8 * 6), tempbuf + (8 * 6), (blocks_read * 8));
|
||||
}
|
||||
|
||||
uint16_t bytes_got = (app_limit1 + 1) * 8;
|
||||
|
@ -1785,7 +1785,7 @@ static int CmdHFiClassDump(const char *Cmd) {
|
|||
payload.req.do_auth = true;
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_ICLASS_DUMP, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_ICLASS_DUMP, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
while (true) {
|
||||
printf(".");
|
||||
|
@ -1830,7 +1830,7 @@ static int CmdHFiClassDump(const char *Cmd) {
|
|||
memcpy(tag_data + (8 * 4), tempbuf + (8 * 4), 8);
|
||||
|
||||
// AA2 data
|
||||
memcpy(tag_data + (8 * (app_limit1 + 1)), tempbuf + (8 * (app_limit1 + 1)), (blocks_read * 8) );
|
||||
memcpy(tag_data + (8 * (app_limit1 + 1)), tempbuf + (8 * (app_limit1 + 1)), (blocks_read * 8));
|
||||
|
||||
bytes_got = (blocks_read * 8);
|
||||
|
||||
|
@ -1867,7 +1867,7 @@ write_dump:
|
|||
}
|
||||
|
||||
static int iclass_write_block(uint8_t blockno, uint8_t *bldata, uint8_t *KEY, bool use_credit_key, bool elite, bool rawkey, bool verbose) {
|
||||
/*
|
||||
/*
|
||||
uint8_t MAC[4] = {0x00, 0x00, 0x00, 0x00};
|
||||
uint8_t div_key[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
if (select_and_auth(KEY, MAC, div_key, use_credit_key, elite, rawkey, verbose) == false) {
|
||||
|
@ -1886,8 +1886,8 @@ static int iclass_write_block(uint8_t blockno, uint8_t *bldata, uint8_t *KEY, bo
|
|||
memcpy(payload.data + 8, MAC, 4);
|
||||
|
||||
|
||||
//
|
||||
typedef struct {
|
||||
//
|
||||
typedef struct {
|
||||
uint8_t key[8];
|
||||
bool use_raw;
|
||||
bool use_elite;
|
||||
|
@ -1895,17 +1895,17 @@ typedef struct {
|
|||
bool send_reply;
|
||||
bool do_auth;
|
||||
uint8_t blockno;
|
||||
} PACKED iclass_auth_req_t;
|
||||
} PACKED iclass_auth_req_t;
|
||||
|
||||
// iCLASS write block request data structure
|
||||
typedef struct {
|
||||
// iCLASS write block request data structure
|
||||
typedef struct {
|
||||
iclass_auth_req_t req;
|
||||
uint8_t data[8];
|
||||
} PACKED iclass_writeblock_req_t;
|
||||
} PACKED iclass_writeblock_req_t;
|
||||
|
||||
|
||||
*/
|
||||
iclass_writeblock_req_t payload = {
|
||||
*/
|
||||
iclass_writeblock_req_t payload = {
|
||||
.req.use_raw = rawkey,
|
||||
.req.use_elite = elite,
|
||||
.req.use_credit_key = use_credit_key,
|
||||
|
@ -2243,7 +2243,7 @@ static int iclass_read_block(uint8_t *KEY, uint8_t blockno, uint8_t keyType, boo
|
|||
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_ICLASS_READBL, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_ICLASS_READBL, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_ICLASS_READBL, &resp, 2000) == false) {
|
||||
if (verbose) PrintAndLogEx(WARNING, "Command execute timeout");
|
||||
|
@ -2507,8 +2507,8 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e
|
|||
uint8_t *blk = iclass_dump + (i * 8);
|
||||
|
||||
bool bl_lock = false;
|
||||
if ( ro == false ) {
|
||||
switch(i) {
|
||||
if (ro == false) {
|
||||
switch (i) {
|
||||
case 12: {
|
||||
bl_lock = ((lock & 0x40) == 0);
|
||||
break;
|
||||
|
@ -3484,16 +3484,16 @@ int CmdHFiClass(const char *Cmd) {
|
|||
}
|
||||
|
||||
//static void test_credential_type(void) {
|
||||
// need AA1 key
|
||||
// Block 5 -> tells if its a legacy or SIO, also tells which key to use.
|
||||
// need AA1 key
|
||||
// Block 5 -> tells if its a legacy or SIO, also tells which key to use.
|
||||
|
||||
// tech | blocks used | desc | num of payloads
|
||||
// -------+-----------------------+-----------------------------------+------
|
||||
// legacy | 6,7,8,9 | AA!, Access control payload | 1
|
||||
// SE | 6,7,8,9,10,11,12 | AA1, Secure identity object (SIO) | 1
|
||||
// SR | 6,7,8,9, | AA1, Access control payload | 2
|
||||
// | 10,11,12,13,14,15,16 | AA1, Secure identity object (SIO) |
|
||||
// SEOS | | |
|
||||
// tech | blocks used | desc | num of payloads
|
||||
// -------+-----------------------+-----------------------------------+------
|
||||
// legacy | 6,7,8,9 | AA!, Access control payload | 1
|
||||
// SE | 6,7,8,9,10,11,12 | AA1, Secure identity object (SIO) | 1
|
||||
// SR | 6,7,8,9, | AA1, Access control payload | 2
|
||||
// | 10,11,12,13,14,15,16 | AA1, Secure identity object (SIO) |
|
||||
// SEOS | | |
|
||||
//}
|
||||
|
||||
int info_iclass(void) {
|
||||
|
|
|
@ -1859,7 +1859,7 @@ static int CmdHF14AMfNestedHard(const char *Cmd) {
|
|||
trgkey[0], trgkey[1], trgkey[2], trgkey[3], trgkey[4], trgkey[5],
|
||||
know_target_key ? "" : " (not set)"
|
||||
);
|
||||
PrintAndLogEx(INFO , "File action: %s, Slow: %s, Tests: %d ",
|
||||
PrintAndLogEx(INFO, "File action: %s, Slow: %s, Tests: %d ",
|
||||
nonce_file_write ? "write" : nonce_file_read ? "read" : "none",
|
||||
slow ? "Yes" : "No",
|
||||
tests);
|
||||
|
|
|
@ -1864,7 +1864,7 @@ static int getKeySettings(uint8_t *aid) {
|
|||
// KEY Settings - AMK
|
||||
uint8_t num_keys = 0;
|
||||
uint8_t key_setting = 0;
|
||||
mifare_des_authalgo_t algo=MFDES_ALGO_DES;
|
||||
mifare_des_authalgo_t algo = MFDES_ALGO_DES;
|
||||
res = key_setting_to_algo(aid, &key_setting, &algo, &num_keys);
|
||||
|
||||
if (res == PM3_SUCCESS) {
|
||||
|
@ -1916,7 +1916,7 @@ static int getKeySettings(uint8_t *aid) {
|
|||
// KEY Settings - AMK
|
||||
uint8_t num_keys = 0;
|
||||
uint8_t key_setting = 0;
|
||||
mifare_des_authalgo_t algo=MFDES_ALGO_DES;
|
||||
mifare_des_authalgo_t algo = MFDES_ALGO_DES;
|
||||
res = key_setting_to_algo(aid, &key_setting, &algo, &num_keys);
|
||||
if (res == PM3_SUCCESS) {
|
||||
desfire_print_keysetting(key_setting, num_keys, algo);
|
||||
|
|
|
@ -111,7 +111,7 @@ static int usage_lf_em410x_brute(void) {
|
|||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 410x_brute ids.txt"));
|
||||
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 410x_brute ids.txt c 32"));
|
||||
PrintAndLogEx(NORMAL, _YELLOW_( " lf em 410x_brute ids.txt d 3000"));
|
||||
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 410x_brute ids.txt d 3000"));
|
||||
PrintAndLogEx(NORMAL, _YELLOW_(" lf em 410x_brute ids.txt d 3000 c 32"));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ static int CmdEM410xWrite(const char *Cmd) {
|
|||
|
||||
PacketResponseNG resp;
|
||||
WaitForResponse(CMD_LF_EM410X_WRITE, &resp);
|
||||
switch(resp.status) {
|
||||
switch (resp.status) {
|
||||
case PM3_SUCCESS: {
|
||||
PrintAndLogEx(SUCCESS, "Done");
|
||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 410x_read`") " to verify");
|
||||
|
|
|
@ -114,8 +114,8 @@ static void prepare_result(const uint8_t *byte, int fwr, int lwr, em4x50_word_t
|
|||
c[j] = 0;
|
||||
|
||||
for (int j = 0; j < 4; j++) {
|
||||
words[i].byte[j] = byte[i*7+j];
|
||||
words[i].row_parity[j] = (byte[i*7+4] >> (3-j)) & 1;
|
||||
words[i].byte[j] = byte[i * 7 + j];
|
||||
words[i].row_parity[j] = (byte[i * 7 + 4] >> (3 - j)) & 1;
|
||||
|
||||
// collect parities
|
||||
p = 0;
|
||||
|
@ -126,7 +126,7 @@ static void prepare_result(const uint8_t *byte, int fwr, int lwr, em4x50_word_t
|
|||
p ^= (words[i].byte[j] >> k) & 1;
|
||||
|
||||
// column parity
|
||||
c[k] ^= (words[i].byte[j] >> (7-k)) & 1;
|
||||
c[k] ^= (words[i].byte[j] >> (7 - k)) & 1;
|
||||
}
|
||||
|
||||
// check row parities
|
||||
|
@ -137,17 +137,17 @@ static void prepare_result(const uint8_t *byte, int fwr, int lwr, em4x50_word_t
|
|||
}
|
||||
|
||||
// check column parities
|
||||
words[i].col_parity = byte[i*7+5];
|
||||
words[i].col_parity = byte[i * 7 + 5];
|
||||
|
||||
for (int j = 0; j < 8; j++) {
|
||||
words[i].cparity[j] = (((words[i].col_parity >> (7-j)) & 1) == c[j]) ? true : false;
|
||||
words[i].cparity[j] = (((words[i].col_parity >> (7 - j)) & 1) == c[j]) ? true : false;
|
||||
|
||||
if (!words[i].cparity[j])
|
||||
words[i].parity = false;
|
||||
}
|
||||
|
||||
// check stop bit
|
||||
words[i].stopbit = byte[i*7+6] & 1;
|
||||
words[i].stopbit = byte[i * 7 + 6] & 1;
|
||||
|
||||
if (words[i].stopbit == 1)
|
||||
words[i].stopparity = false;
|
||||
|
@ -166,7 +166,7 @@ static void print_result(const em4x50_word_t *words, int fwr, int lwr) {
|
|||
for (int i = fwr; i <= lwr; i++) {
|
||||
|
||||
char s[50] = {0};
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case EM4X50_DEVICE_PASSWORD:
|
||||
sprintf(s, _YELLOW_("password, write only"));
|
||||
break;
|
||||
|
@ -233,7 +233,7 @@ static void print_info_result(uint8_t *data, bool verbose) {
|
|||
|
||||
PrintAndLogEx(INFO, "first word read %3i", fwr);
|
||||
PrintAndLogEx(INFO, "last word read %3i", lwr);
|
||||
PrintAndLogEx(INFO, "password check %3s", (bpwc) ? _RED_("on"): _GREEN_("off"));
|
||||
PrintAndLogEx(INFO, "password check %3s", (bpwc) ? _RED_("on") : _GREEN_("off"));
|
||||
PrintAndLogEx(INFO, "read after write %3s", (braw) ? "on" : "off");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--------- " _CYAN_("Protection") " ---------");
|
||||
|
@ -428,7 +428,7 @@ static void print_write_password_result(PacketResponseNG *resp, const em4x50_dat
|
|||
sprintf(pstring, "\n writing new password " _GREEN_("ok"));
|
||||
strcat(string, pstring);
|
||||
|
||||
PrintAndLogEx(NORMAL,"%s\n", string);
|
||||
PrintAndLogEx(NORMAL, "%s\n", string);
|
||||
}
|
||||
|
||||
int CmdEM4x50WritePassword(const char *Cmd) {
|
||||
|
@ -493,7 +493,7 @@ int CmdEM4x50WritePassword(const char *Cmd) {
|
|||
if (success)
|
||||
print_write_password_result(&resp, &etd);
|
||||
else
|
||||
PrintAndLogEx(NORMAL,"\nwriting password " _RED_("failed") "\n");
|
||||
PrintAndLogEx(NORMAL, "\nwriting password " _RED_("failed") "\n");
|
||||
|
||||
return (success) ? PM3_SUCCESS : PM3_ESOFT;
|
||||
}
|
||||
|
@ -675,8 +675,8 @@ int CmdEM4x50Dump(const char *Cmd) {
|
|||
}
|
||||
|
||||
uint8_t data[EM4X50_NO_WORDS * 4] = {0};
|
||||
for (int i=0; i < EM4X50_NO_WORDS; i++) {
|
||||
memcpy(data + (i*4), words[i].byte, 4);
|
||||
for (int i = 0; i < EM4X50_NO_WORDS; i++) {
|
||||
memcpy(data + (i * 4), words[i].byte, 4);
|
||||
}
|
||||
|
||||
// saveFileEML will add .eml extension to filename
|
||||
|
@ -724,7 +724,7 @@ int CmdEM4x50Wipe(const char *Cmd) {
|
|||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_EM4X50_WIPE, (uint8_t *)&etd, sizeof(etd));
|
||||
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2*TIMEOUT)) {
|
||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2 * TIMEOUT)) {
|
||||
PrintAndLogEx(WARNING, "\ntimeout while waiting for reply.\n");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
@ -732,9 +732,9 @@ int CmdEM4x50Wipe(const char *Cmd) {
|
|||
// print response
|
||||
bool isOK = resp.status;
|
||||
if (isOK) {
|
||||
PrintAndLogEx(SUCCESS,"\nwiping data " _GREEN_("ok") "\n");
|
||||
PrintAndLogEx(SUCCESS, "\nwiping data " _GREEN_("ok") "\n");
|
||||
} else {
|
||||
PrintAndLogEx(FAILED,"\nwiping data " _RED_("failed") "\n");
|
||||
PrintAndLogEx(FAILED, "\nwiping data " _RED_("failed") "\n");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,7 @@ static int CmdIOProxDemod(const char *Cmd) {
|
|||
char crc_str[36] = {0};
|
||||
|
||||
if (crc == calccrc) {
|
||||
snprintf(crc_str, sizeof(crc_str), "(" _GREEN_("ok") ")" );
|
||||
snprintf(crc_str, sizeof(crc_str), "(" _GREEN_("ok") ")");
|
||||
} else {
|
||||
snprintf(crc_str, sizeof(crc_str), "(" _RED_("fail") ") 0x%02X != 0x%02X", crc, calccrc);
|
||||
retval = PM3_ESOFT;
|
||||
|
|
|
@ -190,7 +190,7 @@ int demodKeri(void) {
|
|||
Might be a hash of FC & CN to generate Internal ID
|
||||
*/
|
||||
|
||||
PrintAndLogEx(SUCCESS, "KERI - Internal ID: " _GREEN_("%u") ", Raw: %08X%08X" , ID, raw1, raw2);
|
||||
PrintAndLogEx(SUCCESS, "KERI - Internal ID: " _GREEN_("%u") ", Raw: %08X%08X", ID, raw1, raw2);
|
||||
/*
|
||||
Descramble Data.
|
||||
*/
|
||||
|
|
|
@ -64,7 +64,7 @@ const uint8_t paradox_lut[] = {
|
|||
0x9F, 0xED, 0x7D, 0x59, 0x22, 0x84, 0x21, 0x4E,
|
||||
0x39, 0x48, 0x12, 0x88, 0x53, 0xDE, 0xBB, 0xE4,
|
||||
0xB4, 0x2D, 0x4D, 0x55, 0xCA, 0xBE, 0xA3, 0xE2
|
||||
};
|
||||
};
|
||||
// FC:108, Card01827
|
||||
// 00000000 01101100 00000111 00100011
|
||||
// hex(0xED xor 0x7D xor 0x22 xor 0x84 xor 0xDE xor 0xBB xor 0xE4 xor 0x4D xor 0xA3 xor 0xE2 xor 0x47) 0xFC
|
||||
|
@ -163,10 +163,10 @@ int demodParadox(void) {
|
|||
// checksum?
|
||||
uint8_t calc_chksum = 0x47;
|
||||
uint8_t pos = 0;
|
||||
for(uint8_t i = 0; i < 8; i++ ) {
|
||||
for (uint8_t i = 0; i < 8; i++) {
|
||||
|
||||
uint8_t ice = rawhex[i+1];
|
||||
for(uint8_t j = 0x80; j > 0; j >>= 2) {
|
||||
uint8_t ice = rawhex[i + 1];
|
||||
for (uint8_t j = 0x80; j > 0; j >>= 2) {
|
||||
|
||||
if (ice & j) {
|
||||
calc_chksum ^= paradox_lut[pos];
|
||||
|
|
|
@ -249,7 +249,7 @@ static int CmdPref(const char *Cmd) {
|
|||
|
||||
static command_t CommandTable[] = {
|
||||
|
||||
{"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"},
|
||||
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"},
|
||||
|
||||
{"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"},
|
||||
{"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"},
|
||||
|
@ -264,7 +264,7 @@ static command_t CommandTable[] = {
|
|||
{"trace", CmdTrace, AlwaysAvailable, "{ Trace manipulation... }"},
|
||||
{"usart", CmdUsart, IfPm3FpcUsartFromUsb, "{ USART commands... }"},
|
||||
{"wiegand", CmdWiegand, AlwaysAvailable, "{ Wiegand format manipulation... }"},
|
||||
{"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"},
|
||||
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"},
|
||||
{"auto", CmdAuto, IfPm3Present, "Automated detection process for unknown tags"},
|
||||
{"help", CmdHelp, AlwaysAvailable, "This help. Use " _YELLOW_("'<command> help'") " for details of a particular command."},
|
||||
{"hints", CmdHints, AlwaysAvailable, "Turn hints on / off"},
|
||||
|
|
|
@ -413,8 +413,8 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
|||
|
||||
if (use_us) {
|
||||
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |%-72s | %s| %s",
|
||||
(float)time1/13.56,
|
||||
(float)time2/13.56,
|
||||
(float)time1 / 13.56,
|
||||
(float)time2 / 13.56,
|
||||
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
|
||||
line[j],
|
||||
(j == num_lines - 1) ? crc : " ",
|
||||
|
|
|
@ -101,7 +101,7 @@ uint8_t GetPinSize(uint8_t *src) {
|
|||
memcpy(c + 5, src, 8);
|
||||
ExchangeAPDUSC(true, c, sizeof(c), false, true, resp, sizeof(resp), &resp_len);
|
||||
|
||||
if ( resp[resp_len - 2] == 0x90 && resp[resp_len - 1] == 0x00) {
|
||||
if (resp[resp_len - 2] == 0x90 && resp[resp_len - 1] == 0x00) {
|
||||
return resp[8];
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue