X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/3612a8a8e2b3118e0bcb4ea0ef9a6c59d3635696..e09f21fa7b754a2f214efbebc622045138828096:/armsrc/legicrf.c?ds=sidebyside diff --git a/armsrc/legicrf.c b/armsrc/legicrf.c index f2eb680b..074a0f78 100644 --- a/armsrc/legicrf.c +++ b/armsrc/legicrf.c @@ -98,13 +98,14 @@ static uint32_t get_key_stream(int skip, int count) } /* Write Time Data into LOG */ + uint8_t *BigBuf = BigBuf_get_addr(); if(count == 6) { i = -1; } else { i = legic_read_count; } - ((uint8_t*)BigBuf)[OFFSET_LOG+128+i] = legic_prng_count(); - ((uint8_t*)BigBuf)[OFFSET_LOG+256+i*4] = (legic_prng_bc >> 0) & 0xff; - ((uint8_t*)BigBuf)[OFFSET_LOG+256+i*4+1] = (legic_prng_bc >> 8) & 0xff; - ((uint8_t*)BigBuf)[OFFSET_LOG+256+i*4+2] = (legic_prng_bc >>16) & 0xff; - ((uint8_t*)BigBuf)[OFFSET_LOG+256+i*4+3] = (legic_prng_bc >>24) & 0xff; - ((uint8_t*)BigBuf)[OFFSET_LOG+384+i] = count; + BigBuf[OFFSET_LOG+128+i] = legic_prng_count(); + BigBuf[OFFSET_LOG+256+i*4] = (legic_prng_bc >> 0) & 0xff; + BigBuf[OFFSET_LOG+256+i*4+1] = (legic_prng_bc >> 8) & 0xff; + BigBuf[OFFSET_LOG+256+i*4+2] = (legic_prng_bc >>16) & 0xff; + BigBuf[OFFSET_LOG+256+i*4+3] = (legic_prng_bc >>24) & 0xff; + BigBuf[OFFSET_LOG+384+i] = count; /* Generate KeyStream */ for(i=0; ibits == 7) { if(f->data == SESSION_IV) { @@ -581,9 +587,9 @@ static void frame_handle_tag(struct legic_frame const * const f) if(legic_state == STATE_CON) { int key = get_key_stream(-1, 11); //legic_phase_drift, 11); int addr = f->data ^ key; addr = addr >> 1; - int data = ((uint8_t*)BigBuf)[addr]; + int data = BigBuf[addr]; int hash = LegicCRC(addr, data, 11) << 8; - ((uint8_t*)BigBuf)[OFFSET_LOG+legic_read_count] = (uint8_t)addr; + BigBuf[OFFSET_LOG+legic_read_count] = (uint8_t)addr; legic_read_count++; //Dbprintf("Data:%03.3x, key:%03.3x, addr: %03.3x, read_c:%u", f->data, key, addr, read_c); @@ -618,19 +624,19 @@ static void frame_handle_tag(struct legic_frame const * const f) int i; Dbprintf("IV: %03.3x", legic_prng_iv); for(i = 0; i