mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
remove spurious spaces & tabs at end of lines
This commit is contained in:
parent
edc19f202a
commit
60f292b18e
249 changed files with 8481 additions and 8481 deletions
|
@ -222,7 +222,7 @@ struct Crypto1State* lfsr_recovery32(uint32_t ks2, uint32_t in)
|
|||
|
||||
// allocate memory for out of place bucket_sort
|
||||
bucket_array_t bucket;
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < 2; i++) {
|
||||
for (uint32_t j = 0; j <= 0xff; j++) {
|
||||
bucket[i][j].head = malloc(sizeof(uint32_t)<<14);
|
||||
|
@ -424,7 +424,7 @@ uint32_t lfsr_rollback_word(struct Crypto1State *s, uint32_t in, int fb)
|
|||
ret |= lfsr_rollback_bit(s, BEBIT(in, 18), fb) << (18 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 17), fb) << (17 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 16), fb) << (16 ^ 24);
|
||||
|
||||
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 15), fb) << (15 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 14), fb) << (14 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 13), fb) << (13 ^ 24);
|
||||
|
@ -433,7 +433,7 @@ uint32_t lfsr_rollback_word(struct Crypto1State *s, uint32_t in, int fb)
|
|||
ret |= lfsr_rollback_bit(s, BEBIT(in, 10), fb) << (10 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 9), fb) << (9 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 8), fb) << (8 ^ 24);
|
||||
|
||||
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 7), fb) << (7 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 6), fb) << (6 ^ 24);
|
||||
ret |= lfsr_rollback_bit(s, BEBIT(in, 5), fb) << (5 ^ 24);
|
||||
|
@ -483,7 +483,7 @@ uint32_t *lfsr_prefix_ks(uint8_t ks[8], int isodd)
|
|||
{
|
||||
uint32_t *candidates = malloc(4 << 10);
|
||||
if(!candidates) return 0;
|
||||
|
||||
|
||||
uint32_t c, entry;
|
||||
int size = 0, i, good;
|
||||
|
||||
|
@ -531,7 +531,7 @@ static struct Crypto1State* check_pfx_parity(uint32_t prefix, uint32_t rresp, ui
|
|||
}
|
||||
|
||||
return sl + good;
|
||||
}
|
||||
}
|
||||
|
||||
/** lfsr_common_prefix
|
||||
* Implentation of the common prefix attack.
|
||||
|
|
|
@ -44,7 +44,7 @@ uint32_t lfsr_rollback_word(struct Crypto1State* s, uint32_t in, int fb);
|
|||
int nonce_distance(uint32_t from, uint32_t to);
|
||||
#define SWAPENDIAN(x)\
|
||||
(x = (x >> 8 & 0xff00ff) | (x & 0xff00ff) << 8, x = x >> 16 | x << 16)
|
||||
|
||||
|
||||
#define FOREACH_VALID_NONCE(N, FILTER, FSIZE)\
|
||||
uint32_t __n = 0,__M = 0, N = 0;\
|
||||
int __i;\
|
||||
|
@ -54,7 +54,7 @@ int nonce_distance(uint32_t from, uint32_t to);
|
|||
break;\
|
||||
else if(__i)\
|
||||
__M = prng_successor(__M, (__i == 7) ? 48 : 8);\
|
||||
else
|
||||
else
|
||||
|
||||
#define LF_POLY_ODD (0x29CE5C)
|
||||
#define LF_POLY_EVEN (0x870804)
|
||||
|
|
|
@ -25,8 +25,8 @@ struct Crypto1State * crypto1_create(uint64_t key)
|
|||
struct Crypto1State *s = malloc(sizeof(*s));
|
||||
if ( !s ) return NULL;
|
||||
|
||||
s->odd = s->even = 0;
|
||||
|
||||
s->odd = s->even = 0;
|
||||
|
||||
int i;
|
||||
//for(i = 47;s && i > 0; i -= 2) {
|
||||
for(i = 47; i > 0; i -= 2) {
|
||||
|
@ -103,7 +103,7 @@ uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted)
|
|||
ret |= crypto1_bit(s, BEBIT(in, 5), is_encrypted) << (5 ^ 24);
|
||||
ret |= crypto1_bit(s, BEBIT(in, 6), is_encrypted) << (6 ^ 24);
|
||||
ret |= crypto1_bit(s, BEBIT(in, 7), is_encrypted) << (7 ^ 24);
|
||||
|
||||
|
||||
ret |= crypto1_bit(s, BEBIT(in, 8), is_encrypted) << (8 ^ 24);
|
||||
ret |= crypto1_bit(s, BEBIT(in, 9), is_encrypted) << (9 ^ 24);
|
||||
ret |= crypto1_bit(s, BEBIT(in, 10), is_encrypted) << (10 ^ 24);
|
||||
|
|
|
@ -43,14 +43,14 @@ int main (int argc, char *argv[]) {
|
|||
uint32_t p64 = prng_successor(nt, 64);
|
||||
printf(" nt': %08x\n", p64);
|
||||
printf(" nt'': %08x\n", prng_successor(p64, 32));
|
||||
|
||||
|
||||
// Extract the keystream from the messages
|
||||
printf("\nKeystream used to generate {ar} and {at}:\n");
|
||||
ks2 = ar0_enc ^ p64;
|
||||
printf(" ks2: %08x\n", ks2);
|
||||
|
||||
s = lfsr_recovery32(ar0_enc ^ p64, 0);
|
||||
|
||||
|
||||
for(t = s; t->odd | t->even; ++t) {
|
||||
lfsr_rollback_word(t, 0, 0);
|
||||
lfsr_rollback_word(t, nr0_enc, 1);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "crapto1.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int main (int argc, char *argv[]) {
|
||||
struct Crypto1State *s,*t;
|
||||
uint64_t key; // recovered key
|
||||
|
@ -46,7 +46,7 @@ int main (int argc, char *argv[]) {
|
|||
printf("\nLFSR succesors of the tag challenge:\n");
|
||||
uint32_t p64 = prng_successor(nt0, 64);
|
||||
uint32_t p64b = prng_successor(nt1, 64);
|
||||
|
||||
|
||||
printf(" nt': %08x\n", p64);
|
||||
printf(" nt'': %08x\n", prng_successor(p64, 32));
|
||||
|
||||
|
@ -56,13 +56,13 @@ int main (int argc, char *argv[]) {
|
|||
printf(" ks2: %08x\n",ks2);
|
||||
|
||||
s = lfsr_recovery32(ar0_enc ^ p64, 0);
|
||||
|
||||
|
||||
for(t = s; t->odd | t->even; ++t) {
|
||||
lfsr_rollback_word(t, 0, 0);
|
||||
lfsr_rollback_word(t, nr0_enc, 1);
|
||||
lfsr_rollback_word(t, uid ^ nt0, 0);
|
||||
crypto1_get_lfsr(t, &key);
|
||||
|
||||
|
||||
crypto1_word(t, uid ^ nt1, 0);
|
||||
crypto1_word(t, nr1_enc, 1);
|
||||
if (ar1_enc == (crypto1_word(t, 0, 0) ^ p64b)) {
|
||||
|
|
|
@ -26,7 +26,7 @@ int main (int argc, char *argv[]) {
|
|||
|
||||
int encc = argc - 6;
|
||||
int enclen[encc];
|
||||
uint8_t enc[encc][120];
|
||||
uint8_t enc[encc][120];
|
||||
|
||||
sscanf(argv[1],"%x",&uid);
|
||||
sscanf(argv[2],"%x",&nt);
|
||||
|
@ -39,7 +39,7 @@ int main (int argc, char *argv[]) {
|
|||
sscanf(argv[i+6] + i2*2, "%2x", (unsigned int *)&enc[i][i2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
printf("Recovering key for:\n");
|
||||
|
||||
printf(" uid: %08x\n",uid);
|
||||
|
@ -60,7 +60,7 @@ int main (int argc, char *argv[]) {
|
|||
printf("\nLFSR succesors of the tag challenge:\n");
|
||||
printf(" nt': %08x\n",prng_successor(nt, 64));
|
||||
printf(" nt'': %08x\n",prng_successor(nt, 96));
|
||||
|
||||
|
||||
// Extract the keystream from the messages
|
||||
printf("\nKeystream used to generate {ar} and {at}:\n");
|
||||
ks2 = ar_enc ^ prng_successor(nt, 64);
|
||||
|
@ -73,11 +73,11 @@ int main (int argc, char *argv[]) {
|
|||
// Decrypting communication using keystream if presented
|
||||
if (argc > 6 ) {
|
||||
printf("\nDecrypted communication:\n");
|
||||
uint8_t ks4;
|
||||
uint8_t ks4;
|
||||
int rollb = 0;
|
||||
for (int i = 0; i < encc; i++) {
|
||||
printf("{dec%d}: ", i);
|
||||
for (int i2 = 0; i2 < enclen[i]; i2++) {
|
||||
for (int i2 = 0; i2 < enclen[i]; i2++) {
|
||||
ks4 = crypto1_byte(revstate, 0, 0);
|
||||
printf("%02x", ks4 ^ enc[i][i2]);
|
||||
rollb += 1;
|
||||
|
@ -87,7 +87,7 @@ int main (int argc, char *argv[]) {
|
|||
for (int i = 0; i < rollb; i++)
|
||||
lfsr_rollback_byte(revstate, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
lfsr_rollback_word(revstate, 0, 0);
|
||||
lfsr_rollback_word(revstate, 0, 0);
|
||||
lfsr_rollback_word(revstate, nr_enc, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue