]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Use alignas for hmac inner and outer state.
authorNiels Möller <nisse@lysator.liu.se>
Sun, 22 Jun 2025 15:22:00 +0000 (17:22 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Sun, 22 Jun 2025 19:11:04 +0000 (21:11 +0200)
hmac.h

diff --git a/hmac.h b/hmac.h
index 8f6f3dbc803aca020ded17686a15cc34a9d7b848..e7ecc63dca0749f59b8d153e65ed0b41be6d9253 100644 (file)
--- a/hmac.h
+++ b/hmac.h
@@ -34,6 +34,8 @@
 #ifndef NETTLE_HMAC_H_INCLUDED
 #define NETTLE_HMAC_H_INCLUDED
 
+#include <stdalign.h>
+
 #include "nettle-meta.h"
 
 #include "gosthash94.h"
@@ -83,10 +85,10 @@ extern "C" {
 #define hmac_sm3_update nettle_hmac_sm3_update
 #define hmac_sm3_digest nettle_hmac_sm3_digest
 
-#define _NETTLE_HMAC_CTX(type) {       \
-    char outer[offsetof (type, index)];        \
-    char inner[offsetof (type, index)];        \
-    type state;                                \
+#define _NETTLE_HMAC_CTX(type) {                       \
+    alignas(type) char outer[offsetof (type, index)];  \
+    alignas(type) char inner[offsetof (type, index)];  \
+    type state;                                                \
   }
 
 /* hmac-md5 */