ATmega644 Smart-Card
defs.h
1 
11 #ifndef DEFS_H
12 #define DEFS_H
13 
14 #include <stdlib.h>
15 #include <stdio.h>
16 #include <stdint.h>
17 
18 // C Includes
19 #ifdef __cplusplus
20 extern "C"
21 {
22  #include <avr/io.h>
23 }
24 #endif
25 
26 #define SET_BIT(reg, pos) reg |= (1<<pos)
27 #define CLR_BIT(reg, pos) reg &= ~(1<<pos)
28 #define GET_BIT(reg, pos) (reg & (1<<pos))
29 
30 #define WORD_BYTES (uint8_t)(4)
31 #define KEY_BYTES (uint8_t)(16)
32 #define STATE_BYTES (uint8_t)(16)
33 #define SBOX_BYTES (uint16_t)(256)
34 #define ROUNDS (uint8_t)(10)
35 
36 typedef bool bit_t;
37 typedef uint8_t byte_t;
38 typedef uint8_t state_t[WORD_BYTES][WORD_BYTES];
39 typedef uint8_t aes_key_t[KEY_BYTES];
40 typedef uint8_t sub_keys_t[ROUNDS+1][KEY_BYTES];
41 
42 #endif // DEFS_H