tpm 規範

Compatibility with Existing Applications

The most correct and convenient way to access the tpm emulator is to use the provided device driver library (tddl). For a comprehensive description of its functionality we refer to the official TCG specification, an example of use is given by the test application tddl/test_tddl.

Note that on Windows the tddl is called ifxtpm.dll as many applications (e.g., TPM/J) expect this name and do not support alternative drivers.

For backward compatibility with existing Unix applications, the kernel module tpmd_dev forwards any command sent to the device /dev/tpm to the tpm emulator daemon. In order to access the emulator directly (i.e., without using the device driver library or the device /dev/tpm) all one has to do is to include the header files sys/socket.h and sys/un.h and to replace the open("/dev/tpm") call with something like:

 

struct sockaddr_un addr;

fh = socket(PF_UNIX, SOCK_STREAM, 0);

if (fh <= 0) {

/* handle error */

}

addr.sun_family = AF_UNIX;

strncpy(addr.sun_path, "/var/run/tpm/tpmd_socket:0", sizeof(addr.sun_path));

 res = connect(fh, (struct sockaddr*)&addr, sizeof(struct sockaddr_un));

 if (res <= 0) { /* handle error */ }

 

All subsequent calls of read(), write(), and close() should work as expected.

 

 

references:http://tpm-emulator.berlios.de/documentation.html

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章