From b5fbddbcf1e4f459095aee771ba134927f5ef33b Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 24 Mar 2016 14:33:53 -0400 Subject: [PATCH] swtpm: deactivate reset establishment Deactivate the code around resetting the TPM established bit since its implementation currently requires libtpms 0.6. Signed-off-by: Stefan Berger --- src/swtpm/ctrlchannel.c | 7 +++--- tests/test_ctrlchannel | 56 ++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/swtpm/ctrlchannel.c b/src/swtpm/ctrlchannel.c index 2d6c7d90..a859d769 100644 --- a/src/swtpm/ctrlchannel.c +++ b/src/swtpm/ctrlchannel.c @@ -1,4 +1,3 @@ -#include /* * ctrlchannel.c -- control channel implementation * @@ -102,7 +101,7 @@ int ctrlchannel_process_fd(int fd, ptm_est *te = (ptm_est *)&output.body; /* Read-write */ ptm_init *init_p; - ptm_reset_est *re; +/* ptm_reset_est *re; */ ptm_getconfig *pgc; ptm_hdata *data; @@ -134,7 +133,7 @@ int ctrlchannel_process_fd(int fd, PTM_CAP_SHUTDOWN | PTM_CAP_STOP | PTM_CAP_GET_TPMESTABLISHED | - PTM_CAP_RESET_TPMESTABLISHED | + /* PTM_CAP_RESET_TPMESTABLISHED | requires libtpms 0.6 */ PTM_CAP_HASHING | PTM_CAP_CANCEL_TPM_CMD | PTM_CAP_STORE_VOLATILE); @@ -202,6 +201,7 @@ int ctrlchannel_process_fd(int fd, break; +/* case CMD_RESET_TPMESTABLISHED: if (!*tpm_running) goto err_not_running; @@ -220,6 +220,7 @@ int ctrlchannel_process_fd(int fd, out_len = sizeof(re->u.resp); break; +*/ case CMD_HASH_START: if (!*tpm_running) diff --git a/tests/test_ctrlchannel b/tests/test_ctrlchannel index 8e950180..d6a0b3fe 100755 --- a/tests/test_ctrlchannel +++ b/tests/test_ctrlchannel @@ -43,7 +43,7 @@ socat -x -t10 FILE:$CMD_PATH,rdonly UNIX-CLIENT:$SOCK_PATH 2>&1 | \ sed -n '/^ /p' | \ tail -n1 > $RESP_PATH res="$(cat $RESP_PATH)" -exp=" 00 00 00 00 00 00 04 f7" +exp=" 00 00 00 00 00 00 04 77" if [ "$res" != "$exp" ]; then echo "Error: Unexpected response from CMD_GET_CAPABILITY:" echo " actual : $res" @@ -180,7 +180,7 @@ socat -x -t10 FILE:$CMD_PATH,rdonly UNIX-CLIENT:$SOCK_PATH 2>&1 | \ sed -n '/^ /p' | \ tail -n1 > $RESP_PATH res="$(cat $RESP_PATH)" -exp=" 00 00 00 00 00 00 04 f7" +exp=" 00 00 00 00 00 00 04 77" if [ "$res" != "$exp" ]; then echo "Error: Socket TPM: Unexpected response from CMD_GET_CAPABILITY:" echo " actual : $res" @@ -323,34 +323,34 @@ if [ "$res" != "$exp" ]; then fi # 5. Send command to reset TPM established flag: CMD_RESET_TPMESTABLISHED = 00 00 00 0b 03 -echo -en '\x00\x00\x00\x0b\x03' > $CMD_PATH -cat $RESP_PATH -socat -x -t10 FILE:$CMD_PATH,rdonly UNIX-CONNECT:$SOCK_PATH 2>&1 | \ - sed -n '/^ /p' | \ - tail -n1 > $RESP_PATH -res="$(cat $RESP_PATH)" -exp=" 00 00 00 00" -if [ "$res" != "$exp" ]; then - echo "Error: Socket TPM: Unexpected response from sending CMD_GET_TPMESTABLISHED command:" - echo " actual : $res" - echo " expected: $exp" - exit 1 -fi +#echo -en '\x00\x00\x00\x0b\x03' > $CMD_PATH +#cat $RESP_PATH +#socat -x -t10 FILE:$CMD_PATH,rdonly UNIX-CONNECT:$SOCK_PATH 2>&1 | \ +# sed -n '/^ /p' | \ +# tail -n1 > $RESP_PATH +#res="$(cat $RESP_PATH)" +#exp=" 00 00 00 00" +#if [ "$res" != "$exp" ]; then +# echo "Error: Socket TPM: Unexpected response from sending CMD_GET_TPMESTABLISHED command:" +# echo " actual : $res" +# echo " expected: $exp" +# exit 1 +#fi # 6. Send command to get TPM established flag: CMD_GET_TPMESTABLISHED = 00 00 00 04 -echo -en '\x00\x00\x00\x04' > $CMD_PATH -cat $RESP_PATH -socat -x -t10 FILE:$CMD_PATH,rdonly UNIX-CONNECT:$SOCK_PATH 2>&1 | \ - sed -n '/^ /p' | \ - tail -n1 > $RESP_PATH -res="$(cat $RESP_PATH)" -exp=" 00 00 00 00 00 00 00 00" -if [ "$res" != "$exp" ]; then - echo "Error: Socket TPM: Unexpected response from sending CMD_GET_TPMESTABLISHED command:" - echo " actual : $res" - echo " expected: $exp" - exit 1 -fi +#echo -en '\x00\x00\x00\x04' > $CMD_PATH +#cat $RESP_PATH +#socat -x -t10 FILE:$CMD_PATH,rdonly UNIX-CONNECT:$SOCK_PATH 2>&1 | \ +# sed -n '/^ /p' | \ +# tail -n1 > $RESP_PATH +#res="$(cat $RESP_PATH)" +#exp=" 00 00 00 00 00 00 00 00" +#if [ "$res" != "$exp" ]; then +# echo "Error: Socket TPM: Unexpected response from sending CMD_GET_TPMESTABLISHED command:" +# echo " actual : $res" +# echo " expected: $exp" +# exit 1 +#fi # Read PCR 17 exec 100<>/dev/tcp/localhost/65530