Commit | Line | Data |
---|---|---|
bd20f8f4 | 1 | //----------------------------------------------------------------------------- |
d19929cb | 2 | // (c) 2012 Roel Verdult |
bd20f8f4 | 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 | //----------------------------------------------------------------------------- | |
d19929cb | 8 | // Hitag2 type prototyping |
bd20f8f4 | 9 | //----------------------------------------------------------------------------- |
4e12287d RS |
10 | // HitagS added |
11 | //----------------------------------------------------------------------------- | |
2e68bd40 | 12 | |
d19929cb | 13 | #ifndef _HITAG2_H_ |
14 | #define _HITAG2_H_ | |
e30c654b | 15 | |
b8e461ff | 16 | #ifdef _MSC_VER |
17 | #define PACKED | |
18 | #else | |
19 | #define PACKED __attribute__((packed)) | |
20 | #endif | |
21 | ||
d19929cb | 22 | typedef enum { |
f86d6b55 | 23 | RHTSF_CHALLENGE = 01, |
24 | RHTSF_KEY = 02, | |
4e12287d RS |
25 | WHTSF_CHALLENGE = 03, |
26 | WHTSF_KEY = 04, | |
bde10a50 | 27 | RHT2F_PASSWORD = 21, |
28 | RHT2F_AUTHENTICATE = 22, | |
f71f4deb | 29 | RHT2F_CRYPTO = 23, |
52244230 | 30 | WHT2F_CRYPTO = 24, |
f71f4deb | 31 | RHT2F_TEST_AUTH_ATTEMPTS = 25, |
52244230 | 32 | RHT2F_UID_ONLY = 26, |
d19929cb | 33 | } hitag_function; |
2e68bd40 | 34 | |
d19929cb | 35 | typedef struct { |
36 | byte_t password[4]; | |
37 | } PACKED rht2d_password; | |
38 | ||
39 | typedef struct { | |
40 | byte_t NrAr[8]; | |
4e12287d | 41 | byte_t data[4]; |
d19929cb | 42 | } PACKED rht2d_authenticate; |
43 | ||
bde10a50 | 44 | typedef struct { |
4e12287d RS |
45 | byte_t key[6]; |
46 | byte_t data[4]; | |
bde10a50 | 47 | } PACKED rht2d_crypto; |
48 | ||
d19929cb | 49 | typedef union { |
50 | rht2d_password pwd; | |
51 | rht2d_authenticate auth; | |
f71f4deb | 52 | rht2d_crypto crypto; |
d19929cb | 53 | } hitag_data; |
e30c654b | 54 | |
55 | #endif |