]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Strict alignment Kuznyechik bugfix
authorDmitry Belyavskiy <beldmit@gmail.com>
Fri, 18 Sep 2020 13:27:41 +0000 (16:27 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Fri, 18 Sep 2020 13:27:41 +0000 (16:27 +0300)
gost_grasshopper_math.h

index 43341a827c6a26192cc942132a58472bcd15abc6..87d1265267b7e150e7bb266a84e6339cfafe05a4 100644 (file)
@@ -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,