X-Git-Url: https://git.cryptolib.org/?p=arm-crypto-lib.git;a=blobdiff_plain;f=echo%2Fecho.c;h=91cc59d0541e9b0a9b967efe584fa0e9db8997c6;hp=97ab73cdfca72a9fab64397249f1103876246795;hb=6095187b080b960d111a54f18a3b2da788d2d59d;hpb=f3456452a0f13bfe6d332aaeeada5b626dac2739 diff --git a/echo/echo.c b/echo/echo.c index 97ab73c..91cc59d 100644 --- a/echo/echo.c +++ b/echo/echo.c @@ -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