X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;ds=sidebyside;f=echo%2Fecho.c;h=6fbbbd8efe92918a2ac5dafe63939a11e597cef8;hb=cc26d167f796adaa33ca3cbec8016f7915b6033b;hp=407b1c5d3daab884a876dbcbcd6562c79af99d15;hpb=7b5401ab9ce23a5da1de8b6c7de3a1aa20ac4cf8;p=avr-crypto-lib.git diff --git a/echo/echo.c b/echo/echo.c index 407b1c5..6fbbbd8 100644 --- a/echo/echo.c +++ b/echo/echo.c @@ -19,8 +19,9 @@ #include "echo.h" -#include "gf256mul/gf256mul.h" -#include "memxor/memxor.h" +#include "gf256mul.h" +#include "memxor.h" +#include "aes_enc_round.h" #include #include @@ -35,7 +36,6 @@ #include "cli.h" #endif -void aes_encrypt_round(void* state, void* key); #define INDEX(c,r) ((c)*16*4+(r)*16) @@ -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_encrypt_round(s+16*i, k); - aes_encrypt_round(s+16*i, salt); - *((uint64_t*)(k)) += 1; + 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); + k.v64[0] += 1; } #if DEBUG if(round