summaryrefslogtreecommitdiffstats
path: root/src/detection/tpm/tpm_apple.c
blob: 250dd014ed1a2a9773f2d1a9a26f11ba7e26eb5f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "tpm.h"

#ifndef __aarch64__
    #include "common/apple/cf_helpers.h"
    #include <IOKit/IOKitLib.h>
#endif

const char* ffDetectTPM(FFTPMResult* result) {
#ifdef __aarch64__

    ffStrbufSetStatic(&result->version, "2.0");
    ffStrbufSetStatic(&result->description, "Apple Silicon Security");
    return NULL;

#else

    FF_IOOBJECT_AUTO_RELEASE io_service_t t2Service = IOServiceGetMatchingService(
        MACH_PORT_NULL,
        IOServiceMatching("AppleT2"));

    if (t2Service) {
        ffStrbufSetStatic(&result->version, "2.0");
        ffStrbufSetStatic(&result->description, "Apple T2 Security Chip");
        return NULL;
    }

#endif

    return "No Apple Security hardware detected";
}