blob: 786f610b7434bb13c6cdc9b459c0900e04fa352b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
From dfeea66a9aac33916d24be6dbb9b72629a6b63e7 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sun, 17 May 2026 21:22:20 +0100
Subject: [PATCH] ChaCha20: Align lc_sym_state to at least 4 bytes to fix m68k
m68k aligns to 2 bytes by default.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
--- a/sym/api/lc_chacha20_private.h
+++ b/sym/api/lc_chacha20_private.h
@@ -39,8 +39,12 @@ extern "C" {
* For accelerated ChaCha20 implementatinos, the key and the counter must be
* aligned to 16 bytes boundary. This is guaranteed when aligning the entire
* structure to 16 bytes as the constant field is 16 bytes in size.
+ *
+ * Force at least 4-byte alignment so that sizeof(struct lc_sym_state) is
+ * consistent (132) on architectures where uint32_t has only 2-byte alignment
+ * (e.g. m68k without -malign-int).
*/
-struct lc_sym_state {
+struct __attribute__((aligned(4))) lc_sym_state {
uint32_t constants[4];
union {
uint32_t u[LC_CC20_KEY_SIZE_WORDS];
--
2.54.0
|