-#ifdef DEBUG
-# define DEBUG_PRINT(ctx, msg) debug_print((ctx), PSTR(msg))
-#else
-# define DEBUG_PRINT(ctx, msg)
-#endif
-
-#ifdef DEBUG
-
-void print_twister_state(twister_state_t* ctx){
- uint8_t i;
- uart_putstr_P(PSTR("\r\nState:\r\n matrix:\r\n"));
- for(i=0; i<8; ++i){
- uart_putstr_P(PSTR("\t[ "));
- uart_hexdump(&(ctx->s[i][0]), 8);
- uart_putstr_P(PSTR("]\r\n"));
- }
- uart_putstr_P(PSTR("counter: "));
- uart_hexdump(&(ctx->counter), 8);
-
- uart_putstr_P(PSTR("\r\nlength_counter_b: "));
- uart_hexdump(&(ctx->length_counter_b), 8);
- uart_putstr_P(PSTR("\r\n"));
-}
-
-void debug_print(twister_state_t* ctx, PGM_P msg){
- uart_putstr_P(PSTR("\r\n"));
- uart_putstr_P(msg);
- print_twister_state(ctx);
-}
-
-#endif
-
-static
-void shiftrow(void* row, uint8_t shift){
- *((uint64_t*)row) = *((uint64_t*)row)>>(8*shift) | *((uint64_t*)row)<<(64-8*shift);
-}
-
-#define MDS(a,b) pgm_read_byte(&(twister_mds[a][b]))
-
-#ifdef TWISTER_MUL_TABLE
-# define MULT(a,b) pgm_read_byte(&(twister_multab[a][b]))
-#else
-# define MULT(a,b) gf256mul(a,b, 0x4D)
-#endif