]> git.cryptolib.org Git - arm-crypto-lib.git/blobdiff - jh/jh_simple_speed_core.c
switching to dedicated endian switching function
[arm-crypto-lib.git] / jh / jh_simple_speed_core.c
index 36a58208568586c4f13f73db2051c6faf297babc..5a7e16fbb56bd6c5f54cc5b65cc83ba22e43629a 100644 (file)
 static
 void jh_round(uint8_t* a, uint8_t roundno){
        uint8_t b[128];
-       uint8_t i,r,u,v,x,y;
+       uint8_t i,r=0,u,v,x,y;
        const uint8_t *pr;
        pr = jh_round_const + 32*roundno;
        for(i=0; i<128; ++i){
                if(i%4==0){
                        r = *pr++;
                }
-               b[i]=jh_lutbox[((r&0xC0)<<2)|a[i]];
-               r<<=2;
+               b[i] = jh_lutbox[((r&0xC0)<<2)|a[i]];
+               r <<= 2;
        }
        for(i=0;i<128;++i){
                u = jh_permutation_table[2*i];
@@ -62,15 +62,6 @@ void jh_round(uint8_t* a, uint8_t roundno){
        }
 }
 
-static
-uint8_t jh_l_inv(uint8_t a){
-       uint8_t v,w;
-       v = a>>4;
-       w = a&0xf;
-       v ^= ((w<<1)^(w>>3)^((w>>2)&2))&0xf;
-       w ^= ((v<<1)^(v>>3)^((v>>2)&2))&0xf;
-       return w|(v<<4);
-}
 
 static inline
 void group(uint8_t *a){