Architecture of the TCG Software Stack
Once the operatingsystem is loaded, the method for accessing services ofthe TPM is called the TSS (TCG Software Stack).
The TSS is composed of several stacked components, where each layerhas a specific interface to the next layer.
Simplified, the architecture looks like this:
![_images/TSS.png](https://i-blog.csdnimg.cn/blog_migrate/3fd9235de50ebbc4b9d62e40ac303a16.png)
TSS Service Provider Interface
The application accesses the TPM device via theTSS Service Provider Interface (TSPI).
This application programming interface isdefined in the include file <tss/tspi.h>, andimplemented in libtspi.
TSS Core Services Interface
TCSI is an internal interface. The TrouSerS project includes a daemonprocess tcsd which implements the TSS Core Service. This servicecan be accessed by either opening the tpmd_socket socket or byaccessing port 30003/tcp on the local machine.
The library libtspi calls the TSS Core Services Interface toaccess of tcsd services.
TPM Device Driver Library Interface
The tcsd daemon needs to access the kernel device driver.However, instead of an direct interface to the kernel device/dev/tpm, the TPM Device Driver Library Interface has beeninterposed as an intermediate layer.
This layer allows the TPMemulator to replace libtddl withits own version to communicate with the tpmd. It thus allowsrunning the TPMemulator on platforms that do not permitloading of a special kernel module.
The tcsd daemon is linked against the libtddl librarywhich describes this interface. More specifically, the TPM Device DriverLibrary Interface is defined in <tss/tddli.h>, and implemented inlibtddl.so.
TPM Device Driver
The physical TPM device (chip) can only be accessed by the kernel.
Main function of the device driver is multiplexing the access to the TPM hardware.
For communication with TPM, applications need a kernel driver thatimplements /dev/tpm. The interface to the TPM is implementedby write() and read() system calls on the device driver.