summaryrefslogtreecommitdiffstats
path: root/tests/fake_systemd_tpm_path.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fake_systemd_tpm_path.c')
-rw-r--r--tests/fake_systemd_tpm_path.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/fake_systemd_tpm_path.c b/tests/fake_systemd_tpm_path.c
new file mode 100644
index 0000000..6d82989
--- /dev/null
+++ b/tests/fake_systemd_tpm_path.c
@@ -0,0 +1,17 @@
+#include <string.h>
+#include <stdlib.h>
+
+/* systemd tpm2-util.h */
+int tpm2_find_device_auto(int log_level, char **ret);
+
+extern int tpm2_find_device_auto(int log_level __attribute__((unused)), char **ret)
+{
+ const char *path = getenv("TPM_PATH");
+
+ if (!path)
+ *ret = NULL;
+ else
+ *ret = strdup(path);
+
+ return 0;
+}