X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;f=echo%2Fecho.c;h=91cc59d0541e9b0a9b967efe584fa0e9db8997c6;hb=257ce629ccb9d28193912b855322c91408fd19a7;hp=b460f965bf84ae431b0034c85080b20fb9ada1a7;hpb=d70d1d77bab1a5f5278227d674bc59da0378fe15;p=arm-crypto-lib.git diff --git a/echo/echo.c b/echo/echo.c index b460f96..91cc59d 100644 --- a/echo/echo.c +++ b/echo/echo.c @@ -19,8 +19,8 @@ #include "echo.h" -#include "gf256mul/gf256mul.h" -#include "memxor/memxor.h" +#include "gf256mul.h" +#include "memxor.h" #include "aes_enc_round.h" #include #include @@ -93,12 +93,15 @@ static void dump_state(void* s){ static void echo_compress(uint8_t* s, uint8_t iterations, uint64_t* c, void* salt){ uint8_t i, j; - uint8_t k[16]; + union { + uint8_t v8[16]; + uint64_t v64[2]; + } k; #if DEBUG uint8_t round=0; #endif - memcpy(k, c, 8); - memset(k+8, 0, 8); + memcpy(k.v8, c, 8); + memset(k.v8+8, 0, 8); do{ /* BIG.SubWords */ #if DEBUG @@ -110,9 +113,9 @@ static void echo_compress(uint8_t* s, uint8_t iterations, uint64_t* c, void* sal } #endif for(i=0; i<16; ++i){ - aes_enc_round((aes_cipher_state_t*)(s+16*i), (aes_roundkey_t*)k); + aes_enc_round((aes_cipher_state_t*)(s+16*i), (aes_roundkey_t*)k.v8); aes_enc_round((aes_cipher_state_t*)(s+16*i), (aes_roundkey_t*)salt); - *((uint64_t*)(k)) += 1; + k.v64[0] += 1; } #if DEBUG if(round