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
5 //-----------------------------------------------------------------------------
8 // (c) 2012 Roel Verdult
9 // (c) 2016 Oguzhan Cicek, Hendrik Schwartke, Ralf Spenneberg
11 //-----------------------------------------------------------------------------
24 HTS_LAST_CMD
= WHTSF_KEY
,
26 RHT1F_AUTHENTICATE
= 12,
27 HT1_LAST_CMD
= RHT1F_AUTHENTICATE
,
29 RHT2F_AUTHENTICATE
= 22,
32 RHT2F_TEST_AUTH_ATTEMPTS
= 25,
35 HT2_LAST_CMD
= WHT2F_PASSWORD
,
40 } PACKED rht2d_password
;
45 } PACKED rht2d_authenticate
;
50 } PACKED rht2d_crypto
;
58 } PACKED rht1d_authenticate
;
62 rht1d_authenticate ht1auth
;
63 rht2d_authenticate auth
;
68 //---------------------------------------------------------
70 //---------------------------------------------------------
72 typedef enum PROTO_STATE
{
82 typedef enum TAG_STATE
{
90 //number of start-of-frame bits
91 typedef enum SOF_TYPE
{
100 PSTATE pstate
; //protocol-state
101 TSATE tstate
; //tag-state
103 uint8_t pages
[64][4];
105 uint8_t pwdl0
, pwdl1
, pwdh0
;
110 bool auth
; //0=Plain 1=Auth
111 bool TTFC
; //Transponder Talks first coding. 0=Manchester 1=Biphase
112 int TTFDR
; //data rate in TTF Mode
113 int TTFM
; //the number of pages that are sent to the RWD
114 bool LCON
; //0=con1/2 read write 1=con1 read only and con2 OTP
115 bool LKP
; //0=page2/3 read write 1=page2/3 read only in Plain mode and no access in authenticate mode
117 //0=read write 1=read only
120 bool LCK5
; //page8-11
121 bool LCK4
; //page12-15
122 bool LCK3
; //page16-23
123 bool LCK2
; //page24-31
124 bool LCK1
; //page32-47
125 bool LCK0
; //page48-63