]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: Do not set PTM_CAP_SET_DATAFD flag on Cygwin
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 6 Oct 2017 01:30:59 +0000 (21:30 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Wed, 11 Oct 2017 22:57:16 +0000 (18:57 -0400)
The control channel of a UnixIO socket is not supported
on Cygwin, so do not present this flag. Return an error
if this command is run.

Adapt the test case.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
src/swtpm/ctrlchannel.c
tests/test_ctrlchannel

index e56436c166e3b8d881f0c3c67925b2980a4ea127..1b30dc80f0d202674a33e0581e8a7d995d228ad3 100644 (file)
@@ -467,8 +467,11 @@ int ctrlchannel_process_fd(int fd,
             PTM_CAP_GET_STATEBLOB |
             PTM_CAP_SET_STATEBLOB |
             PTM_CAP_STOP |
-            PTM_CAP_GET_CONFIG |
-            PTM_CAP_SET_DATAFD);
+            PTM_CAP_GET_CONFIG
+#ifndef __CYGWIN__
+            | PTM_CAP_SET_DATAFD
+#endif
+            );
 
         out_len = sizeof(*ptm_caps);
         break;
@@ -693,6 +696,10 @@ int ctrlchannel_process_fd(int fd,
         break;
 
     case CMD_SET_DATAFD:
+#ifdef __CYGWIN__
+        if (1)
+            goto err_running;
+#endif
         if (mlp->fd != -1)
             goto err_io;
 
index 406b2deb73629b841a556d93259ef4e25b42eb12..363e2ed87d81a3e9f7b05f00db4e672553d4c1d8 100755 (executable)
@@ -50,7 +50,11 @@ PID="$(cat $PID_FILE)"
 
 # Get the capability bits: CMD_GET_CAPABILITY = 0x00 00 00 01
 res="$(swtpm_ctrl_tx ${SWTPM_INTERFACE} '\x00\x00\x00\x01')"
-exp=" 00 00 00 00 00 00 1f ff"
+if [[ "$(uname -o)" =~ Linux ]]; then
+       exp=" 00 00 00 00 00 00 1f ff"
+else
+       exp=" 00 00 00 00 00 00 0f ff"
+fi
 if [ "$res" != "$exp" ]; then
        echo "Error: Unexpected response from CMD_GET_CAPABILITY:"
        echo "       actual  : $res"
@@ -162,7 +166,11 @@ swtpm_open_cmddev ${SWTPM_INTERFACE} 100
 
 # Get the capability bits: CMD_GET_CAPABILITY = 0x00 00 00 01
 res="$(swtpm_ctrl_tx ${SWTPM_INTERFACE} '\x00\x00\x00\x01')"
-exp=" 00 00 00 00 00 00 1f ff"
+if [[ "$(uname -o)" =~ Linux ]]; then
+       exp=" 00 00 00 00 00 00 1f ff"
+else
+       exp=" 00 00 00 00 00 00 0f ff"
+fi
 if [ "$res" != "$exp" ]; then
        echo "Error: Socket TPM: Unexpected response from CMD_GET_CAPABILITY:"
        echo "       actual  : $res"