diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-09-18 16:27:41 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-09-18 16:29:54 +0300 |
commit | 22d446a1f4320318704d4050b0486567505dc960 (patch) | |
tree | 8f7636f50998d33c978095979b5fc87ee2a5bfcd | |
parent | 16b2dd87b36105d549b29ee0f34284350c8024c0 (diff) | |
download | gost-engine-22d446a1f4320318704d4050b0486567505dc960.zip gost-engine-22d446a1f4320318704d4050b0486567505dc960.tar.gz gost-engine-22d446a1f4320318704d4050b0486567505dc960.tar.bz2 |
Strict alignment Kuznyechik bugfix
(cherry picked from commit 1997dd99db27383a89d1f91bd4d7091b553ca6ee)
-rw-r--r-- | gost_grasshopper_math.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gost_grasshopper_math.h b/gost_grasshopper_math.h index 43341a8..87d1265 100644 --- a/gost_grasshopper_math.h +++ b/gost_grasshopper_math.h @@ -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, |