]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tpm2-setup: call DLOPEN_TPM2 to add dependency and fail immediately if not present
authorLuca Boccassi <luca.boccassi@gmail.com>
Mon, 22 Jun 2026 21:48:53 +0000 (22:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jun 2026 16:37:42 +0000 (18:37 +0200)
tpm2-setup requires both libcrypto and the tpm2-tss libraries, but so
far it only directly dlopen'ed libcrypto, with a clear error on startup
if missing, and a dependency added via dlopen notes.
Do the same for the tpm2-tss dlopens, to get a clear error and the
required dependencies.

src/tpm2-setup/tpm2-setup.c

index db508676966562238a8fcdd52ecf409b61dcbc4a..20bb3f7011a9f27e70909fe6395be6c5438adf6d 100644 (file)
@@ -573,6 +573,10 @@ static int run(int argc, char *argv[]) {
         if (r < 0)
                 return r;
 
+        r = DLOPEN_TPM2(LOG_ERR, SD_ELF_NOTE_DLOPEN_PRIORITY_REQUIRED);
+        if (r < 0)
+                return r;
+
         umask(0022);
 
         /* Execute both jobs, and then return unlisted errors preferably, and listed errors