]>
Commit | Line | Data |
---|---|---|
1 | //----------------------------------------------------------------------------- | |
2 | // (c) 2012 Roel Verdult | |
3 | // | |
4 | // This code is licensed to you under the terms of the GNU GPL, version 2 or, | |
5 | // at your option, any later version. See the LICENSE.txt file for the text of | |
6 | // the license. | |
7 | //----------------------------------------------------------------------------- | |
8 | // Hitag2 type prototyping | |
9 | //----------------------------------------------------------------------------- | |
10 | // HitagS added | |
11 | //----------------------------------------------------------------------------- | |
12 | ||
13 | #ifndef _HITAG2_H_ | |
14 | #define _HITAG2_H_ | |
15 | ||
16 | #ifdef _MSC_VER | |
17 | #define PACKED | |
18 | #else | |
19 | #define PACKED __attribute__((packed)) | |
20 | #endif | |
21 | ||
22 | typedef enum { | |
23 | RHTSF_CHALLENGE = 01, | |
24 | RHTSF_KEY = 02, | |
25 | WHTSF_CHALLENGE = 03, | |
26 | WHTSF_KEY = 04, | |
27 | RHT2F_PASSWORD = 21, | |
28 | RHT2F_AUTHENTICATE = 22, | |
29 | RHT2F_CRYPTO = 23, | |
30 | WHT2F_CRYPTO = 24, | |
31 | RHT2F_TEST_AUTH_ATTEMPTS = 25, | |
32 | RHT2F_UID_ONLY = 26, | |
33 | } hitag_function; | |
34 | ||
35 | typedef struct { | |
36 | byte_t password[4]; | |
37 | } PACKED rht2d_password; | |
38 | ||
39 | typedef struct { | |
40 | byte_t NrAr[8]; | |
41 | byte_t data[4]; | |
42 | } PACKED rht2d_authenticate; | |
43 | ||
44 | typedef struct { | |
45 | byte_t key[6]; | |
46 | byte_t data[4]; | |
47 | } PACKED rht2d_crypto; | |
48 | ||
49 | typedef union { | |
50 | rht2d_password pwd; | |
51 | rht2d_authenticate auth; | |
52 | rht2d_crypto crypto; | |
53 | } hitag_data; | |
54 | ||
55 | #endif |