fix const params, logic, casting
[RRG-proxmark3.git] / include / em4x70.h
blob2a11acc02af8ede731f2ea06455b33333d566426
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // Low frequency EM4x70 structs -- common to both ARM firmware and client
17 //-----------------------------------------------------------------------------
19 #ifndef EM4X70_H__
20 #define EM4X70_H__
22 #include <stdint.h>
23 #include <stdbool.h>
25 #define EM4X70_NUM_BLOCKS 16
27 // Common word/block addresses
28 #define EM4X70_PIN_WORD_LOWER 10
29 #define EM4X70_PIN_WORD_UPPER 11
31 typedef struct {
32 // ISSUE: `bool` type does not have a standard-defined size.
33 // therefore, compatibility between architectures /
34 // compilers is not guaranteed.
35 // ISSUE: C99 has no _Static_assert() ... was added in C11
36 // TODO: add _Static_assert(sizeof(bool)==1);
37 // TODO: add _Static_assert(sizeof(em4x70_data_t)==36);
38 bool parity;
40 // Used for writing address
41 uint8_t address;
42 // ISSUE: Presumes target is little-endian
43 uint16_t word;
45 // PIN to unlock
46 uint32_t pin;
48 // Used for authentication
49 uint8_t frnd[4];
50 uint8_t grnd[3];
51 uint8_t rnd[7];
53 // Used to write new key
54 uint8_t crypt_key[12];
56 // used for bruteforce the partial key
57 // ISSUE: Presumes target is little-endian
58 uint16_t start_key;
60 } em4x70_data_t;
62 #endif /* EM4X70_H__ */