1 --- a/src/tddl/tddl.c Mon Apr 12 22:24:21 2010
2 +++ b/src/tddl/tddl.c.new Thu Sep 22 12:28:25 2011
5 #include "trousers/tss.h"
6 #include "trousers_types.h"
13 struct tpm_device_node tpm_device_nodes[] = {
15 {"/dev/tpm0", TDDL_UNDEF, TDDL_UNDEF},
16 {"/udev/tpm0", TDDL_UNDEF, TDDL_UNDEF},
18 {"/dev/tpm", TDDL_UNDEF, TDDL_UNDEF},
29 + return (opened_device->fd);
38 fd = socket(AF_INET, SOCK_STREAM, 0);
41 struct hostent *host = gethostbyname(tcp_device_hostname);
43 struct sockaddr_in addr;
45 /* tpm_device_paths is filled out in tddl.h */
46 for (i = 0; tpm_device_nodes[i].path != NULL; i++) {
48 - if ((fd = open(tpm_device_nodes[i].path, O_RDWR)) >= 0)
49 + if ((fd = open(tpm_device_nodes[i].path, O_RDWR)) >= 0) {
52 + fprintf(stderr, "Error opening %s: %s\n",
53 + tpm_device_nodes[i].path, strerror(errno));
61 opened_device = &(tpm_device_nodes[i]);
62 tpm_device_nodes[i].fd = fd;
66 case TDDL_TRANSMIT_IOCTL:
69 if ((sizeResult = ioctl(opened_device->fd, TPMIOC_TRANSMIT, txBuffer)) != -1) {
70 opened_device->transmit = TDDL_TRANSMIT_IOCTL;
73 LogWarn("ioctl: (%d) %s", errno, strerror(errno));
75 LogInfo("Falling back to Read/Write device support.");
77 case TDDL_TRANSMIT_RW:
80 TSS_RESULT Tddli_Cancel(void)
85 if (opened_device->transmit == TDDL_TRANSMIT_IOCTL) {
88 return TDDLERR(TSS_E_NOTIMPL);
91 + return TDDLERR(TSS_E_NOTIMPL);