summaryrefslogtreecommitdiff
path: root/src/shared/cryptsetup-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2022-11-16 21:37:20 +0100
committerLennart Poettering <lennart@poettering.net>2022-11-21 16:13:17 +0100
commit7736a71fd2c4f0704db2e0d110959f817829cb85 (patch)
treecf46ad874a24607341e783fac5de3109ed6e629b /src/shared/cryptsetup-util.c
parent28795f2c138203fb700fc394f0937708af886116 (diff)
downloadsystemd-7736a71fd2c4f0704db2e0d110959f817829cb85.tar.gz
dlfcn-util: add static asserts ensuring our sym_xyz() func ptrs match the types from the official headers
Make sure that the sym_xyz function pointers have the types that the functions we'll assign them have. And of course, this found a number of incompatibilities right-away, in particular in the bpf hookup. (Doing this will trigger deprecation warnings from libbpf. I simply turned them off locally now, since we are well aware of what we are doing in that regard.) There's one return type fix (bool → int), that actually matters I think, as it might have created an incompatibility on some archs.
Diffstat (limited to 'src/shared/cryptsetup-util.c')
-rw-r--r--src/shared/cryptsetup-util.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/shared/cryptsetup-util.c b/src/shared/cryptsetup-util.c
index 7437cbed6b..f697429852 100644
--- a/src/shared/cryptsetup-util.c
+++ b/src/shared/cryptsetup-util.c
@@ -205,6 +205,14 @@ int dlopen_cryptsetup(void) {
#if HAVE_LIBCRYPTSETUP
int r;
+ /* libcryptsetup added crypt_reencrypt() in 2.2.0, and marked it obsolete in 2.4.0, replacing it with
+ * crypt_reencrypt_run(), which takes one extra argument but is otherwise identical. The old call is
+ * still available though, and given we want to support 2.2.0 for a while longer, we'll stick to the
+ * old symbol. Howerver, the old symbols now has a GCC deprecation decorator, hence let's turn off
+ * warnings about this for now. */
+
+ DISABLE_WARNING_DEPRECATED_DECLARATIONS;
+
r = dlopen_many_sym_or_warn(
&cryptsetup_dl, "libcryptsetup.so.12", LOG_DEBUG,
DLSYM_ARG(crypt_activate_by_passphrase),
@@ -262,6 +270,8 @@ int dlopen_cryptsetup(void) {
if (r <= 0)
return r;
+ REENABLE_WARNING;
+
/* Redirect the default logging calls of libcryptsetup to our own logging infra. (Note that
* libcryptsetup also maintains per-"struct crypt_device" log functions, which we'll also set
* whenever allocating a "struct crypt_device" context. Why set both? To be defensive: maybe some