dmi_tpm_device

Synopsis

#include <opendmi/entity/tpm-device.h>

typedef struct dmi_tpm_device {
    dmi_binary_t                      vendor_raw;
    char                             *vendor;
    dmi_version_t                     specification_version;
    uint64_t                          firmware_version;
    dmi_tpm_firmware_version_format_t firmware_version_format;
    dmi_version_t                     firmware_revision;
    dmi_tpm_firmware_version_t        firmware_version_2;
    const char                       *description;
    dmi_tpm_device_chars_t            characteristics;
    uint32_t                          oem_defined;
} dmi_tpm_device_t;

Description

The dmi_tpm_device_t structure holds the decoded TPM device structure (type 43) of SMBIOS: it describes a Trusted Platform Module (TPM) of the system, with its vendor, the version of the TPM specification it implements and the version of its firmware.

The firmware version is kept as stored in firmware_version, and is also parsed according to the major version of the TPM specification; firmware_version_format tells which field holds the parsed version.

The structure is returned by dmi_entity_info for the structures of type DMI_TYPE(tpm_device), and lives as long as the context it has been decoded in.

Fields

vendor_raw

Vendor identifier as the structure holds it: four bytes of text, which are not terminated, and which some firmware stores in reverse order.

vendor

Vendor identifier, as registered by the Trusted Computing Group (TCG): up to four characters, or nullptr if the identifier holds no printable character. Some firmware stores the four bytes in reverse order; the decoder puts them back in order, and cuts the identifier at the first character which is not printable. The string belongs to the structure, and is freed along with it.

specification_version

Version of the TPM specification the device supports, such as 1.2 or 2.0; use dmi_version_major and dmi_version_minor to read it.

firmware_version

Vendor-specific firmware version, as stored: the first double word of the structure (firmware version 1) in the upper 32 bits, the second one (firmware version 2) in the lower 32 bits.

firmware_version_format

Format of the firmware version, chosen by the major version of the TPM specification, see dmi_tpm_firmware_version_format. It tells whether firmware_revision or firmware_version_2 holds the parsed version.

firmware_revision

Firmware revision of a TPM 1.x device, made of the revMajor and revMinor bytes of its TCPA_VERSION structure. Only meaningful when firmware_version_format is DMI_TPM_FIRMWARE_VERSION_FORMAT_TPM_1, 0 otherwise.

firmware_version_2

Firmware version of a TPM 2.0 device, see dmi_tpm_firmware_version. Only meaningful when firmware_version_format is DMI_TPM_FIRMWARE_VERSION_FORMAT_TPM_2, zeroed otherwise.

description

Descriptive information about the TPM device, nullptr if the structure has none.

characteristics

Characteristics of the TPM device, see dmi_tpm_device_chars.

oem_defined

Information specific to the OEM or the firmware vendor.

Examples

dmi_registry_t   *registry = dmi_get_registry(context);
dmi_entity_t     *entity   = dmi_registry_lookup_first(registry,
                                 DMI_TYPE(tpm_device), false);
dmi_tpm_device_t *tpm      = dmi_entity_info(entity, DMI_TYPE(tpm_device));

if (tpm != nullptr) {
    printf("TPM %u.%u by %s\n", dmi_version_major(tpm->specification_version),
           dmi_version_minor(tpm->specification_version),
           tpm->vendor != nullptr ? tpm->vendor : "unknown vendor");

    if (tpm->firmware_version_format ==
        DMI_TPM_FIRMWARE_VERSION_FORMAT_TPM_2)
        printf("Firmware %u.%u\n", (unsigned)tpm->firmware_version_2.major,
               (unsigned)tpm->firmware_version_2.minor);
}

Standards

DMTF SMBIOS Specification (DSP0134), version 3.1 or newer.