TPM2 (Trusted Platform Module) userspace development
 help / color / mirror / Atom feed
From: Stone, Thomas G <thomas.g.stone at lmco.com>
To: tpm2@lists.01.org
Subject: [tpm2] swtpm tests question
Date: Wed, 18 Sep 2019 16:35:05 +0000	[thread overview]
Message-ID: <3c698152b8aa4634943393c8f2d9ea45@lmco.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

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(a)lmco.com<mailto:thomas.g.stone(a)lmco.com>



[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 8335 bytes --]

             reply	other threads:[~2019-09-18 16:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-18 16:35 Stone, Thomas G [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-09-19 14:34 [tpm2] swtpm tests question Roberts, William C
2019-09-19 15:47 Tricca, Philip B
2019-09-19 16:54 Roberts, William C

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c698152b8aa4634943393c8f2d9ea45@lmco.com \
    --to=tpm2@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox