Syntaxt suger

This commit is contained in:
iceman1001 2016-04-14 11:34:02 +02:00
commit 68410a4892
3 changed files with 8 additions and 9 deletions

View file

@ -419,10 +419,11 @@ static uint16_t *dist = 0;
int nonce_distance(uint32_t from, uint32_t to) int nonce_distance(uint32_t from, uint32_t to)
{ {
uint16_t x, i; uint16_t x, i;
if(!dist) { // generate distance lookup table
if (!dist) {
dist = malloc(2 << 16); dist = malloc(2 << 16);
if(!dist) if (!dist) return -1;
return -1;
for (x = i = 1; i; ++i) { for (x = i = 1; i; ++i) {
dist[(x & 0xff) << 8 | x >> 8] = i; dist[(x & 0xff) << 8 | x >> 8] = i;
x = x >> 1 | (x ^ x >> 2 ^ x >> 3 ^ x >> 5) << 15; x = x >> 1 | (x ^ x >> 2 ^ x >> 3 ^ x >> 5) << 15;
@ -446,7 +447,7 @@ static uint32_t fastfwd[2][8] = {
* encrypt the NACK which is observed when varying only the 3 last bits of Nr * encrypt the NACK which is observed when varying only the 3 last bits of Nr
* only correct iff [NR_3] ^ NR_3 does not depend on Nr_3 * only correct iff [NR_3] ^ NR_3 does not depend on Nr_3
*/ */
uint32_t *lfsr_prefix_ks(uint8_t ks[8], int isodd) uint32_t* lfsr_prefix_ks(uint8_t ks[8], int isodd)
{ {
uint32_t *candidates = malloc(4 << 10); uint32_t *candidates = malloc(4 << 10);
if(!candidates) return 0; if(!candidates) return 0;

View file

@ -1296,7 +1296,8 @@ int doIClassSimulation( int simulationMode, uint8_t *reader_mac_buf)
receivedCmd[3], receivedCmd[4], receivedCmd[5], receivedCmd[3], receivedCmd[4], receivedCmd[5],
receivedCmd[6], receivedCmd[7], receivedCmd[8]); receivedCmd[6], receivedCmd[7], receivedCmd[8]);
// Do not respond // Do not respond
modulated_response = resp_sof; modulated_response_size = 0; //order = 0; modulated_response = resp_sof;
modulated_response_size = 0; //order = 0;
trace_data = NULL; trace_data = NULL;
trace_data_size = 0; trace_data_size = 0;
} }

View file

@ -75,7 +75,6 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
break; break;
} }
// ----------------------------- crypto1 destroy
crypto1_destroy(pcs); crypto1_destroy(pcs);
if (MF_DBGLEVEL >= 2) DbpString("READ BLOCK FINISHED"); if (MF_DBGLEVEL >= 2) DbpString("READ BLOCK FINISHED");
@ -717,10 +716,8 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
memcpy(buf+i+8, &nt_par_enc, 1); memcpy(buf+i+8, &nt_par_enc, 1);
i += 9; i += 9;
} }
// wait for the card to become ready again // wait for the card to become ready again
while(GetCountSspClk() < timeout); while(GetCountSspClk() < timeout);
} }
LED_C_OFF(); LED_C_OFF();