diff mbox

[2/2] fwts-test: Add regression test for TPM2, update fwst-tests

Message ID 1436954227-9251-3-git-send-email-alex.hung@canonical.com
State Rejected
Headers show

Commit Message

Alex Hung July 15, 2015, 9:57 a.m. UTC
Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 Makefile.am                                        |  2 ++
 .../arg-show-tests-0001/arg-show-tests-0001.log    |  2 ++
 .../arg-show-tests-full-0001.log                   |  6 ++++-
 fwts-test/tpm2-0001/acpidump-0001.log              | 30 ++++++++++++++++++++++
 fwts-test/tpm2-0001/acpidump-0002.log              | 30 ++++++++++++++++++++++
 fwts-test/tpm2-0001/test-0001.sh                   | 17 ++++++++++++
 fwts-test/tpm2-0001/test-0002.sh                   | 17 ++++++++++++
 fwts-test/tpm2-0001/tpm2-0001.log                  | 14 ++++++++++
 fwts-test/tpm2-0001/tpm2-0002.log                  | 19 ++++++++++++++
 9 files changed, 136 insertions(+), 1 deletion(-)
 create mode 100644 fwts-test/tpm2-0001/acpidump-0001.log
 create mode 100644 fwts-test/tpm2-0001/acpidump-0002.log
 create mode 100755 fwts-test/tpm2-0001/test-0001.sh
 create mode 100755 fwts-test/tpm2-0001/test-0002.sh
 create mode 100644 fwts-test/tpm2-0001/tpm2-0001.log
 create mode 100644 fwts-test/tpm2-0001/tpm2-0002.log
diff mbox

Patch

diff --git a/Makefile.am b/Makefile.am
index a431c2e..0cf0db5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,6 +106,8 @@  TESTS = fwts-test/acpidump-0001/test-0001.sh \
 	fwts-test/syntaxcheck-0001/test-0001.sh \
 	fwts-test/tcpa-0001/test-0001.sh \
 	fwts-test/tcpa-0001/test-0002.sh \
+	fwts-test/tpm2-0001/test-0001.sh \
+	fwts-test/tpm2-0001/test-0002.sh \
 	fwts-test/uefi-0001/test-0001.sh \
 	fwts-test/uefi-0001/test-0002.sh \
 	fwts-test/waet-0001/test-0001.sh \
diff --git a/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log b/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log
index 967fddd..afc8bfb 100644
--- a/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log
+++ b/fwts-test/arg-show-tests-0001/arg-show-tests-0001.log
@@ -34,6 +34,7 @@  ACPI tests:
  spmi            SPMI Service Processor Management Interface Description Table test.
  srat            SRAT System Resource Affinity Table test.
  tcpa            Trusted Computing Platform Alliance Capabilities Table test.
+ tpm2            Trusted Platform Module 2 test.
  uefi            UEFI Data Table test.
  waet            Windows ACPI Emulated Devices Table test.
  wmi             Extract and analyse Windows Management Instrumentation (WMI).
@@ -102,6 +103,7 @@  Batch tests:
  srat            SRAT System Resource Affinity Table test.
  syntaxcheck     Re-assemble DSDT and SSDTs to find syntax errors and warnings.
  tcpa            Trusted Computing Platform Alliance Capabilities Table test.
+ tpm2            Trusted Platform Module 2 test.
  uefi            UEFI Data Table test.
  uefibootpath    Sanity check for UEFI Boot Path Boot####.
  version         Gather kernel system information.
diff --git a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log
index e12993c..43c4064 100644
--- a/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log
+++ b/fwts-test/arg-show-tests-full-0001/arg-show-tests-full-0001.log
@@ -256,6 +256,8 @@  ACPI tests:
   SRAT System Resource Affinity Table test.
  tcpa            (1 test):
   Validate TCPA table.
+ tpm2            (1 test):
+  Validate TPM2 table.
  uefi            (1 test):
   UEFI Data Table test.
  waet            (1 test):
@@ -603,6 +605,8 @@  Batch tests:
   Disassemble and reassemble DSDT and SSDTs.
  tcpa            (1 test):
   Validate TCPA table.
+ tpm2            (1 test):
+  Validate TPM2 table.
  uefi            (1 test):
   UEFI Data Table test.
  uefibootpath    (1 test):
@@ -816,4 +820,4 @@  UEFI tests:
   Test UEFI RT service query variable info interface stress test.
   Test UEFI RT service get variable interface, invalid parameters.
 
-Total of 662 tests
+Total of 664 tests
diff --git a/fwts-test/tpm2-0001/acpidump-0001.log b/fwts-test/tpm2-0001/acpidump-0001.log
new file mode 100644
index 0000000..d872358
--- /dev/null
+++ b/fwts-test/tpm2-0001/acpidump-0001.log
@@ -0,0 +1,30 @@ 
+FACS @ 0x00000000
+  0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00  FACS@...........
+  0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+
+FACP @ 0x00000000
+  0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20  FACP......AMD
+  0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20  GUAM    ....AMD
+  0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00  @B.../...G......
+  0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00  ................
+  0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00  ................
+  0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
+  0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00  e...........2...
+  0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af  ...../.......G..
+  0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00  ..... ..........
+  00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
+  00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00  ................
+  00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00  . ...........@..
+  00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ...............
+  00f0: 00 00 00 00                                      ....
+
+TPM2 @ 0x00000000
+  0000: 54 50 4D 32 34 00 00 00 03 4F 49 4E 54 45 4C 20  TPM24....OINTEL
+  0010: 54 45 4D 50 4C 41 54 45 01 00 00 00 49 4E 54 4C  TEMPLATE....INTL
+  0020: 14 02 14 20 00 00 00 00 77 66 55 44 33 22 11 00  ... ....wfUD3"..
+  0030: 01 00 00 00                                         ....
diff --git a/fwts-test/tpm2-0001/acpidump-0002.log b/fwts-test/tpm2-0001/acpidump-0002.log
new file mode 100644
index 0000000..fed8105
--- /dev/null
+++ b/fwts-test/tpm2-0001/acpidump-0002.log
@@ -0,0 +1,30 @@ 
+FACS @ 0x00000000
+  0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00  FACS@...........
+  0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+
+FACP @ 0x00000000
+  0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20  FACP......AMD
+  0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20  GUAM    ....AMD
+  0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00  @B.../...G......
+  0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00  ................
+  0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00  ................
+  0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00   ...............
+  0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00  e...........2...
+  0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af  ...../.......G..
+  0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00  ..... ..........
+  00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00  ................
+  00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
+  00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00  ................
+  00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00  . ...........@..
+  00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ...............
+  00f0: 00 00 00 00                                      ....
+
+TPM2 @ 0x00000000
+  0000: 54 50 4D 32 34 00 00 00 03 40 49 4E 54 45 4C 20  TPM24....@INTEL
+  0010: 54 45 4D 50 4C 41 54 45 01 00 00 00 49 4E 54 4C  TEMPLATE....INTL
+  0020: 14 02 14 20 04 00 03 00 77 66 55 44 33 22 11 00  ... ....wfUD3"..
+  0030: 09 00 00 00                                         ....
diff --git a/fwts-test/tpm2-0001/test-0001.sh b/fwts-test/tpm2-0001/test-0001.sh
new file mode 100755
index 0000000..d583163
--- /dev/null
+++ b/fwts-test/tpm2-0001/test-0001.sh
@@ -0,0 +1,17 @@ 
+#!/bin/bash
+#
+TEST="Test table against TPM2"
+NAME=test-0001.sh
+TMPLOG=$TMP/tpm2.log.$$
+
+$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/tpm2-0001/acpidump-0001.log tpm2 - | cut -c7- | grep "^tpm2" > $TMPLOG
+diff $TMPLOG $FWTSTESTDIR/tpm2-0001/tpm2-0001.log >> $FAILURE_LOG
+ret=$?
+if [ $ret -eq 0 ]; then
+	echo PASSED: $TEST, $NAME
+else
+	echo FAILED: $TEST, $NAME
+fi
+
+rm $TMPLOG
+exit $ret
diff --git a/fwts-test/tpm2-0001/test-0002.sh b/fwts-test/tpm2-0001/test-0002.sh
new file mode 100755
index 0000000..9923cd7
--- /dev/null
+++ b/fwts-test/tpm2-0001/test-0002.sh
@@ -0,0 +1,17 @@ 
+#!/bin/bash
+#
+TEST="Test table against invalid TPM2"
+NAME=test-0001.sh
+TMPLOG=$TMP/tpm2.log.$$
+
+$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/tpm2-0001/acpidump-0002.log tpm2 - | cut -c7- | grep "^tpm2" > $TMPLOG
+diff $TMPLOG $FWTSTESTDIR/tpm2-0001/tpm2-0002.log >> $FAILURE_LOG
+ret=$?
+if [ $ret -eq 0 ]; then
+	echo PASSED: $TEST, $NAME
+else
+	echo FAILED: $TEST, $NAME
+fi
+
+rm $TMPLOG
+exit $ret
diff --git a/fwts-test/tpm2-0001/tpm2-0001.log b/fwts-test/tpm2-0001/tpm2-0001.log
new file mode 100644
index 0000000..81a9151
--- /dev/null
+++ b/fwts-test/tpm2-0001/tpm2-0001.log
@@ -0,0 +1,14 @@ 
+tpm2            tpm2: Trusted Platform Module 2 test.
+tpm2            ----------------------------------------------------------
+tpm2            Test 1 of 1: Validate TPM2 table.
+tpm2            TPM2 Table:
+tpm2              Platform Class:                  0x0000
+tpm2              Reserved:                        0x0000
+tpm2              Address of Control Area:         0x0011223344556677
+tpm2              Start Method:                    0x00000001
+tpm2            PASSED: Test 1, No issues found in TPM2 table.
+tpm2            
+tpm2            ==========================================================
+tpm2            1 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0
+tpm2            info only.
+tpm2            ==========================================================
diff --git a/fwts-test/tpm2-0001/tpm2-0002.log b/fwts-test/tpm2-0001/tpm2-0002.log
new file mode 100644
index 0000000..170ad6e
--- /dev/null
+++ b/fwts-test/tpm2-0001/tpm2-0002.log
@@ -0,0 +1,19 @@ 
+tpm2            tpm2: Trusted Platform Module 2 test.
+tpm2            ----------------------------------------------------------
+tpm2            Test 1 of 1: Validate TPM2 table.
+tpm2            TPM2 Table:
+tpm2              Platform Class:                  0x0004
+tpm2              Reserved:                        0x0003
+tpm2              Address of Control Area:         0x0011223344556677
+tpm2              Start Method:                    0x00000009
+tpm2            FAILED [HIGH] TPM2BadPlatformClass: Test 1, TPM2's
+tpm2            platform class must be zero or one, got 0x4
+tpm2            FAILED [LOW] TPM2ReservedNonZero: Test 1, TPM2 reserved
+tpm2            field must be zero, got 0x0003 instead
+tpm2            FAILED [HIGH] TPM2BadStartMethod: Test 1, TPM2's Start
+tpm2            Method greater than 8 is reserved, got 0x9
+tpm2            
+tpm2            ==========================================================
+tpm2            0 passed, 3 failed, 0 warning, 0 aborted, 0 skipped, 0
+tpm2            info only.
+tpm2            ==========================================================