mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
Add lf em 4x70 autorecover
Also: * common.h: Increase safety of some of the macros. Parenthesizing the macro parameters ... a best practice. * firmware: partially-tracked source of "extra bits" messages. Add a TODO comment for further study. * Improve reliability of `lf em 4x70 writekey` Authenticate w/new key after it is written. Particularly important for glass modules, or other tags with weaker coupling.
This commit is contained in:
parent
9ee96691aa
commit
160d61682b
4 changed files with 940 additions and 324 deletions
|
@ -148,16 +148,16 @@ extern bool g_tearoff_enabled;
|
|||
|
||||
// convert 2 bytes to U16 in little endian
|
||||
#ifndef BYTES2UINT16
|
||||
# define BYTES2UINT16(x) ((x[1] << 8) | (x[0]))
|
||||
# define BYTES2UINT16(x) (((x)[1] << 8) | ((x)[0]))
|
||||
#endif
|
||||
// convert 4 bytes to U32 in little endian
|
||||
#ifndef BYTES2UINT32
|
||||
# define BYTES2UINT32(x) ((x[3] << 24) | (x[2] << 16) | (x[1] << 8) | (x[0]))
|
||||
# define BYTES2UINT32(x) (((x)[3] << 24) | ((x)[2] << 16) | ((x)[1] << 8) | ((x)[0]))
|
||||
#endif
|
||||
|
||||
// convert 4 bytes to U32 in big endian
|
||||
#ifndef BYTES2UINT32_BE
|
||||
# define BYTES2UINT32_BE(x) ((x[0] << 24) | (x[1] << 16) | (x[2] << 8) | (x[3]))
|
||||
# define BYTES2UINT32_BE(x) (((x)[0] << 24) | ((x)[1] << 16) | ((x)[2] << 8) | ((x)[3]))
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -174,7 +174,7 @@ extern bool g_tearoff_enabled;
|
|||
#endif
|
||||
|
||||
#ifndef CRUMB
|
||||
# define CRUMB(b,p) (((b & (0x3 << p) ) >> p ) & 0xF)
|
||||
# define CRUMB(b,p) ((((b) & (0x3 << (p)) ) >> (p) ) & 0xF)
|
||||
#endif
|
||||
|
||||
#ifndef SWAP_NIBBLE
|
||||
|
@ -183,18 +183,18 @@ extern bool g_tearoff_enabled;
|
|||
|
||||
// Binary Encoded Digit
|
||||
#ifndef BCD2DEC
|
||||
# define BCD2DEC(bcd) HornerScheme(bcd, 0x10, 10)
|
||||
# define BCD2DEC(bcd) HornerScheme((bcd), 0x10, 10)
|
||||
#endif
|
||||
|
||||
#ifndef DEC2BCD
|
||||
# define DEC2BCD(dec) HornerScheme(dec, 10, 0x10)
|
||||
# define DEC2BCD(dec) HornerScheme((dec), 10, 0x10)
|
||||
#endif
|
||||
|
||||
// bit stream operations
|
||||
#define TEST_BIT(data, i) (*(data + (i / 8)) >> (7 - (i % 8))) & 1
|
||||
#define SET_BIT(data, i) *(data + (i / 8)) |= (1 << (7 - (i % 8)))
|
||||
#define CLEAR_BIT(data, i) *(data + (i / 8)) &= ~(1 << (7 - (i % 8)))
|
||||
#define FLIP_BIT(data, i) *(data + (i / 8)) ^= (1 << (7 - (i % 8)))
|
||||
#define TEST_BIT(data, i) (*((data) + ((i) / 8)) >> (7 - ((i) % 8))) & 1
|
||||
#define SET_BIT(data, i) *((data) + ((i) / 8)) |= (1 << (7 - ((i) % 8)))
|
||||
#define CLEAR_BIT(data, i) *((data) + ((i) / 8)) &= ~(1 << (7 - ((i) % 8)))
|
||||
#define FLIP_BIT(data, i) *((data) + ((i) / 8)) ^= (1 << (7 - ((i) % 8)))
|
||||
|
||||
// time for decompressing and loading the image to the FPGA
|
||||
#define FPGA_LOAD_WAIT_TIME (1500)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue