void inv_mix_columns(uint8_t *state) { uint8_t a[4] = {0x0e, 0x09, 0x0d, 0x0b}; // a(x) = {02} + {01}x + {01}x2 + {03}x3 uint8_t i, j, col[4], res[4]; for (j = 0; j < n_b; j++) { for (i = 0; i < 4; i++) { col[i] = state[n_b*j+i]; } coef_mult(a, col, res); for (i = 0; i < 4; i++) { state[n_b*j+i] = res[i]; } } }
/* * Transformation in the Inverse Cipher that is the inverse of * MixColumns(). */ void inv_mix_columns(uint8_t *state) { uint8_t a[] = {0x0e, 0x09, 0x0d, 0x0b}; // a(x) = {0e} + {09}x + {0d}x2 + {0b}x3 uint8_t i, j, col[4], res[4]; for (j = 0; j < Nb; j++) { for (i = 0; i < 4; i++) { col[i] = state[Nb*i+j]; } coef_mult(a, col, res); for (i = 0; i < 4; i++) { state[Nb*i+j] = res[i]; } } }
/* * Transformation in the Cipher that takes all of the columns of the * State and mixes their data (independently of one another) to * produce new columns. */ void mix_columns(uint8_t *state) { uint8_t a[] = {0x02, 0x01, 0x01, 0x03}; // a(x) = {02} + {01}x + {01}x2 + {03}x3 uint8_t i, j, col[4], res[4]; for (j = 0; j < Nb; j++) { for (i = 0; i < 4; i++) { col[i] = state[Nb*i+j]; } coef_mult(a, col, res); for (i = 0; i < 4; i++) { state[Nb*i+j] = res[i]; } } }