Minor patches for tddl.c on Solaris - reading from the right device and
writing to the driver correctly (IOCTL only).

-Wyllys Ingersoll

*** src/tddl/tddl.c.old Fri Dec  5 08:13:11 2008
--- src/tddl/tddl.c     Fri Dec  5 08:16:20 2008
***************
*** 18,30 ****
--- 18,34 ----

   #include "trousers/tss.h"
   #include "trousers_types.h"
+ #ifndef SOLARIS
   #include "linux/tpm.h"
+ #endif
   #include "tcslog.h"
   #include "tddl.h"

   struct tpm_device_node tpm_device_nodes[] = {
+ #ifndef SOLARIS
         {"/dev/tpm0", TDDL_UNDEF, TDDL_UNDEF},
         {"/udev/tpm0", TDDL_UNDEF, TDDL_UNDEF},
+ #endif
         {"/dev/tpm", TDDL_UNDEF, TDDL_UNDEF},
         {NULL, 0, 0}
   };
***************
*** 41,48 ****
         /* tpm_device_paths is filled out in tddl.h */
         for (i = 0; tpm_device_nodes[i].path != NULL; i++) {
                 errno = 0;
!               if ((tpm_device_nodes[i].fd = open(tpm_device_nodes[i].path, 
O_RDWR)) < 0)
                         continue;

                 opened_device = &(tpm_device_nodes[i]);
                 return opened_device->fd;
--- 45,55 ----
         /* tpm_device_paths is filled out in tddl.h */
         for (i = 0; tpm_device_nodes[i].path != NULL; i++) {
                 errno = 0;
!               if ((tpm_device_nodes[i].fd = open(tpm_device_nodes[i].path, 
O_RDWR)) < 0) {
!                       fprintf(stderr, "Error opening %s: %s\n",
!                               tpm_device_nodes[i].path, strerror(errno));
                         continue;
+               }

                 opened_device = &(tpm_device_nodes[i]);
                 return opened_device->fd;
***************
*** 109,119 ****
--- 116,128 ----
                         /* fall through */
                 case TDDL_TRANSMIT_IOCTL:
                         errno = 0;
+ #ifndef SOLARIS
                         if ((sizeResult = ioctl(opened_device->fd, 
TPMIOC_TRANSMIT, txBuffer)) != -1) {
                                 opened_device->transmit = TDDL_TRANSMIT_IOCTL;
                                 break;
                         }
                         LogWarn("ioctl: (%d) %s", errno, strerror(errno));
+ #endif
                         LogInfo("Falling back to Read/Write device support.");
                         /* fall through */
                 case TDDL_TRANSMIT_RW:
***************
*** 183,188 ****
--- 192,198 ----

   TSS_RESULT Tddli_Cancel(void)
   {
+ #ifndef SOLARIS
         int rc;

         if (opened_device->transmit == TDDL_TRANSMIT_IOCTL) {
***************
*** 198,201 ****
--- 208,213 ----
         } else {
                 return TDDLERR(TSS_E_NOTIMPL);
         }
+ #endif /* SOLARIS */
+       return TDDLERR(TSS_E_NOTIMPL);
   }

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to