]> git.zerfleddert.de Git - proxmark3-svn/blame - include/hitag.h
Merge pull request #926 from pwpiwi/fix_iso15693_fpga
[proxmark3-svn] / include / hitag.h
CommitLineData
5866c187 1//-----------------------------------------------------------------------------
2// This code is licensed to you under the terms of the GNU GPL, version 2 or,
3// at your option, any later version. See the LICENSE.txt file for the text of
4// the license.
5//-----------------------------------------------------------------------------
6// Hitag2, HitagS
7//
8// (c) 2012 Roel Verdult
9// (c) 2016 Oguzhan Cicek, Hendrik Schwartke, Ralf Spenneberg
10// <info@os-s.de>
11//-----------------------------------------------------------------------------
12
13
14#ifndef HITAG_H__
15#define HITAG_H__
16
17#ifdef _MSC_VER
18#define PACKED
19#else
20#define PACKED __attribute__((packed))
21#endif
22
23typedef enum {
24 RHTSF_CHALLENGE = 01,
25 RHTSF_KEY = 02,
26 WHTSF_CHALLENGE = 03,
27 WHTSF_KEY = 04,
28 RHT2F_PASSWORD = 21,
29 RHT2F_AUTHENTICATE = 22,
30 RHT2F_CRYPTO = 23,
31 WHT2F_CRYPTO = 24,
32 RHT2F_TEST_AUTH_ATTEMPTS = 25,
33 RHT2F_UID_ONLY = 26,
f2dbf3d2 34 WHT2F_PASSWORD = 27,
5866c187 35} hitag_function;
36
37typedef struct {
38 uint8_t password[4];
39} PACKED rht2d_password;
40
41typedef struct {
42 uint8_t NrAr[8];
43 uint8_t data[4];
44} PACKED rht2d_authenticate;
45
46typedef struct {
47 uint8_t key[6];
48 uint8_t data[4];
49} PACKED rht2d_crypto;
50
51typedef union {
52 rht2d_password pwd;
53 rht2d_authenticate auth;
54 rht2d_crypto crypto;
55} hitag_data;
56
57
58//---------------------------------------------------------
59// Hitag S
60//---------------------------------------------------------
61typedef enum PROTO_STATE {READY=0,INIT,AUTHENTICATE,SELECTED,QUIET,TTF,FAIL} PSTATE; //protocol-state
62typedef enum TAG_STATE {NO_OP=0,READING_PAGE,READING_BLOCK,WRITING_PAGE_ACK,WRITING_PAGE_DATA,WRITING_BLOCK_DATA} TSATE; //tag-state
63typedef enum SOF_TYPE {STANDARD=0,ADVANCED,FAST_ADVANCED,ONE,NO_BITS} stype; //number of start-of-frame bits
64
65struct hitagS_tag {
66 PSTATE pstate; //protocol-state
67 TSATE tstate; //tag-state
68 uint32_t uid;
69 uint8_t pages[64][4];
70 uint64_t key;
71 uint8_t pwdl0, pwdl1, pwdh0;
72 //con0
73 int max_page;
74 stype mode;
75 //con1
76 bool auth; //0=Plain 1=Auth
77 bool TTFC; //Transponder Talks first coding. 0=Manchester 1=Biphase
78 int TTFDR; //data rate in TTF Mode
79 int TTFM; //the number of pages that are sent to the RWD
80 bool LCON; //0=con1/2 read write 1=con1 read only and con2 OTP
81 bool LKP; //0=page2/3 read write 1=page2/3 read only in Plain mode and no access in authenticate mode
82 //con2
83 //0=read write 1=read only
84 bool LCK7; //page4/5
85 bool LCK6; //page6/7
86 bool LCK5; //page8-11
87 bool LCK4; //page12-15
88 bool LCK3; //page16-23
89 bool LCK2; //page24-31
90 bool LCK1; //page32-47
91 bool LCK0; //page48-63
92} ;
93
94#endif
Impressum, Datenschutz