X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=blobdiff_plain;f=groestl%2Fgroestl_small.c;h=14cc4524469a415eee7d70e72e89e13668a56cc9;hp=5996c10aeb6aaa1cba4fa5bbe6cc7225149f9c30;hb=7ce0cfaf621e263fc99e59e86b3e0446b0256834;hpb=e1db57c69472f52cf2405ef4eb22f085a868eeeb diff --git a/groestl/groestl_small.c b/groestl/groestl_small.c index 5996c10..14cc452 100644 --- a/groestl/groestl_small.c +++ b/groestl/groestl_small.c @@ -64,14 +64,43 @@ static const uint8_t matrix[] = { 2, 3, 4, 5, 3, 5, 7, 2 }; +static +void shift_columns(uint8_t* a, const uint8_t *shifts){ + uint8_t tmp[8]; + uint8_t i,j,s; + for(i=0; i<8; ++i){ + s = *shifts++; + if(s==0){ + continue; + } + for(j=0;j<8;++j){ + tmp[j] = a[i+j*8]; + } + for(j=0;j<8;++j){ + a[i+((j-s+8)%8)*8] = tmp[j]; + } + } +} + +static const uint8_t p_shifts[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; +static const uint8_t q_shifts[8] = { 1, 3, 5, 7, 0, 2, 4, 6 }; + +static void groestl_small_rounds(uint8_t *m, uint8_t q){ uint8_t r,i,j; uint8_t tmp[8]; for(r=0; r