Merge branch 'master' into dev_4x50_standalone
update
This commit is contained in:
@@ -191,7 +191,7 @@ void RunMod(void) {
|
||||
read_successful = false;
|
||||
break;
|
||||
}
|
||||
// We're skipping 14 blocks (56 bytes) here, as that "[...] has version/signature/counter data here" according to comments on hf_mfu_dumptoemulator
|
||||
// We're skipping 14 blocks (56 bytes) here, as that "[...] has version/signature/counter data here" according to comments on data_mfu_bin2eml
|
||||
// When converting a bin, it's almost all 0 other than one 0x0F byte, and functionality seems to be unaffected if that byte is set to 0x00.
|
||||
emlSetMem_xt(dataout, 14 + i, 1, 4);
|
||||
Dbhexdump(4, dataout, 0);
|
||||
|
||||
@@ -52,8 +52,8 @@ static void fill_buff(uint8_t bit) {
|
||||
static void construct_EM410x_emul(uint64_t id) {
|
||||
|
||||
int i, j;
|
||||
int binary[4] = {0,0,0,0};
|
||||
int parity[4] = {0,0,0,0};
|
||||
int binary[4] = {0, 0, 0, 0};
|
||||
int parity[4] = {0, 0, 0, 0};
|
||||
buflen = 0;
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
|
||||
@@ -100,8 +100,8 @@ static void fill_buff(uint8_t bit) {
|
||||
|
||||
static void construct_EM410x_emul(uint64_t id) {
|
||||
int i, j;
|
||||
int binary[4] = {0,0,0,0};
|
||||
int parity[4] = {0,0,0,0};
|
||||
int binary[4] = {0, 0, 0, 0};
|
||||
int parity[4] = {0, 0, 0, 0};
|
||||
buflen = 0;
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
|
||||
@@ -67,8 +67,8 @@ static void fill_buff(uint8_t bit) {
|
||||
static void construct_EM410x_emul(uint64_t id) {
|
||||
|
||||
int i, j;
|
||||
int binary[4] = {0,0,0,0};
|
||||
int parity[4] = {0,0,0,0};
|
||||
int binary[4] = {0, 0, 0, 0};
|
||||
int parity[4] = {0, 0, 0, 0};
|
||||
buflen = 0;
|
||||
|
||||
for (i = 0; i < 9; i++)
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "crc16.h"
|
||||
|
||||
#ifdef WITH_LCD
|
||||
#include "LCD.h"
|
||||
#include "LCD_disabled.h"
|
||||
#endif
|
||||
|
||||
#ifdef WITH_SMARTCARD
|
||||
|
||||
@@ -1489,7 +1489,7 @@ bool authenticate_iclass_tag(iclass_auth_req_t *payload, picopass_hdr *hdr, uint
|
||||
memcpy(cmd_check + 1, payload->key, 8);
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
uint8_t div_key[8] = {0};
|
||||
if (payload->use_raw)
|
||||
memcpy(div_key, payload->key, 8);
|
||||
@@ -1885,7 +1885,7 @@ void iClass_WriteBlock(uint8_t *msg) {
|
||||
res = false;
|
||||
switch_off();
|
||||
if (payload->req.send_reply)
|
||||
reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_ETEAROFF, (uint8_t*)&res, sizeof(uint8_t));
|
||||
reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_ETEAROFF, (uint8_t *)&res, sizeof(uint8_t));
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -1927,7 +1927,7 @@ out:
|
||||
switch_off();
|
||||
|
||||
if (payload->req.send_reply)
|
||||
reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_SUCCESS, (uint8_t*)&res, sizeof(uint8_t));
|
||||
reply_ng(CMD_HF_ICLASS_WRITEBL, PM3_SUCCESS, (uint8_t *)&res, sizeof(uint8_t));
|
||||
}
|
||||
|
||||
void iClass_Restore(iclass_restore_req_t *msg) {
|
||||
|
||||
@@ -916,18 +916,25 @@ bool GetIso14443aCommandFromReader(uint8_t *received, uint8_t *par, int *len) {
|
||||
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||
(void)b;
|
||||
|
||||
uint16_t check = 0;
|
||||
|
||||
uint8_t flip = 0;
|
||||
uint16_t checker = 0;
|
||||
for (;;) {
|
||||
if (check == 4000) {
|
||||
// if (BUTTON_PRESS() || data_available())
|
||||
WDT_HIT();
|
||||
if (flip == 2) {
|
||||
if (data_available())
|
||||
return false;
|
||||
|
||||
flip = 0;
|
||||
}
|
||||
|
||||
if (checker >= 4000) {
|
||||
if (BUTTON_PRESS())
|
||||
return false;
|
||||
|
||||
check = 0;
|
||||
WDT_HIT();
|
||||
flip++;
|
||||
checker = 0;
|
||||
}
|
||||
++check;
|
||||
++checker;
|
||||
|
||||
if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) {
|
||||
b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
|
||||
@@ -1335,7 +1342,6 @@ void SimulateIso14443aTag(uint8_t tagType, uint8_t flags, uint8_t *data, uint8_t
|
||||
LED_A_ON();
|
||||
|
||||
// main loop
|
||||
//for (;;) {
|
||||
bool finished = false;
|
||||
bool button_pushed = BUTTON_PRESS();
|
||||
while (!button_pushed && !finished) {
|
||||
|
||||
@@ -1009,7 +1009,7 @@ void CmdFSKsimTAGEx(uint8_t fchigh, uint8_t fclow, uint8_t separator, uint8_t cl
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
Dbprintf("Simulating with fcHigh: %d, fcLow: %d, clk: %d, STT: %d, n: %d", fchigh, fclow, clk, separator, n);
|
||||
Dbprintf("FSK simulating with rf/%d, fc high %d, fc low %d, STT %d, n %d", clk, fchigh, fclow, separator, n);
|
||||
|
||||
if (ledcontrol) LED_A_ON();
|
||||
SimulateTagLowFrequencyEx(n, 0, ledcontrol, numcycles);
|
||||
@@ -1122,10 +1122,10 @@ void CmdASKsimTAG(uint8_t encoding, uint8_t invert, uint8_t separator, uint8_t c
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
Dbprintf("Simulating with clk: %d, invert: %d, encoding: %s (%d), separator: %d, n: %d"
|
||||
Dbprintf("ASK simulating with rf/%d, invert %d, encoding %s (%d), separator %d, n %d"
|
||||
, clk
|
||||
, invert
|
||||
, (encoding == 2) ? "BI" : (encoding == 1) ? "ASK" : "RAW"
|
||||
, (encoding == 2) ? "ASK/BI" : (encoding == 1) ? "ASK/MAN" : "RAW/MAN"
|
||||
, encoding
|
||||
, separator
|
||||
, n
|
||||
@@ -1176,7 +1176,7 @@ void CmdPSKsimTAG(uint8_t carrier, uint8_t invert, uint8_t clk, uint16_t size, u
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
Dbprintf("Simulating with Carrier: %d, clk: %d, invert: %d, n: %d", carrier, clk, invert, n);
|
||||
Dbprintf("PSK simulating with rf/%d, fc/%d, invert %d, n %d", clk, carrier, invert, n);
|
||||
|
||||
if (ledcontrol) LED_A_ON();
|
||||
SimulateTagLowFrequency(n, 0, ledcontrol);
|
||||
@@ -1220,7 +1220,7 @@ void CmdNRZsimTAG(uint8_t invert, uint8_t separator, uint8_t clk, uint16_t size,
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
Dbprintf("Simulating with clk: %d, invert: %d, separator: %d, n: %d"
|
||||
Dbprintf("NRZ simulating with rf/%d, invert %d, separator %d, n %d"
|
||||
, clk
|
||||
, invert
|
||||
, separator
|
||||
@@ -1251,20 +1251,13 @@ int lf_hid_watch(int findone, uint32_t *high, uint32_t *low) {
|
||||
BigBuf_Clear_keep_EM();
|
||||
|
||||
int res = PM3_SUCCESS;
|
||||
uint16_t interval = 0;
|
||||
while (BUTTON_PRESS() == false) {
|
||||
for (;;) {
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
// cancel w usb command.
|
||||
if (interval == 4000) {
|
||||
if (data_available()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
interval = 0;
|
||||
} else {
|
||||
interval++;
|
||||
if (data_available() || BUTTON_PRESS()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
DoAcquisition_default(-1, false);
|
||||
@@ -1360,20 +1353,13 @@ int lf_awid_watch(int findone, uint32_t *high, uint32_t *low) {
|
||||
LFSetupFPGAForADC(LF_DIVISOR_125, true);
|
||||
|
||||
int res = PM3_SUCCESS;
|
||||
uint16_t interval = 0;
|
||||
while (BUTTON_PRESS() == false) {
|
||||
for (;;) {
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
// cancel w usb command.
|
||||
if (interval == 4000) {
|
||||
if (data_available()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
interval = 0;
|
||||
} else {
|
||||
interval++;
|
||||
if (data_available() || BUTTON_PRESS()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
DoAcquisition_default(-1, false);
|
||||
@@ -1465,19 +1451,12 @@ int lf_em410x_watch(int findone, uint32_t *high, uint64_t *low) {
|
||||
LFSetupFPGAForADC(LF_DIVISOR_125, true);
|
||||
|
||||
int res = PM3_SUCCESS;
|
||||
uint16_t interval = 0;
|
||||
while (BUTTON_PRESS() == false) {
|
||||
for (;;) {
|
||||
WDT_HIT();
|
||||
|
||||
// cancel w usb command.
|
||||
if (interval == 4000) {
|
||||
if (data_available()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
interval = 0;
|
||||
} else {
|
||||
interval++;
|
||||
if (data_available() || BUTTON_PRESS()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
DoAcquisition_default(-1, false);
|
||||
@@ -1541,20 +1520,13 @@ int lf_io_watch(int findone, uint32_t *high, uint32_t *low) {
|
||||
LFSetupFPGAForADC(LF_DIVISOR_125, true);
|
||||
|
||||
int res = PM3_SUCCESS;
|
||||
uint16_t interval = 0;
|
||||
while (BUTTON_PRESS() == false) {
|
||||
for (;;) {
|
||||
|
||||
WDT_HIT();
|
||||
|
||||
// cancel w usb command.
|
||||
if (interval == 4000) {
|
||||
if (data_available()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
interval = 0;
|
||||
} else {
|
||||
interval++;
|
||||
if (data_available() || BUTTON_PRESS()) {
|
||||
res = PM3_EOPABORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
DoAcquisition_default(-1, false);
|
||||
|
||||
@@ -73,11 +73,11 @@ void printSamples(void) {
|
||||
void setSamplingConfig(sample_config *sc) {
|
||||
|
||||
// decimation (1-8) how many bits of adc sample value to save
|
||||
if (sc->decimation > 0 && sc->decimation < 8)
|
||||
if (sc->decimation > 0 && sc->decimation < 9)
|
||||
config.decimation = sc->decimation;
|
||||
|
||||
// bits per sample (1-8)
|
||||
if (sc->bits_per_sample > 0 && sc->bits_per_sample < 8)
|
||||
if (sc->bits_per_sample > 0 && sc->bits_per_sample < 9)
|
||||
config.bits_per_sample = sc->bits_per_sample;
|
||||
|
||||
//
|
||||
|
||||
@@ -68,7 +68,7 @@ uint8_t mf_crypto1_encrypt4bit(struct Crypto1State *pcs, uint8_t data) {
|
||||
|
||||
// send X byte basic commands
|
||||
int mifare_sendcmd(uint8_t cmd, uint8_t *data, uint8_t data_size, uint8_t *answer, uint8_t *answer_parity, uint32_t *timing) {
|
||||
|
||||
|
||||
uint8_t dcmd[data_size + 3];
|
||||
dcmd[0] = cmd;
|
||||
if (data_size > 0)
|
||||
|
||||
Reference in New Issue
Block a user