[SLOF] [PATCH v4 0/5] tcgbios: Use the proper hashes for the TPM 2 PCR banks

Stefan Berger stefanb at linux.vnet.ibm.com
Sat Jul 10 01:38:58 AEST 2021


From: Stefan Berger <stefanb at linux.ibm.com>

This PR modifies the tcgbios implementation so that it maskes use of the
proper hash function when extending a PCR of a particular PCR bank
rather than always using the sha256 and either truncating the hash or
zero-padding it to fit the hash for a PCR bank.

Another patch in this series converts the S_CTRM_VERSION string to ucs-2
format (following a long-term TCG contributor) commonly used for this
purpose.

Test cases for the sha implementations are added as well. They require
OpenSSL's -lcrypto on the host since they use its hashing functions
for producing comparable results. A test script to run the tests is also
added along with a script to run the tests on Travis.

Regards,
    Stefan

v4:
  - Removed applied patches
  - Refactored test scripts and modified programs following feedback
  - Adjusted commit texts
  - Using Alexey's ucs-2 patch now

v3:
  - Add patch for Travis
  - Adjustments to test code to not have to include openssl/sha.h

v2:
  - split out type fix in sha256 documentation into own patch
  - replace rotr in sha256 implementation with assembly macro
  - Added test cases needing -lcrypto on host; added test script


Stefan Berger (5):
  tcgbios: Change format of S_CRTM_VERSION string to ucs-2
  tcgbios: Use assembly for 32 bit rotr in sha256
  tcgbios: Use The proper sha function for each PCR bank
  tcgbios: Add test cases and test script to run them
  Travis: Add script for running tests on Travis

 .travis.yml           | 15 ++++++++++
 Makefile.gen          |  2 +-
 lib/libtpm/Makefile   |  1 +
 lib/libtpm/sha.c      | 27 ++++++++++++++++++
 lib/libtpm/sha256.c   | 40 +++++++++++++++++++++++---
 lib/libtpm/sha512.c   | 36 ++++++++++++++++++++++++
 lib/libtpm/sha_test.h | 59 +++++++++++++++++++++++++++++++++++++++
 lib/libtpm/tcgbios.c  | 65 +++++++++++++++++++++++++++++--------------
 lib/libtpm/test.sh    | 31 +++++++++++++++++++++
 make.rules            |  3 +-
 10 files changed, 252 insertions(+), 27 deletions(-)
 create mode 100644 .travis.yml
 create mode 100644 lib/libtpm/sha_test.h
 create mode 100755 lib/libtpm/test.sh

-- 
2.17.1



More information about the SLOF mailing list