master ohmu/fastfetch-openbsd / src / detection / tpm / tpm_apple.c
ohmu  ·  2026-10-15
 1#include "tpm.h"
 2#include "common/debug.h"
 3
 4#ifndef __aarch64__
 5    #include "common/apple/cf_helpers.h"
 6    #include <IOKit/IOKitLib.h>
 7#endif
 8
 9const char* ffDetectTPM(FFTPMResult* result) {
10#ifdef __aarch64__
11
12    ffStrbufSetStatic(&result->version, "2.0");
13    ffStrbufSetStatic(&result->description, "Apple Silicon Security");
14    return nullptr;
15
16#else
17
18    FF_IOOBJECT_AUTO_RELEASE io_service_t t2Service = IOServiceGetMatchingService(
19        MACH_PORT_NULL,
20        IOServiceMatching("AppleT2"));
21
22    if (t2Service) {
23        ffStrbufSetStatic(&result->version, "2.0");
24        ffStrbufSetStatic(&result->description, "Apple T2 Security Chip");
25        return nullptr;
26    }
27
28#endif
29
30    FF_DEBUG("Neither Apple T2 nor Apple Silicon Security was reported by IOKit");
31    return "No Apple Security hardware detected";
32}