From 76424950e373d3b04ac3dd13019151bfba3e8423 Mon Sep 17 00:00:00 2001 From: sumuel Date: Mon, 17 Aug 2026 20:44:55 +0000 Subject: Add the files --- src/detection/tpm/tpm_bsd.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/detection/tpm/tpm_bsd.c (limited to 'src/detection/tpm/tpm_bsd.c') diff --git a/src/detection/tpm/tpm_bsd.c b/src/detection/tpm/tpm_bsd.c new file mode 100644 index 0000000..4b73413 --- /dev/null +++ b/src/detection/tpm/tpm_bsd.c @@ -0,0 +1,22 @@ +#include "tpm.h" +#include "common/sysctl.h" +#include "common/kmod.h" + +const char* ffDetectTPM(FFTPMResult* result) { + if (ffSysctlGetString("dev.tpmcrb.0.%desc", &result->description) != NULL) { + if (!ffKmodLoaded("tpm")) { + return "`tpm` kernel module is not loaded"; + } + return "TPM device is not found"; + } + + if (ffStrbufContainS(&result->description, "2.0")) { + ffStrbufSetStatic(&result->version, "2.0"); + } else if (ffStrbufContainS(&result->description, "1.2")) { + ffStrbufSetStatic(&result->version, "1.2"); + } else { + ffStrbufSetStatic(&result->version, "unknown"); + } + + return NULL; +} -- cgit v1.2.3