[PATCH 6/7] rijndael-aesni: fix u128_t strict-aliasing rule breaking

Jussi Kivilinna jussi.kivilinna at iki.fi
Wed Jan 25 22:15:35 CET 2017


* cipher/rijndael-aesni.c (u128_t): Add attributes to tell GCC and clang
that casting from 'char *' to 'u128_t *' is ok.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 0 files changed

diff --git a/cipher/rijndael-aesni.c b/cipher/rijndael-aesni.c
index 7852e19..735e5cd 100644
--- a/cipher/rijndael-aesni.c
+++ b/cipher/rijndael-aesni.c
@@ -41,7 +41,10 @@
 #endif
 
 
-typedef struct u128_s { u32 a, b, c, d; } u128_t;
+typedef struct u128_s
+{
+  u32 a, b, c, d;
+} __attribute__((packed, aligned(1), may_alias)) u128_t;
 
 
 /* Two macros to be called prior and after the use of AESNI




More information about the Gcrypt-devel mailing list