Files
gentoo/dev-libs/leancrypto/files/leancrypto-1.7.2-m68k.patch
James Le Cuirot 4acfbccd0c dev-libs/leancrypto: Patch 1.7.2 to fix m68k alignment issue
This is already applied upstream. The tests pass on m68k and multilib amd64.

Closes: https://bugs.gentoo.org/973563
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2026-05-22 22:24:45 +01:00

28 lines
1004 B
Diff

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