]> git.99rst.org Git - openwrt-packages.git/commitdiff
cryptsetup: fix Argon2 with OpenSSL built without it
authorDaniel Golle <redacted>
Thu, 10 Sep 2026 14:33:44 +0000 (15:33 +0100)
committerDaniel Golle <redacted>
Fri, 11 Sep 2026 00:46:29 +0000 (01:46 +0100)
OpenWrt builds OpenSSL with no-blake2, which OpenSSL's Configure turns
into no-argon2 because Argon2 is built on BLAKE2b. The cryptsetup
configure script only looks for the OSSL_KDF_PARAM_ARGON2_VERSION macro,
which such a build still installs, so it drops the bundled Argon2 and
EVP_KDF_fetch() fails at runtime. Every LUKS2 keyslot using Argon2 then
fails instantly with "Keyslot open failed", and cryptsetup benchmark
reports argon2id as N/A. Add a patch that also checks OPENSSL_NO_ARGON2
so the bundled implementation is used again.

Fixes: fbac2e7861fb ("cryptsetup: update to 2.8.7")
Signed-off-by: Daniel Golle <redacted>
utils/cryptsetup/Makefile
utils/cryptsetup/patches/010-configure-detect-openssl-without-argon2.patch [new file with mode: 0644]

index 94011c6e2e79aba73d6b6f34323ea8b64ce7f28e..d5e187d6d07741a3eb17701defbcd37ee63e0d6e 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cryptsetup
 PKG_VERSION:=2.8.7
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/cryptsetup/v$(subst $(space),.,$(wordlist 1, 2, $(subst .,$(space),$(PKG_VERSION))))
diff --git a/utils/cryptsetup/patches/010-configure-detect-openssl-without-argon2.patch b/utils/cryptsetup/patches/010-configure-detect-openssl-without-argon2.patch
new file mode 100644 (file)
index 0000000..06a8544
--- /dev/null
@@ -0,0 +1,51 @@
+From dbf4c3773b2433b6324f4ec74feb746ca6e7bfb1 Mon Sep 17 00:00:00 2001
+From: Daniel Golle <daniel@makrotopia.org>
+Date: Thu, 10 Sep 2026 15:16:59 +0100
+Subject: [PATCH] Use internal Argon2 when OpenSSL is built without Argon2
+
+OpenSSL can be configured with no-argon2, and no-blake2 implies it
+because Argon2 is built on BLAKE2b. Such a build still installs the
+OSSL_KDF_PARAM_ARGON2_* macros in core_names.h, so configure concludes
+that OpenSSL provides Argon2 and drops the bundled implementation.
+EVP_KDF_fetch() then fails at runtime and every LUKS2 keyslot using
+Argon2 fails to open. Check OPENSSL_NO_ARGON2 as well and fall back to
+the internal Argon2 implementation.
+
+Signed-off-by: Daniel Golle <daniel@makrotopia.org>
+---
+ configure.ac | 8 +++++++-
+ meson.build  | 3 +++
+ 2 files changed, 10 insertions(+), 1 deletion(-)
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -345,7 +345,13 @@ AC_DEFUN([CONFIGURE_OPENSSL], [
+       saved_LIBS=$LIBS
+       AC_CHECK_DECLS([OSSL_get_max_threads], [], [], [#include <openssl/thread.h>])
+-      AC_CHECK_DECLS([OSSL_KDF_PARAM_ARGON2_VERSION], [use_internal_argon2=0], [], [#include <openssl/core_names.h>])
++      dnl OpenSSL built with no-argon2 (implied by no-blake2) still installs the parameter name macros.
++      AC_CHECK_DECLS([OSSL_KDF_PARAM_ARGON2_VERSION], [use_internal_argon2=0], [], [[
++#include <openssl/opensslconf.h>
++#ifdef OPENSSL_NO_ARGON2
++#error Argon2 is disabled in this OpenSSL build
++#endif
++#include <openssl/core_names.h>]])
+       LIBS=$saved_LIBS
+ ])
+--- a/meson.build
++++ b/meson.build
+@@ -518,9 +518,12 @@ elif get_option('crypto-backend') == 'op
+             dependencies: crypto_backend_library))
+     # LibreSSL defines OSSL_KDF_PARAM_ARGON2_VERSION in core_names.h but does
+     # not implement the EVP_KDF API. Check for both the symbol and the function.
++    # OpenSSL built with no-argon2 (implied by no-blake2) keeps the macros too.
+     _have_ossl_argon2 = (
+         cc.has_header_symbol('openssl/core_names.h', 'OSSL_KDF_PARAM_ARGON2_VERSION',
+             dependencies: crypto_backend_library) and
++        not cc.has_header_symbol('openssl/opensslconf.h', 'OPENSSL_NO_ARGON2',
++            dependencies: crypto_backend_library) and
+         cc.has_function('EVP_KDF_fetch',
+             dependencies: crypto_backend_library))
+     conf.set10('HAVE_DECL_OSSL_KDF_PARAM_ARGON2_VERSION', _have_ossl_argon2)
git clone https://git.99rst.org/PROJECT