X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/cb64309e4b187ada12e66c1a782f243b7924d32f..7d5169a0e97575732aa971121193a9eb4f8fae57:/client/nonce2key/crapto1.h diff --git a/client/nonce2key/crapto1.h b/client/nonce2key/crapto1.h index 67af4642..7f834528 100644 --- a/client/nonce2key/crapto1.h +++ b/client/nonce2key/crapto1.h @@ -37,7 +37,7 @@ struct Crypto1State* lfsr_recovery32(uint32_t ks2, uint32_t in); struct Crypto1State* lfsr_recovery64(uint32_t ks2, uint32_t ks3); uint32_t *lfsr_prefix_ks(uint8_t ks[8], int isodd); struct Crypto1State* -lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8]); +lfsr_common_prefix(uint32_t pfx, uint32_t rr, uint8_t ks[8], uint8_t par[8][8], uint8_t no_par); void lfsr_rollback_bit(struct Crypto1State* s, uint32_t in, int fb); @@ -80,6 +80,12 @@ static inline int parity(uint32_t x) return x; #endif } + +#if !defined LOWMEM && defined __GNUC__ +extern uint8_t filterlut[1 << 20]; +#define filter(x) (filterlut[(x) & 0xfffff]) +#define filter_unsafe(x) (filterlut[x]) +#else static inline int filter(uint32_t const x) { uint32_t f; @@ -91,6 +97,9 @@ static inline int filter(uint32_t const x) f |= 0x0d938 >> (x >> 16 & 0xf) & 1; return BIT(0xEC57E80A, f); } +#define filter_unsafe(x) (filter(x)) +#endif + #ifdef __cplusplus } #endif