[prev in list] [next in list] [prev in thread] [next in thread] 

List:       trousers-tech
Subject:    [TrouSerS-tech] tddl.c patch
From:       Wyllys Ingersoll <wyllys.ingersoll () sun ! com>
Date:       2008-12-09 14:24:01
Message-ID: 493E7F81.1030209 () sun ! com
[Download RAW message or body]

Changes:
* The Solaris TPM device is always "/dev/tpm", don't bother checking the 
others.
* Solaris TPM does not have a TPMIOC_TRANSMIT ioctl, it uses read/write 
only.





["tddl.c.patch" (text/plain)]

*** 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 __sun__
  #include "linux/tpm.h"
+ #endif
  #include "tcslog.h"
  #include "tddl.h"
  
  struct tpm_device_node tpm_device_nodes[] = {
+ #ifndef __sun__
  	{"/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 __sun__
  			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 __sun__
  	int rc;
  
  	if (opened_device->transmit == TDDL_TRANSMIT_IOCTL) {
***************
*** 198,201 ****
--- 208,213 ----
  	} else {
  		return TDDLERR(TSS_E_NOTIMPL);
  	}
+ #endif /* __sun__ */
+ 	return TDDLERR(TSS_E_NOTIMPL);
  }


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/

_______________________________________________
TrouSerS-tech mailing list
TrouSerS-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/trousers-tech


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic