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>
This commit is contained in:
James Le Cuirot
2026-05-22 22:24:39 +01:00
parent 0a7375b989
commit 4acfbccd0c
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,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

View File

@@ -36,6 +36,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-1.6.0-no-force-lto.patch
"${FILESDIR}"/${PN}-1.7.2-toolchain-hardening.patch
"${FILESDIR}"/${P}-gcc-16-asm.patch
"${FILESDIR}"/${PN}-1.7.2-m68k.patch
)
src_configure() {