blob: 4b7341306390589dc4c52ef78fcdfefb55ed6123 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
}
|