X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=groestl%2Fgroestl_large.c;h=a1e962c1cb796e3bc797c7d654582509bebf4cd8;hb=6095187b080b960d111a54f18a3b2da788d2d59d;hp=9381935441a5e11ed883558f81b4513c49ca6359;hpb=d70d1d77bab1a5f5278227d674bc59da0378fe15;p=arm-crypto-lib.git diff --git a/groestl/groestl_large.c b/groestl/groestl_large.c index 9381935..a1e962c 100644 --- a/groestl/groestl_large.c +++ b/groestl/groestl_large.c @@ -26,9 +26,9 @@ */ #include "groestl_large.h" -#include "aes/aes_sbox.h" -#include "gf256mul/gf256mul.h" -#include "memxor/memxor.h" +#include "aes_sbox.h" +#include "gf256mul.h" +#include "memxor.h" #include #include @@ -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[16]; + uint8_t i,j,s; + for(i=0; i<8; ++i){ + s = *shifts++; + 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[8] = { 0, 1, 2, 3, 4, 5, 6, 11 }; +static const uint8_t q_shifts[8] = { 1, 3, 5, 11, 0, 2, 4, 6 }; + +static void groestl_large_rounds(uint8_t *m, uint8_t q){ uint8_t r,i,j; uint8_t tmp[16]; for(r=0; r