diff --git a/CMakeLists.txt b/CMakeLists.txt index 46c656957..c959e5ab3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -641,7 +641,7 @@ elseif(FreeBSD) src/detection/terminalshell/terminalshell_linux.c src/detection/terminalsize/terminalsize_linux.c src/detection/theme/theme_linux.c - src/detection/tpm/tpm_nosupport.c + src/detection/tpm/tpm_bsd.c src/detection/uptime/uptime_bsd.c src/detection/users/users_linux.c src/detection/wallpaper/wallpaper_linux.c diff --git a/src/detection/tpm/tpm_bsd.c b/src/detection/tpm/tpm_bsd.c new file mode 100644 index 000000000..ffaf0009b --- /dev/null +++ b/src/detection/tpm/tpm_bsd.c @@ -0,0 +1,17 @@ +#include "tpm.h" +#include "common/sysctl.h" + +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 (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 "Not supported on this platform"; +}