summaryrefslogtreecommitdiffstats
path: root/src/tpm2-setup
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-04-22 09:46:23 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-04-22 12:40:09 +0200
commit21a3bc6b9f01c3b0bf906c0b28f8827db086edf8 (patch)
tree09615be569defc4752fbc2439b01d4fe61d5c41c /src/tpm2-setup
parentsd-event: fix fd leak when fd is owned by IO event source (diff)
downloadsystemd-21a3bc6b9f01c3b0bf906c0b28f8827db086edf8.tar.xz
systemd-21a3bc6b9f01c3b0bf906c0b28f8827db086edf8.zip
tpm2-util: add generic wrapper tpm2_context_new_or_warn() that wrpas tpm2_context_new and logs about errors
We so far just print a short log message that is not very useful, let's add some recognizable error codes, and output better log messages if we can't get TPM stuff to work. Fixes: #31925
Diffstat (limited to 'src/tpm2-setup')
-rw-r--r--src/tpm2-setup/tpm2-setup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tpm2-setup/tpm2-setup.c b/src/tpm2-setup/tpm2-setup.c
index 846d5b8ac8..35628fc02a 100644
--- a/src/tpm2-setup/tpm2-setup.c
+++ b/src/tpm2-setup/tpm2-setup.c
@@ -212,9 +212,9 @@ static int load_public_key_tpm2(struct public_key_data *ret) {
assert(ret);
- r = tpm2_context_new(arg_tpm2_device, &c);
+ r = tpm2_context_new_or_warn(arg_tpm2_device, &c);
if (r < 0)
- return log_error_errno(r, "Failed to create TPM2 context: %m");
+ return r;
r = tpm2_get_or_create_srk(
c,