TPM (FreeBSD): add support

This commit is contained in:
Carter Li
2024-09-26 10:39:03 +08:00
committed by 李通洲
parent 87f2e69162
commit 8295f66320
2 changed files with 18 additions and 1 deletions
+17
View File
@@ -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";
}