diff --git a/dev-libs/leancrypto/files/leancrypto-1.7.2-m68k.patch b/dev-libs/leancrypto/files/leancrypto-1.7.2-m68k.patch new file mode 100644 index 0000000000000..786f610b7434b --- /dev/null +++ b/dev-libs/leancrypto/files/leancrypto-1.7.2-m68k.patch @@ -0,0 +1,27 @@ +From dfeea66a9aac33916d24be6dbb9b72629a6b63e7 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +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 +--- 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 + diff --git a/dev-libs/leancrypto/leancrypto-1.7.2-r3.ebuild b/dev-libs/leancrypto/leancrypto-1.7.2-r3.ebuild index f35ed03635fb4..ba7ee1eb0e70c 100644 --- a/dev-libs/leancrypto/leancrypto-1.7.2-r3.ebuild +++ b/dev-libs/leancrypto/leancrypto-1.7.2-r3.ebuild @@ -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() {