From b37b495aee0dc05d311ba17985e8ccfa8fe43c00 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 26 Sep 2024 14:58:26 +0800 Subject: [PATCH] TPM (FreeBSD): report clearer error if tpm module is not loaded --- src/detection/tpm/tpm_bsd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/detection/tpm/tpm_bsd.c b/src/detection/tpm/tpm_bsd.c index ffaf0009b..f51adb8ad 100644 --- a/src/detection/tpm/tpm_bsd.c +++ b/src/detection/tpm/tpm_bsd.c @@ -1,10 +1,16 @@ #include "tpm.h" #include "common/sysctl.h" +#include +#include + const char* ffDetectTPM(FFTPMResult* result) { if (ffSysctlGetString("dev.tpmcrb.0.%desc", &result->description) != NULL) - return "TPM device is not found or TPM kernel module is not loaded"; + { + if (modfind("tpm") < 0) return "TPM kernel module is not loaded"; + return "TPM device is not found"; + } if (ffStrbufContainS(&result->description, "2.0")) ffStrbufSetStatic(&result->version, "2.0");