X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=openssl-gost%2Fengine.git;a=blobdiff_plain;f=gost_grasshopper_math.h;h=91f276fd3bf36122992fcc76d96af531380fcf6d;hp=43341a827c6a26192cc942132a58472bcd15abc6;hb=HEAD;hpb=7f12baed6f8d2592c07f09375fcb31bc6f00e8ab diff --git a/gost_grasshopper_math.h b/gost_grasshopper_math.h index 43341a8..91f276f 100644 --- a/gost_grasshopper_math.h +++ b/gost_grasshopper_math.h @@ -66,7 +66,7 @@ static GRASSHOPPER_INLINE void grasshopper_zero128(grasshopper_w128_t* x) { static GRASSHOPPER_INLINE void grasshopper_copy128(grasshopper_w128_t* to, const grasshopper_w128_t* from) { #if(GRASSHOPPER_BITS == 8 || GRASSHOPPER_BITS == 16) - __builtin_memcpy(&to, &from, sizeof(w128_t)); + __builtin_memcpy(&to, &from, sizeof(grasshopper_w128_t)); #else int i; for (i = 0; i < GRASSHOPPER_BIT_PARTS; i++) { @@ -77,9 +77,15 @@ static GRASSHOPPER_INLINE void grasshopper_copy128(grasshopper_w128_t* to, const static GRASSHOPPER_INLINE void grasshopper_append128(grasshopper_w128_t* x, const grasshopper_w128_t* y) { int i; +#ifdef STRICT_ALIGNMENT + for (i = 0; i < 16; i++) { + GRASSHOPPER_ACCESS_128_VALUE_8(*x, i) ^= GRASSHOPPER_ACCESS_128_VALUE_8(*y, i); + } +#else for (i = 0; i < GRASSHOPPER_BIT_PARTS; i++) { GRASSHOPPER_ACCESS_128_VALUE(*x, i) ^= GRASSHOPPER_ACCESS_128_VALUE(*y, i); } +#endif } static GRASSHOPPER_INLINE void grasshopper_plus128(grasshopper_w128_t* result, const grasshopper_w128_t* x,