Merge branch 'master' into experimental_varlen2

* master: (33 commits)
  unified Proxmark3 text
  removed
  more colors
  rearranged banner output and messages
  textual
  revert
  revert
  revert
  style spaces
  fix fake com port
  style
  style
  styles
  not null?
  style
  style
  style
  style
  style
  style
  ...
This commit is contained in:
Philippe Teuwen
2019-04-16 20:58:58 +02:00
34 changed files with 148 additions and 177 deletions

View File

@@ -376,6 +376,7 @@ void printUSBSpeed(void) {
uint32_t bytes_transferred = 0;
LED_B_ON();
while (end_time < start_time + USB_SPEED_TEST_MIN_TIME) {
cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, 0, USB_CMD_DATA_SIZE, 0, test_data, USB_CMD_DATA_SIZE);
end_time = GetTickCount();

View File

@@ -391,6 +391,7 @@ bool WaitForFelicaReply(uint16_t maxbytes) {
// clear RXRDY:
uint8_t b = (uint8_t)AT91C_BASE_SSC->SSC_RHR;
(void)b;
uint32_t timeout = iso18092_get_timeout();
for (;;) {
@@ -481,7 +482,7 @@ void felica_sendraw(UsbCommand *c) {
felica_command_t param = c->arg[0];
size_t len = c->arg[1] & 0xffff;
uint8_t *cmd = c->d.asBytes;
uint32_t arg0 = 0;
uint32_t arg0;
felica_card_select_t card;
@@ -519,7 +520,6 @@ void felica_sendraw(UsbCommand *c) {
// Don't append crc on empty bytearray...
if (len > 0) {
AddCrc(buf, len);
len += 2;
}
}

View File

@@ -451,23 +451,23 @@ void FpgaWriteConfWord(uint8_t v) {
void SetAdcMuxFor(uint32_t whichGpio) {
#ifndef WITH_FPC
// When compiled without FPC support
AT91C_BASE_PIOA->PIO_OER =
GPIO_MUXSEL_HIPKD |
GPIO_MUXSEL_LOPKD |
GPIO_MUXSEL_LORAW |
GPIO_MUXSEL_HIRAW;
// When compiled without FPC support
AT91C_BASE_PIOA->PIO_OER =
GPIO_MUXSEL_HIPKD |
GPIO_MUXSEL_LOPKD |
GPIO_MUXSEL_LORAW |
GPIO_MUXSEL_HIRAW;
AT91C_BASE_PIOA->PIO_PER =
GPIO_MUXSEL_HIPKD |
GPIO_MUXSEL_LOPKD |
GPIO_MUXSEL_LORAW |
GPIO_MUXSEL_HIRAW;
AT91C_BASE_PIOA->PIO_PER =
GPIO_MUXSEL_HIPKD |
GPIO_MUXSEL_LOPKD |
GPIO_MUXSEL_LORAW |
GPIO_MUXSEL_HIRAW;
LOW(GPIO_MUXSEL_HIPKD);
LOW(GPIO_MUXSEL_LOPKD);
LOW(GPIO_MUXSEL_HIRAW);
LOW(GPIO_MUXSEL_LORAW);
LOW(GPIO_MUXSEL_HIPKD);
LOW(GPIO_MUXSEL_LOPKD);
LOW(GPIO_MUXSEL_HIRAW);
LOW(GPIO_MUXSEL_LORAW);
#else
// FPC serial uses HIRAW/LOWRAW pins, so they are excluded here.

View File

@@ -647,10 +647,10 @@ static void hitagS_handle_reader_command(uint8_t *rx, const size_t rxlen,
static int hitagS_handle_tag_auth(hitag_function htf, uint64_t key, uint64_t NrAr, uint8_t *rx, const size_t rxlen, uint8_t *tx, size_t *txlen) {
uint8_t rx_air[HITAG_FRAME_LEN];
int response_bit[200];
int i, j, z, k;
int i, j, z;
unsigned char mask = 1;
unsigned char uid[32];
uint8_t uid1 = 0x00, uid2 = 0x00, uid3 = 0x00, uid4 = 0x00;
uint8_t uid1, uid2, uid3, uid4;
unsigned char crc;
uint64_t state;
uint8_t auth_ks[4];
@@ -673,7 +673,7 @@ static int hitagS_handle_tag_auth(hitag_function htf, uint64_t key, uint64_t NrA
z++;
}
}
k = 0;
uint16_t k = 0;
for (i = 5; i < z; i += 2) {
uid[k] = response_bit[i];
k++;
@@ -1749,22 +1749,17 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page) {
*/
void check_challenges(bool file_given, uint8_t *data) {
int i, j, z, k;
uint8_t uid_byte[4];
int frame_count = 0, response = 0;
uint8_t uid_byte[4];
uint8_t rx[HITAG_FRAME_LEN];
uint8_t unlocker[60][8];
int u1 = 0;
size_t rxlen = 0;
size_t rxlen = 0, txlen = 0;
uint8_t txbuf[HITAG_FRAME_LEN];
uint8_t *tx = txbuf;
size_t txlen = 0;
int lastbit;
bool bSkip;
int reset_sof;
int tag_sof;
uint8_t *tx;
int t_wait = HITAG_T_WAIT_MAX;
int STATE = 0;
bool bStop;
int lastbit, reset_sof, tag_sof, STATE = 0;;
bool bSkip, bStop;
int response_bit[200];
unsigned char mask = 1;
unsigned char uid[32];

View File

@@ -521,7 +521,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
// triggered == false -- to wait first for card
bool triggered = !(param & 0x03);
uint32_t rsamples = 0;
uint32_t rx_samples = 0;
DbpString("Starting to sniff");
@@ -562,11 +562,11 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
LED_A_OFF();
// Need two samples to feed Miller and Manchester-Decoder
if (rsamples & 0x01) {
if (rx_samples & 0x01) {
if (!TagIsActive) { // no need to try decoding reader data if the tag is sending
uint8_t readerdata = (previous_data & 0xF0) | (*data >> 4);
if (MillerDecoding(readerdata, (rsamples - 1) * 4)) {
if (MillerDecoding(readerdata, (rx_samples - 1) * 4)) {
LED_C_ON();
// check - if there is a short 7bit request from reader
@@ -593,7 +593,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
// no need to try decoding tag data if the reader is sending - and we cannot afford the time
if (!ReaderIsActive) {
uint8_t tagdata = (previous_data << 4) | (*data & 0x0F);
if (ManchesterDecoding(tagdata, 0, (rsamples - 1) * 4)) {
if (ManchesterDecoding(tagdata, 0, (rx_samples - 1) * 4)) {
LED_B_ON();
if (!LogTrace(receivedResp,
@@ -617,7 +617,7 @@ void RAMFUNC SniffIso14443a(uint8_t param) {
}
previous_data = *data;
rsamples++;
rx_samples++;
data++;
if (data == dmaBuf + DMA_BUFFER_SIZE) {
data = dmaBuf;

View File

@@ -947,7 +947,6 @@ static RAMFUNC int Handle14443bTagSamplesDemod(int ci, int cq) {
static void GetTagSamplesFor14443bDemod() {
bool gotFrame, finished = false;
// int lastRxCounter = ISO14443B_DMA_BUFFER_SIZE;
int ci = 0, cq = 0;
uint32_t time_0 = 0, time_stop = 0;
BigBuf_free();
@@ -978,8 +977,8 @@ static void GetTagSamplesFor14443bDemod() {
WDT_HIT();
// LSB is a fpga signal bit.
ci = upTo[0];
cq = upTo[1];
int ci = upTo[0];
int cq = upTo[1];
upTo += 2;
// lastRxCounter -= 2;

View File

@@ -112,7 +112,7 @@ void opt_successor(const uint8_t *k, State *s, bool y, State *successor) {
void opt_suc(const uint8_t *k, State *s, uint8_t *in, uint8_t length, bool add32Zeroes) {
State x2;
int i;
uint8_t head = 0;
uint8_t head;
for (i = 0; i < length; i++) {
head = 1 & (in[i] >> 7);
opt_successor(k, s, head, &x2);
@@ -149,8 +149,7 @@ void opt_suc(const uint8_t *k, State *s, uint8_t *in, uint8_t length, bool add32
}
void opt_output(const uint8_t *k, State *s, uint8_t *buffer) {
uint8_t times = 0;
uint8_t bout = 0;
uint8_t bout, times = 0;
State temp = {0, 0, 0, 0};
for (; times < 4; times++) {
bout = 0;