X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=groestl%2Fgroestl_large.c;h=f7f5eea14ccf622147fa356e4655871d507bb20c;hb=32705e6283b34dd709dc8fafdf5c3e32d6a944a1;hp=bcfd8e51ae67c81f807c466b21d7f20d7db38314;hpb=4f50c75ee5a6cc88bf7ea71957ed509e298e6c25;p=avr-crypto-lib.git diff --git a/groestl/groestl_large.c b/groestl/groestl_large.c index bcfd8e5..f7f5eea 100644 --- a/groestl/groestl_large.c +++ b/groestl/groestl_large.c @@ -54,7 +54,7 @@ #define dump_m(m) #endif -static uint8_t matrix[] PROGMEM = { +static const uint8_t matrix[] PROGMEM = { 2, 2, 3, 4, 5, 3, 5, 7, 7, 2, 2, 3, 4, 5, 3, 5, 5, 7, 2, 2, 3, 4, 5, 3, @@ -65,14 +65,49 @@ static uint8_t matrix[] PROGMEM = { 2, 3, 4, 5, 3, 5, 7, 2 }; +static +void shift_columns(uint8_t *a, PGM_VOID_P shifts){ + uint8_t s; + uint8_t tmp[16]; + uint8_t i,j; + for(i=0; i<8; ++i){ + s = pgm_read_byte(shifts); + shifts = (uint8_t*)shifts + 1; + if(s==0){ + continue; + } + for(j=0;j<16;++j){ + tmp[j] = a[i+j*8]; + } + for(j=0; j<16; ++j){ + a[i+((j-s+16)%16)*8] = tmp[j]; + } + } +} + +static const uint8_t p_shifts[] PROGMEM = { + 0, 1, 2, 3, 4, 5, 6, 11 +}; + +static const uint8_t q_shifts[] PROGMEM = { + 1, 3, 5, 11, 0, 2, 4, 6 +}; + void groestl_large_rounds(uint8_t *m, uint8_t q){ uint8_t r,i,j; uint8_t tmp[16]; for(r=0; r