TPM (FreeBSD): report clearer error if tpm module is not loaded

This commit is contained in:
Carter Li
2024-09-26 14:58:26 +08:00
parent 28c9b67414
commit b37b495aee
+7 -1
View File
@@ -1,10 +1,16 @@
#include "tpm.h"
#include "common/sysctl.h"
#include <sys/param.h>
#include <sys/module.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 (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");