I am trying, unsuccessfully, to see how the TPM_CC_Hash value 0x0000017D gets sent to the swtpm.   Additionally, the _test_hashing script is sending the string “1234” to the swtpm and then verifies a twenty byte return, which is 160 bits, against the hash code “97 e9 76 e4 f2 2c d6 d2 4a fd 21 20 85 ad 7a 86 64 7f 2a e5” which does not appear to correspond to to any hash that I separately calculate.  Nor do I see where the hashing algorithm to be used is sent to the swtpm (eg 0x0004 for sha1 or 0x000b for sha2.

 

I was hoping to use the existing tests as templates for new tests such as testing TPM_CC_GetRandom.  I can’t do that if I cannot find where the TPM_CC_Hash is specified or where the hashing algorithm to use is specified.

 

The _test_hashing code is

 

run_swtpm_ioctl ${SWTPM_INTERFACE} -h 1234

if [ $? -ne 0 ]; then

        echo "Error: Hash command did not work."

        exit 1

fi

 

# Read PCR 17

Swtpm_open_cmddev ${SWTPM_INTERFACE} 100

RES=$(swtpm_cmd_tx ${SWTPM_INTERFACE} '\x00\xC1\x00\x00\x00\x0E\x00\x00\x00\x15\x00\x00\x00\x11')

exp=' 00 c4 00 00 00 1e 00 00 00 00 97 e9 76 e4 f2 2c d6 d2 4a fd 21 20 85 ad 7a 86 64 7f 2a e5'

if [ "$RES" != "$exp" ]; then

        echo "Error: (1) Did not get expected result from TPM_PCRRead(17)"

        echo "expected: $exp"

        echo "received: $RES"

        exit 1

fi

 

Any pointers will be appreciated.  This is the first time I have attempted to use a tpm so the answer is probably something obvious that I am overlooking.

 

Thomas Stone, CISSP

Information Assurance Engineer Staff

Lockheed Martin Missiles and Fire Control

Phone (407) 356-6913

Cell (919) 812-0607

Email: thomas.g.stone@lmco.com