mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
refactor: process Hitag S common args
This commit is contained in:
parent
d2783214e3
commit
f03eb1156a
2 changed files with 97 additions and 166 deletions
|
@ -31,15 +31,13 @@
|
|||
#define HITAG2_MAX_BLOCKS 8
|
||||
#define HITAG2_MAX_BYTE_SIZE (HITAG2_MAX_BLOCKS * HITAG_BLOCK_SIZE)
|
||||
|
||||
#define HITAGS_NRAR_SIZE 8
|
||||
#define HITAGS_CRYPTOKEY_SIZE 6
|
||||
#define HITAGS_UID_SIZE 4
|
||||
#define HITAGS_PAGE_SIZE 4
|
||||
#define HITAGS_BLOCK_SIZE 16
|
||||
#define HITAGS_MAX_PAGES 64
|
||||
#define HITAGS_MAX_BYTE_SIZE (HITAGS_MAX_PAGES * HITAGS_PAGE_SIZE)
|
||||
#define HITAGS_UID_PADR 0
|
||||
#define HITAGS_CONFIG_PADR 1
|
||||
#define HITAGS_PAGE_SIZE HITAG_BLOCK_SIZE
|
||||
#define HITAGS_BLOCK_PAGES 4
|
||||
#define HITAGS_BLOCK_SIZE (HITAGS_BLOCK_PAGES * HITAGS_MAX_PAGES)
|
||||
#define HITAGS_MAX_PAGES 64
|
||||
#define HITAGS_MAX_BYTE_SIZE (HITAGS_MAX_PAGES * HITAGS_PAGE_SIZE)
|
||||
#define HITAGS_UID_PADR 0
|
||||
#define HITAGS_CONFIG_PADR 1
|
||||
|
||||
// need to see which limits these cards has
|
||||
#define HITAG1_MAX_BYTE_SIZE 64
|
||||
|
@ -70,10 +68,12 @@ typedef enum {
|
|||
typedef struct {
|
||||
hitag_function cmd;
|
||||
int16_t page;
|
||||
uint8_t data[4];
|
||||
uint8_t NrAr[8];
|
||||
uint8_t key[6];
|
||||
uint8_t pwd[4];
|
||||
uint8_t data[HITAGS_PAGE_SIZE];
|
||||
uint8_t NrAr[HITAG_NRAR_SIZE];
|
||||
// unaligned access to key as uint64_t will abort.
|
||||
// todo: Why does the compiler without -munaligned-access generate unaligned-access code in the first place?
|
||||
uint8_t key[HITAG_CRYPTOKEY_SIZE] __attribute__((aligned(4)));
|
||||
uint8_t pwd[HITAG_PASSWORD_SIZE];
|
||||
|
||||
// Hitag 1 section.
|
||||
// will reuse pwd or key field.
|
||||
|
@ -157,7 +157,7 @@ struct hitagS_tag {
|
|||
// page 2
|
||||
uint8_t pwdl0;
|
||||
uint8_t pwdl1;
|
||||
uint64_t key : 48;
|
||||
uint64_t key : 48; // fixme: unaligned access
|
||||
|
||||
// page 4
|
||||
} s;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue