Hello community,

here is the log from the commit of package fwts for openSUSE:Factory checked in 
at 2020-08-13 10:17:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/fwts (Old)
 and      /work/SRC/openSUSE:Factory/.fwts.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "fwts"

Thu Aug 13 10:17:16 2020 rev:50 rq:826008 version:20.07.00

Changes:
--------
--- /work/SRC/openSUSE:Factory/fwts/fwts.changes        2020-07-21 
15:54:10.644572507 +0200
+++ /work/SRC/openSUSE:Factory/.fwts.new.3399/fwts.changes      2020-08-13 
10:19:59.378802188 +0200
@@ -1,0 +2,6 @@
+Wed Aug 12 11:12:15 UTC 2020 - Martin Pluskal <[email protected]>
+
+- Update to version 20.07.00:
+  * See provided changelog for detailed list of changes  
+
+-------------------------------------------------------------------

Old:
----
  fwts-V20.06.01.tar.gz

New:
----
  fwts-V20.07.00.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ fwts.spec ++++++
--- /var/tmp/diff_new_pack.LUXuQ6/_old  2020-08-13 10:20:01.134802909 +0200
+++ /var/tmp/diff_new_pack.LUXuQ6/_new  2020-08-13 10:20:01.134802909 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           fwts
-Version:        20.06.01
+Version:        20.07.00
 Release:        0
 Summary:        Firmware Test Suite
 License:        GPL-2.0-or-later

++++++ fwts-V20.06.01.tar.gz -> fwts-V20.07.00.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/.travis.yml new/.travis.yml
--- old/.travis.yml     2020-06-23 10:41:26.000000000 +0200
+++ new/.travis.yml     2020-07-29 09:32:51.000000000 +0200
@@ -1,4 +1,4 @@
-dist: trusty
+dist: focal
 sudo: required
 
 before_install:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/auto-packager/mkpackage.sh 
new/auto-packager/mkpackage.sh
--- old/auto-packager/mkpackage.sh      2020-06-23 10:41:26.000000000 +0200
+++ new/auto-packager/mkpackage.sh      2020-07-29 09:32:51.000000000 +0200
@@ -23,7 +23,7 @@
 # Get fwts sources, strip out .git directory, add in necessary debian packaging
 # files, build source package ready for upload.
 #
-RELEASES="xenial bionic eoan focal groovy"
+RELEASES="xenial bionic focal groovy"
 REPO=git://kernel.ubuntu.com/hwe/fwts.git
 RELEASE_TAR_URL=http://fwts.ubuntu.com/release
 FWTS=fwts
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/data/klog.json new/data/klog.json
--- old/data/klog.json  2020-06-23 10:41:26.000000000 +0200
+++ new/data/klog.json  2020-07-29 09:32:51.000000000 +0200
@@ -1616,7 +1616,7 @@
    "compare_mode": "string",
    "log_level": "LOG_LEVEL_LOW",
    "pattern": "acpi=force override",
-   "advice": "The kernel has been forced to enabled ACPI. This is sometimes 
required because ACPI support has been disabled because the firmware is too old 
or was blacklisted because it has known ACPI issues.",
+   "advice": "The kernel has been forced to enabled ACPI. This is sometimes 
required because ACPI support has been disabled because the firmware is too old 
or was blocklisted because it has known ACPI issues.",
    "label": "KlogAcpiForceOverride"
   },
   {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/debian/changelog new/debian/changelog
--- old/debian/changelog        2020-06-23 10:41:26.000000000 +0200
+++ new/debian/changelog        2020-07-29 09:32:51.000000000 +0200
@@ -1,3 +1,29 @@
+fwts (20.07.00-0ubuntu1) groovy; urgency=medium
+
+  [Alex Hung]
+  * auto-packager: mkpackage.sh: remove eoan
+  * travis: update dist to focal
+  * tpm2: table size can be 76 when "LAML" & "LASA" are used
+
+  [Colin Ian King]
+  * replace inaccurate and offsensive language
+  * acpi: mpst: fix potential infinite loop on 16 bit counter j
+  * tpmevlogdump: fix leak of fd on error return paths, voidify close returns
+  * opal: add check for the number of regions
+  * ACPICA: Update to version 20200717
+  * Add riscv64 architecture to fwts
+  * lib: fwts_modprobe: add helper to build module path name
+  * lib: fwts_battery: add helper to build battery path name
+
+  [Ivan Hu]
+  * tpmevlogdump: add function for dumping tpm event log
+  * tpmevlogdump: add pcr_index usage
+  * libfwtsiasl: fix build error on groovy
+  * lib: fwts_battery: fix build error on armhf
+  * lib: fwts_buttion: add helper function to build button path
+
+ -- Ivan Hu <[email protected]>  Wed, 29 Jul 2020 15:30:01 +0800
+
 fwts (20.06.01-0ubuntu1) groovy; urgency=medium
 
   [Alex Hung]
@@ -3590,7 +3616,7 @@
   * data: klog.json: Add support for the ACPI device power handler
   * data: klog.json: Add support for the ACPI PCI root handler
   * data: klog.json: Add support for the ACPI initialisation error messages
-  * data: klog.json: Add support for the ACPI blacklisting messages
+  * data: klog.json: Add support for the ACPI blocklisting messages
   * data: klog.json: Add support for the ACPI osl messages
   * data: klog.json: Add support for the ACPI memory hotplug messages
   * data: klog.json: Add support for the ACPI glue code
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/debian/control new/debian/control
--- old/debian/control  2020-06-23 10:41:26.000000000 +0200
+++ new/debian/control  2020-07-29 09:32:51.000000000 +0200
@@ -7,7 +7,7 @@
 Build-Depends: debhelper (>= 7.0.50~), autoconf, automake, libtool, 
libjson0-dev | libjson-c-dev (>= 0.9), flex, bison, dh-autoreconf, dkms, 
libglib2.0-dev, pkg-config, libfdt-dev, libbsd-dev
 
 Package: fwts
-Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x
+Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x riscv64
 Depends: libfwtsiasl1 (= ${binary:Version}), libfwtsacpica1 (= 
${binary:Version}), libfwts1 (= ${binary:Version}), fwts-efi-runtime-dkms (= 
${binary:Version}) [amd64] , ${shlibs:Depends}, ${misc:Depends}, pciutils, 
device-tree-compiler [ppc64el powerpc]
 Suggests: dmidecode
 Description: FirmWare Test Suite
@@ -18,7 +18,7 @@
  be a Linux-centric firmware troubleshooting tool.
 
 Package: libfwtsiasl1
-Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x
+Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x riscv64
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: FirmWare Test Suite ACPICA core built for iasl functionality
  The firmware test suite requires the ACPICA core engine to be built in
@@ -28,7 +28,7 @@
  interface with fwts.
 
 Package: libfwtsacpica1
-Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x
+Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x riscv64
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: FirmWare Test Suite ACPICA core built for acpiexec functionality
  The firmware test suite requires the ACPICA core engine to be built in
@@ -37,7 +37,7 @@
  contains this code with a thin fwts specific API to interface with fwts.
 
 Package: libfwts1
-Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x
+Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x riscv64
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: FirmWare Test Suite core support library
  This is the fwts core library. It contains a top level test framework
@@ -45,7 +45,7 @@
  various fwts tests.
 
 Package: fwts-frontend
-Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x
+Architecture: i386 amd64 armel armhf arm64 ppc64 ppc64el s390x riscv64
 Priority: optional
 Depends: ${misc:Depends}, dialog, fwts
 Description: Firmware Test Suite frontend interface
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/snapcraft.yaml new/snapcraft.yaml
--- old/snapcraft.yaml  2020-06-23 10:41:26.000000000 +0200
+++ new/snapcraft.yaml  2020-07-29 09:32:51.000000000 +0200
@@ -1,5 +1,5 @@
 name: fwts
-version: V20.06.01
+version: V20.07.00
 summary: The Firmware Test Suite (FWTS)
 description: This is a firmware test suite that performs sanity checks on 
system firmware. It is intended to identify BIOS and ACPI errors and if 
appropriate it will try to explain the errors and give advice to help 
workaround or fix firmware bugs.  It is primarily intended to be a 
Linux-centric firmware troubleshooting tool.
 confinement: strict
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/Makefile.am new/src/Makefile.am
--- old/src/Makefile.am 2020-06-23 10:41:26.000000000 +0200
+++ new/src/Makefile.am 2020-07-29 09:32:51.000000000 +0200
@@ -183,6 +183,7 @@
        pci/aspm/aspm.c                         \
        pci/crs/crs.c                           \
        pci/maxreadreq/maxreadreq.c             \
+       tpm/tpmevlogdump/tpmevlogdump.c         \
        uefi/csm/csm.c                          \
        uefi/uefidump/uefidump.c                \
        uefi/uefirttime/uefirttime.c            \
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpi/mpst/mpst.c new/src/acpi/mpst/mpst.c
--- old/src/acpi/mpst/mpst.c    2020-06-23 10:41:26.000000000 +0200
+++ new/src/acpi/mpst/mpst.c    2020-07-29 09:32:51.000000000 +0200
@@ -47,7 +47,8 @@
        bool passed = true;
        uint32_t reserved;
        uint32_t node_offset;
-       uint16_t i, j;
+       uint32_t j;
+       uint16_t i;
 
        reserved = (uint32_t) mpst->reserved[0] +
                   ((uint32_t) mpst->reserved[1] << 8) +
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpi/tpm2/tpm2.c new/src/acpi/tpm2/tpm2.c
--- old/src/acpi/tpm2/tpm2.c    2020-06-23 10:41:26.000000000 +0200
+++ new/src/acpi/tpm2/tpm2.c    2020-07-29 09:32:51.000000000 +0200
@@ -72,22 +72,25 @@
                        tpm2->start_method);
        }
 
-       if (tpm2->start_method == 2 && table->length != 
sizeof(fwts_acpi_table_tpm2) + 4) {
-               passed = false;
-               fwts_failed(fw, LOG_LEVEL_HIGH,
-                       "TPM2BadPlatformParameters",
-                       "Table length must be 0x%" PRIx32 " if Start method 
equals 2, got 0x%" PRIx32,
-                       (uint32_t) sizeof(fwts_acpi_table_tpm2) + 4,
-                       (uint32_t) table->length);
-       }
+       /* When TPM2 includes fields "LAML" & "LASA", table size will be fixed 
to 76. */
+       if (table->length != 76) {
+               if (tpm2->start_method == 2 && table->length != 
sizeof(fwts_acpi_table_tpm2) + 4) {
+                       passed = false;
+                       fwts_failed(fw, LOG_LEVEL_HIGH,
+                               "TPM2BadPlatformParameters",
+                               "Table length must be 0x%" PRIx32 " if Start 
Method equals 2, "
+                               "got 0x%" PRIx32, (uint32_t) 
sizeof(fwts_acpi_table_tpm2) + 4,
+                               (uint32_t) table->length);
+               }
 
-       if (tpm2->start_method == 11 && table->length < 
sizeof(fwts_acpi_table_tpm2) + 12) {
-               passed = false;
-               fwts_failed(fw, LOG_LEVEL_HIGH,
-                       "TPM2BadPlatformParameters",
-                       "Table length must be atleast 0x%" PRIx32 " if Start 
method equals 11, got 0x%" PRIx32,
-                       (uint32_t) sizeof(fwts_acpi_table_tpm2) + 12,
-                       (uint32_t) table->length);
+               if (tpm2->start_method == 11 && table->length < 
sizeof(fwts_acpi_table_tpm2) + 12) {
+                       passed = false;
+                       fwts_failed(fw, LOG_LEVEL_HIGH,
+                               "TPM2BadPlatformParameters",
+                               "Table length must be at least 0x%" PRIx32 " if 
Start Method equals 11, "
+                               "got 0x%" PRIx32, (uint32_t) 
sizeof(fwts_acpi_table_tpm2) + 12,
+                               (uint32_t) table->length);
+               }
        }
 
        if (passed)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/compiler/aslerror.c 
new/src/acpica/source/compiler/aslerror.c
--- old/src/acpica/source/compiler/aslerror.c   2020-06-23 10:41:26.000000000 
+0200
+++ new/src/acpica/source/compiler/aslerror.c   2020-07-29 09:32:51.000000000 
+0200
@@ -1056,7 +1056,7 @@
     UINT8                   Level,
     UINT16                  MessageId)
 {
-    UINT16                  i;
+    UINT32                  i;
     UINT16                  ExceptionCode;
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/compiler/aslexternal.c 
new/src/acpica/source/compiler/aslexternal.c
--- old/src/acpica/source/compiler/aslexternal.c        2020-06-23 
10:41:26.000000000 +0200
+++ new/src/acpica/source/compiler/aslexternal.c        2020-07-29 
09:32:51.000000000 +0200
@@ -200,6 +200,14 @@
 
 
     ExternType = AnMapObjTypeToBtype (ExternTypeOp);
+    if (ExternType != ACPI_BTYPE_METHOD)
+    {
+        /*
+         * If this is not a method, it has zero parameters this local variable
+         * is used only for methods
+         */
+        ParamCount = 0;
+    }
 
     /*
      * The parser allows optional parameter return types regardless of the
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/compiler/aslload.c 
new/src/acpica/source/compiler/aslload.c
--- old/src/acpica/source/compiler/aslload.c    2020-06-23 10:41:26.000000000 
+0200
+++ new/src/acpica/source/compiler/aslload.c    2020-07-29 09:32:51.000000000 
+0200
@@ -1177,13 +1177,13 @@
          * previously declared External
          */
         Node->Flags &= ~ANOBJ_IS_EXTERNAL;
-        Node->Type = (UINT8) ExternalOpType;
+        Node->Type = (UINT8) ActualOpType;
 
         /* Just retyped a node, probably will need to open a scope */
 
-        if (AcpiNsOpensScope (ExternalOpType))
+        if (AcpiNsOpensScope (ActualOpType))
         {
-            Status = AcpiDsScopeStackPush (Node, ExternalOpType, WalkState);
+            Status = AcpiDsScopeStackPush (Node, ActualOpType, WalkState);
             if (ACPI_FAILURE (Status))
             {
                 return (Status);
@@ -1204,11 +1204,11 @@
     }
     else if ((Node->Flags & ANOBJ_IS_EXTERNAL) &&
              (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) &&
-             (ExternalOpType == ACPI_TYPE_ANY))
+             (ActualOpType == ACPI_TYPE_ANY))
     {
         /* Allow update of externals of unknown type. */
 
-        Node->Type = (UINT8) ExternalOpType;
+        Node->Type = (UINT8) ActualExternalOpType;
         Status = AE_OK;
     }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/compiler/aslmethod.c 
new/src/acpica/source/compiler/aslmethod.c
--- old/src/acpica/source/compiler/aslmethod.c  2020-06-23 10:41:26.000000000 
+0200
+++ new/src/acpica/source/compiler/aslmethod.c  2020-07-29 09:32:51.000000000 
+0200
@@ -306,6 +306,8 @@
         {
             ActualArgs = MtProcessParameterTypeList (NextType,
                 MethodInfo->ValidArgTypes);
+            MethodInfo->NumArguments = ActualArgs;
+            ArgNode->Asl.Value.Integer |= ActualArgs;
         }
 
         if ((MethodInfo->NumArguments) &&
@@ -671,6 +673,16 @@
     UINT8                   ParameterCount = 0;
 
 
+    if (ParamTypeOp && ParamTypeOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+    {
+        /* Special case for a single parameter without braces */
+
+        TypeList[ParameterCount] =
+            MtProcessTypeOp (ParamTypeOp);
+
+        return (1);
+    }
+
     while (ParamTypeOp)
     {
         TypeList[ParameterCount] =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/compiler/aslxref.c 
new/src/acpica/source/compiler/aslxref.c
--- old/src/acpica/source/compiler/aslxref.c    2020-06-23 10:41:26.000000000 
+0200
+++ new/src/acpica/source/compiler/aslxref.c    2020-07-29 09:32:51.000000000 
+0200
@@ -994,12 +994,14 @@
          * invocation of the method, it is simply a reference to the method.
          *
          * September 2016: Removed DeRefOf from this list
+         * July 2020: Added Alias to this list
          */
         if ((Op->Asl.Parent) &&
             ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF)     ||
             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_PACKAGE)    ||
             (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)||
-            (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
+            (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE) ||
+            (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_ALIAS)))
         {
             return_ACPI_STATUS (AE_OK);
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/components/executer/exprep.c 
new/src/acpica/source/components/executer/exprep.c
--- old/src/acpica/source/components/executer/exprep.c  2020-06-23 
10:41:26.000000000 +0200
+++ new/src/acpica/source/components/executer/exprep.c  2020-07-29 
09:32:51.000000000 +0200
@@ -651,10 +651,6 @@
             }
         }
 
-        /* An additional reference for the container */
-
-        AcpiUtAddReference (ObjDesc->Field.RegionObj);
-
         ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
             "RegionField: BitOff %X, Off %X, Gran %X, Region %p\n",
             ObjDesc->Field.StartFieldBitOffset,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/components/utilities/utdelete.c 
new/src/acpica/source/components/utilities/utdelete.c
--- old/src/acpica/source/components/utilities/utdelete.c       2020-06-23 
10:41:26.000000000 +0200
+++ new/src/acpica/source/components/utilities/utdelete.c       2020-07-29 
09:32:51.000000000 +0200
@@ -749,11 +749,6 @@
             NextObject = Object->BufferField.BufferObj;
             break;
 
-        case ACPI_TYPE_LOCAL_REGION_FIELD:
-
-            NextObject = Object->Field.RegionObj;
-            break;
-
         case ACPI_TYPE_LOCAL_BANK_FIELD:
 
             NextObject = Object->BankField.BankObj;
@@ -789,6 +784,7 @@
             }
             break;
 
+        case ACPI_TYPE_LOCAL_REGION_FIELD:
         case ACPI_TYPE_REGION:
         default:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/components/utilities/utids.c 
new/src/acpica/source/components/utilities/utids.c
--- old/src/acpica/source/components/utilities/utids.c  2020-06-23 
10:41:26.000000000 +0200
+++ new/src/acpica/source/components/utilities/utids.c  2020-07-29 
09:32:51.000000000 +0200
@@ -435,7 +435,7 @@
      * 3) Size of the actual CID strings
      */
     CidListSize = sizeof (ACPI_PNP_DEVICE_ID_LIST) +
-        ((Count - 1) * sizeof (ACPI_PNP_DEVICE_ID)) +
+        (Count * sizeof (ACPI_PNP_DEVICE_ID)) +
         StringAreaSize;
 
     CidList = ACPI_ALLOCATE_ZEROED (CidListSize);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/include/acpixf.h 
new/src/acpica/source/include/acpixf.h
--- old/src/acpica/source/include/acpixf.h      2020-06-23 10:41:26.000000000 
+0200
+++ new/src/acpica/source/include/acpixf.h      2020-07-29 09:32:51.000000000 
+0200
@@ -154,7 +154,7 @@
 
 /* Current ACPICA subsystem version in YYYYMMDD format */
 
-#define ACPI_CA_VERSION                 0x20200528
+#define ACPI_CA_VERSION                 0x20200717
 
 #include "acconfig.h"
 #include "actypes.h"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/include/actypes.h 
new/src/acpica/source/include/actypes.h
--- old/src/acpica/source/include/actypes.h     2020-06-23 10:41:26.000000000 
+0200
+++ new/src/acpica/source/include/actypes.h     2020-07-29 09:32:51.000000000 
+0200
@@ -1379,7 +1379,7 @@
 {
     UINT32                          Count;              /* Number of IDs in 
Ids array */
     UINT32                          ListSize;           /* Size of list, 
including ID strings */
-    ACPI_PNP_DEVICE_ID              Ids[1];             /* ID array */
+    ACPI_PNP_DEVICE_ID              Ids[];              /* ID array */
 
 } ACPI_PNP_DEVICE_ID_LIST;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/acpica/source/include/platform/aclinux.h 
new/src/acpica/source/include/platform/aclinux.h
--- old/src/acpica/source/include/platform/aclinux.h    2020-06-23 
10:41:26.000000000 +0200
+++ new/src/acpica/source/include/platform/aclinux.h    2020-07-29 
09:32:51.000000000 +0200
@@ -324,7 +324,7 @@
 
 #if defined(__ia64__)    || (defined(__x86_64__) && !defined(__ILP32__)) ||\
     defined(__aarch64__) || defined(__PPC64__) ||\
-    defined(__s390x__)
+    defined(__s390x__) || (defined(__riscv) && (__INTPTR_WIDTH__ == 64))
 #define ACPI_MACHINE_WIDTH          64
 #define COMPILER_DEPENDENT_INT64    long
 #define COMPILER_DEPENDENT_UINT64   unsigned long
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/lib/include/fwts.h new/src/lib/include/fwts.h
--- old/src/lib/include/fwts.h  2020-06-23 10:41:26.000000000 +0200
+++ new/src/lib/include/fwts.h  2020-07-29 09:32:51.000000000 +0200
@@ -118,6 +118,13 @@
 #define FWTS_USE_DEVMEM 1
 #endif
 
+#if defined(__riscv)
+#define FWTS_ARCH_RISCV        1
+#define FWTS_HAS_ACPI  1
+#define FWTS_HAS_UEFI  1
+#define FWTS_USE_DEVMEM 1
+#endif
+
 /* verision 3-tuple into integer */
 #define _VER_(major, minor, patchlevel)                 \
        ((major * 10000) + (minor * 100) + patchlevel)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/lib/include/fwts_tpm.h 
new/src/lib/include/fwts_tpm.h
--- old/src/lib/include/fwts_tpm.h      1970-01-01 01:00:00.000000000 +0100
+++ new/src/lib/include/fwts_tpm.h      2020-07-29 09:32:51.000000000 +0200
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2020 Canonical
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
+ *
+ */
+
+#ifndef __FWTS_TPM_H__
+#define __FWTS_TPM_H__
+
+PRAGMA_PUSH
+PRAGMA_PACK_WARN_OFF
+
+#define FWTS_TPM_EVENTLOG_V2_SIGNATURE "Spec ID Event03"
+
+/* define from tpm2-tss */
+#define TPM2_SHA_DIGEST_SIZE     20
+#define TPM2_SHA1_DIGEST_SIZE    20
+#define TPM2_SHA256_DIGEST_SIZE  32
+#define TPM2_SHA384_DIGEST_SIZE  48
+#define TPM2_SHA512_DIGEST_SIZE  64
+
+typedef uint16_t TPM2_ALG_ID;
+#define TPM2_ALG_ERROR               ((TPM2_ALG_ID) 0x0000)
+#define TPM2_ALG_RSA                 ((TPM2_ALG_ID) 0x0001)
+#define TPM2_ALG_TDES                ((TPM2_ALG_ID) 0x0003)
+#define TPM2_ALG_SHA                 ((TPM2_ALG_ID) 0x0004)
+#define TPM2_ALG_SHA1                ((TPM2_ALG_ID) 0x0004)
+#define TPM2_ALG_HMAC                ((TPM2_ALG_ID) 0x0005)
+#define TPM2_ALG_AES                 ((TPM2_ALG_ID) 0x0006)
+#define TPM2_ALG_MGF1                ((TPM2_ALG_ID) 0x0007)
+#define TPM2_ALG_KEYEDHASH           ((TPM2_ALG_ID) 0x0008)
+#define TPM2_ALG_XOR                 ((TPM2_ALG_ID) 0x000A)
+#define TPM2_ALG_SHA256              ((TPM2_ALG_ID) 0x000B)
+#define TPM2_ALG_SHA384              ((TPM2_ALG_ID) 0x000C)
+#define TPM2_ALG_SHA512              ((TPM2_ALG_ID) 0x000D)
+#define TPM2_ALG_NULL                ((TPM2_ALG_ID) 0x0010)
+#define TPM2_ALG_SM3_256             ((TPM2_ALG_ID) 0x0012)
+#define TPM2_ALG_SM4                 ((TPM2_ALG_ID) 0x0013)
+#define TPM2_ALG_RSASSA              ((TPM2_ALG_ID) 0x0014)
+#define TPM2_ALG_RSAES               ((TPM2_ALG_ID) 0x0015)
+#define TPM2_ALG_RSAPSS              ((TPM2_ALG_ID) 0x0016)
+#define TPM2_ALG_OAEP                ((TPM2_ALG_ID) 0x0017)
+#define TPM2_ALG_ECDSA               ((TPM2_ALG_ID) 0x0018)
+#define TPM2_ALG_ECDH                ((TPM2_ALG_ID) 0x0019)
+#define TPM2_ALG_ECDAA               ((TPM2_ALG_ID) 0x001A)
+#define TPM2_ALG_SM2                 ((TPM2_ALG_ID) 0x001B)
+#define TPM2_ALG_ECSCHNORR           ((TPM2_ALG_ID) 0x001C)
+#define TPM2_ALG_ECMQV               ((TPM2_ALG_ID) 0x001D)
+#define TPM2_ALG_KDF1_SP800_56A      ((TPM2_ALG_ID) 0x0020)
+#define TPM2_ALG_KDF2                ((TPM2_ALG_ID) 0x0021)
+#define TPM2_ALG_KDF1_SP800_108      ((TPM2_ALG_ID) 0x0022)
+#define TPM2_ALG_ECC                 ((TPM2_ALG_ID) 0x0023)
+#define TPM2_ALG_SYMCIPHER           ((TPM2_ALG_ID) 0x0025)
+#define TPM2_ALG_CAMELLIA            ((TPM2_ALG_ID) 0x0026)
+#define TPM2_ALG_CMAC                ((TPM2_ALG_ID) 0x003F)
+#define TPM2_ALG_CTR                 ((TPM2_ALG_ID) 0x0040)
+#define TPM2_ALG_SHA3_256            ((TPM2_ALG_ID) 0x0027)
+#define TPM2_ALG_SHA3_384            ((TPM2_ALG_ID) 0x0028)
+#define TPM2_ALG_SHA3_512            ((TPM2_ALG_ID) 0x0029)
+#define TPM2_ALG_OFB                 ((TPM2_ALG_ID) 0x0041)
+#define TPM2_ALG_CBC                 ((TPM2_ALG_ID) 0x0042)
+#define TPM2_ALG_CFB                 ((TPM2_ALG_ID) 0x0043)
+#define TPM2_ALG_ECB                 ((TPM2_ALG_ID) 0x0044)
+
+/*
+ * define from TCG PC Client Platform Firmware Profile Specification
+ * 
https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/
+ */
+
+typedef enum {
+       EV_PREBOOT_CERT                         = 0x00000000,
+       EV_POST_CODE                            = 0x00000001,
+       EV_UNUSED                               = 0x00000002,
+       EV_NO_ACTION                            = 0x00000003,
+       EV_SEPARATOR                            = 0x00000004,
+       EV_ACTION                               = 0x00000005,
+       EV_EVENT_TAG                            = 0x00000006,
+       EV_S_CRTM_CONTENTS                      = 0x00000007,
+       EV_S_CRTM_VERSION                       = 0x00000008,
+       EV_CPU_MICROCODE                        = 0x00000009,
+       EV_PLATFORM_CONFIG_FLAGS                = 0x0000000a,
+       EV_TABLE_OF_DEVICES                     = 0x0000000b,
+       EV_COMPACT_HASH                         = 0x0000000c,
+       EV_IPL                                  = 0x0000000d,
+       EV_IPL_PARTITION_DATA                   = 0x0000000e,
+       EV_NONHOST_CODE                         = 0x0000000f,
+       EV_NONHOST_CONFIG                       = 0x00000010,
+       EV_NONHOST_INFO                         = 0x00000011,
+       EV_OMIT_BOOT_DEVICE_EVENTS              = 0x00000012,
+       EV_EFI_EVENT_BASE                       = 0x80000000,
+       EV_EFI_VARIABLE_DRIVER_CONFIG           = 0x80000001,
+       EV_EFI_VARIABLE_BOOT                    = 0x80000002,
+       EV_EFI_BOOT_SERVICES_APPLICATION        = 0x80000003,
+       EV_EFI_BOOT_SERVICES_DRIVER             = 0x80000004,
+       EV_EFI_RUNTIME_SERVICES_DRIVER          = 0x80000005,
+       EV_EFI_GPT_EVENT                        = 0x80000006,
+       EV_EFI_ACTION                           = 0x80000007,
+       EV_EFI_PLATFORM_FIRMWARE_BLOB           = 0x80000008,
+       EV_EFI_HANDOFF_TABLES                   = 0x80000009,
+       EV_EFI_HCRTM_EVENT                      = 0x80000010,
+       EV_EFI_VARIABLE_AUTHORITY               = 0x800000e0
+} fwts_tpmlog_event_type;
+
+
+typedef struct {
+       uint32_t pcr_index;
+       uint32_t event_type;
+       uint8_t digest[20];
+       uint32_t event_data_size;
+       uint8_t event[0];
+} __attribute__ ((packed)) fwts_pc_client_pcr_event;
+
+typedef struct {
+uint16_t algorithm_id;
+uint16_t digest_size;
+} __attribute__ ((packed)) fwts_spec_id_event_alg_sz;
+
+typedef struct {
+       uint8_t                         signature[16];
+       uint32_t                        platform_class;
+       uint8_t                         spec_version_minor;
+       uint8_t                         spec_version_major;
+       uint8_t                         spec_errata;
+       uint8_t                         uintn_size;
+       uint32_t                        number_of_alg;
+/*
+ * Below items are not fix sizes, skip to define them
+ * but it should be calculated when evaluate the
+ * struct size.
+ */
+
+/*
+       fwts_spec_id_event_alg_sz       digest_sizes[0];
+       uint8_t                         vendor_info_size;
+       uint8_t                         vendor_info[0];
+*/
+} __attribute__ ((packed)) fwts_efi_spec_id_event;
+
+
+typedef struct {
+       uint32_t        pcr_index;
+       uint32_t        event_type;
+       uint32_t        digests_count;
+/*
+ * Below items are not fix size, skip to define them
+ * but it should be calculated when evaluate the
+ * struct size.
+ */
+
+/*
+       uint8_t         digests[0];
+       uint32_t        event_size;
+       uint8_t         event[eventSize];
+*/
+} __attribute__ ((packed)) fwts_tcg_pcr_event2;
+
+PRAGMA_POP
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/lib/include/fwts_version.h 
new/src/lib/include/fwts_version.h
--- old/src/lib/include/fwts_version.h  2020-06-23 10:41:26.000000000 +0200
+++ new/src/lib/include/fwts_version.h  2020-07-29 09:32:51.000000000 +0200
@@ -16,5 +16,5 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
  *
  */
-#define FWTS_VERSION "V20.06.01"
-#define FWTS_DATE    "2020-06-23 08:41:26"
+#define FWTS_VERSION "V20.07.00"
+#define FWTS_DATE    "2020-07-29 07:32:51"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/lib/src/fwts_battery.c 
new/src/lib/src/fwts_battery.c
--- old/src/lib/src/fwts_battery.c      2020-06-23 10:41:26.000000000 +0200
+++ new/src/lib/src/fwts_battery.c      2020-07-29 09:32:51.000000000 +0200
@@ -37,6 +37,20 @@
        return (((fwts_battery_type)index == FWTS_BATTERY_ALL) | (index == 
loop_index));
 }
 
+static inline void fwts_battery_path(
+       char *path,
+       const size_t path_len,
+       const char *battery_dir,
+       const char *name,
+       const char *str)
+{
+       (void)strlcpy(path, battery_dir, path_len);
+       (void)strlcat(path, "/", path_len);
+       (void)strlcat(path, name, path_len);
+       (void)strlcat(path, "/", path_len);
+       (void)strlcat(path, str, path_len);
+}
+
 static int fwts_battery_get_capacity_sys_fs(fwts_framework *fw,
        DIR     *dir,
        const fwts_battery_type type,
@@ -78,7 +92,7 @@
                        bool match;
 
                        /* Check that type field matches the expected type */
-                       snprintf(path, sizeof(path), "%s/%s/type", 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name, "type");
                        if ((data = fwts_get(path)) != NULL) {
                                bool mismatch = (strstr(data, "Battery") == 
NULL);
                                free(data);
@@ -157,7 +171,8 @@
                        if (!match)
                                continue;
 
-                       snprintf(path, sizeof(path), "%s/%s/%s", 
FWTS_PROC_ACPI_BATTERY, entry->d_name, file);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_PROC_ACPI_BATTERY, entry->d_name, file);
+
                        if ((fp = fopen(path, "r")) == NULL) {
                                fwts_log_info(fw, "Battery %s present but 
undersupported - no state present.", entry->d_name);
                        } else {
@@ -197,7 +212,7 @@
                entry = readdir(dir);
                if (entry && strlen(entry->d_name) > 2) {
                        /* Check that type field matches the expected type */
-                       snprintf(path, sizeof(path), "%s/%s/type", 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name, "type");
                        if ((data = fwts_get(path)) != NULL) {
                                if (strstr(data, "Battery") != NULL)
                                        (*count)++;
@@ -235,7 +250,7 @@
                if (entry && strlen(entry->d_name) > 2) {
                        bool match;
                        /* Check that type field matches the expected type */
-                       snprintf(path, sizeof(path), "%s/%s/type", 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name, "type");
                        if ((data = fwts_get(path)) != NULL) {
                                bool mismatch = (strstr(data, "Battery") == 
NULL);
                                free(data);
@@ -307,7 +322,7 @@
                        bool match;
 
                        /* Check that type field matches the expected type */
-                       snprintf(path, sizeof(path), "%s/%s/type", 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name, "type");
                        if ((data = fwts_get(path)) != NULL) {
                                bool mismatch = (strstr(data, "Battery") == 
NULL);
                                free(data);
@@ -367,7 +382,8 @@
                        if (!match)
                                continue;
 
-                       snprintf(path, sizeof(path), "%s/%s/%s", 
FWTS_PROC_ACPI_BATTERY, entry->d_name, file);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_PROC_ACPI_BATTERY, entry->d_name, file);
+
                        if ((fp = fopen(path, "r")) == NULL) {
                                fwts_log_info(fw, "Battery %s present but 
undersupported - no state present.", entry->d_name);
                        } else {
@@ -405,7 +421,7 @@
                        bool match;
 
                        /* Check that type field matches the expected type */
-                       snprintf(path, sizeof(path), "%s/%s/type", 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name, "type");
                        if ((data = fwts_get(path)) != NULL) {
                                bool mismatch = (strstr(data, "Battery") == 
NULL);
                                free(data);
@@ -453,7 +469,7 @@
                        bool match;
 
                        /* Check that type field matches the expected type */
-                       snprintf(path, sizeof(path), "%s/%s/type", 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_SYS_CLASS_POWER_SUPPLY, entry->d_name, "type");
                        if ((data = fwts_get(path)) != NULL) {
                                bool mismatch = (strstr(data, "Battery") == 
NULL);
                                free(data);
@@ -503,7 +519,7 @@
                        if (!match)
                                continue;
 
-                       snprintf(path, sizeof(path), "%s/%s/alarm", 
FWTS_PROC_ACPI_BATTERY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_PROC_ACPI_BATTERY, entry->d_name, "alarm");
                        if ((fp = fopen(path, "rw+")) == NULL) {
                                fwts_log_info(fw, "Battery %s present but 
undersupported - no state present.", entry->d_name);
                        } else {
@@ -540,7 +556,7 @@
                        if (!match)
                                continue;
 
-                       snprintf(path, sizeof(path), "%s/%s/alarm", 
FWTS_PROC_ACPI_BATTERY, entry->d_name);
+                       fwts_battery_path(path, sizeof(path), 
FWTS_PROC_ACPI_BATTERY, entry->d_name, "alarm");
                        if ((fp = fopen(path, "r")) == NULL) {
                                fwts_log_info(fw, "Battery %s present but 
undersupported - no state present.", entry->d_name);
                        } else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/lib/src/fwts_button.c 
new/src/lib/src/fwts_button.c
--- old/src/lib/src/fwts_button.c       2020-06-23 10:41:26.000000000 +0200
+++ new/src/lib/src/fwts_button.c       2020-07-29 09:32:51.000000000 +0200
@@ -26,9 +26,24 @@
 #include <string.h>
 #include <limits.h>
 #include <dirent.h>
+#include <bsd/string.h>
 
 #define FWTS_PROC_ACPI_BUTTON  "/proc/acpi/button"
 
+static inline void fwts_button_path(
+       char *path,
+       const size_t path_len,
+       const char *button_dir,
+       const char *name,
+       const char *str)
+{
+       (void)strlcpy(path, button_dir, path_len);
+       (void)strlcat(path, "/", path_len);
+       (void)strlcat(path, name, path_len);
+       (void)strlcat(path, "/", path_len);
+       (void)strlcat(path, str, path_len);
+}
+
 /*
  *  fwts_button_match_state_proc()
  *     find matching button state and keep count of matching
@@ -80,7 +95,8 @@
                        char path[PATH_MAX];
                        char *data;
 
-                       snprintf(path, sizeof(path),  "%s/%s/%s", button_dir, 
entry->d_name, field);
+                       fwts_button_path(path, sizeof(path), button_dir, 
entry->d_name, field);
+
                        if ((data = fwts_get(path)) != NULL) {
                                if (strstr(data, match))
                                        (*matched)++;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/lib/src/fwts_modprobe.c 
new/src/lib/src/fwts_modprobe.c
--- old/src/lib/src/fwts_modprobe.c     2020-06-23 10:41:26.000000000 +0200
+++ new/src/lib/src/fwts_modprobe.c     2020-07-29 09:32:51.000000000 +0200
@@ -28,10 +28,37 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <sys/utsname.h>
+#include <bsd/string.h>
 
 #include "fwts.h"
 
 /*
+ *  fwts_module_path()
+ *     build a new path based on basename path and
+ *     the new filename (or directory name)
+ */
+static void fwts_module_path(
+       char *newpath,
+       const size_t newpath_len,
+       const char *basepath,
+       const char *filename)
+{
+       char *ptr = newpath;
+       size_t n = newpath_len, len;
+
+       (void)strlcpy(ptr, basepath, n);
+       len = strlen(basepath);
+       ptr += len;
+       n -= len;
+
+       (void)strlcpy(ptr, "/", n);
+       ptr++;
+       n--;
+
+       (void)strlcpy(ptr, filename, n);
+}
+
+/*
  *  fwts_module_find()
  *     recursively search for module from the basepath start
  *     and return false if not found, and true if found. If
@@ -59,8 +86,7 @@
 
                switch (de->d_type) {
                case DT_DIR:
-                       (void)snprintf(newpath, sizeof(newpath), "%s/%s",
-                               basepath, de->d_name);
+                       fwts_module_path(newpath, sizeof(newpath), basepath, 
de->d_name);
                        if (fwts_module_find(module, newpath, path, path_len)) {
                                (void)closedir(dir);
                                return true;
@@ -68,7 +94,7 @@
                        break;
                case DT_REG:
                        if (!strcmp(de->d_name, module)) {
-                               (void)snprintf(path, path_len, "%s/%s", 
basepath, module);
+                               fwts_module_path(path, path_len, basepath, 
module);
                                (void)closedir(dir);
                                return true;
                        }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/libfwtsiasl/Makefile.am 
new/src/libfwtsiasl/Makefile.am
--- old/src/libfwtsiasl/Makefile.am     2020-06-23 10:41:26.000000000 +0200
+++ new/src/libfwtsiasl/Makefile.am     2020-07-29 09:32:51.000000000 +0200
@@ -62,28 +62,28 @@
 $(srcdir)/aslcompiler.c $(srcdir)/aslcompiler.y.h: $(srcdir)/aslcompiler.y
        ${YACC} ${AM_YFLAGS} -d -baslcompiler -pAslCompiler $^
        mv aslcompiler.tab.c aslcompiler.c
-       mv aslcompiler.tab.h aslcompiler.y.h
+       cp aslcompiler.tab.h aslcompiler.y.h
 
 .NOTPARALLEL: $(srcdir)/dtcompilerparserlex.c
 $(srcdir)/dtcompilerparserlex.c $(srcdir)/dtcompilerparser.c 
$(srcdir)/dtcompilerparser.y.h: ../acpica/source/compiler/dtcompilerparser.l 
../acpica/source/compiler/dtcompilerparser.y
        ${LEX} ${AM_LFLAGS} -PDtCompilerParser 
-o$(srcdir)/dtcompilerparserlex.c $<
        ${YACC} ${AM_YFLAGS} -bdtcompilerparser -pDtCompilerParser 
../acpica/source/compiler/dtcompilerparser.y
        mv dtcompilerparser.tab.c dtcompilerparser.c
-       mv dtcompilerparser.tab.h dtcompilerparser.y.h
+       cp dtcompilerparser.tab.h dtcompilerparser.y.h
 
 .NOTPARALLEL: $(srcdir)/dtparserlex.c
 $(srcdir)/dtparserlex.c $(srcdir)/dtparser.c $(srcdir)/dtparser.y.h: 
../acpica/source/compiler/dtparser.l ../acpica/source/compiler/dtparser.y
        ${LEX} ${AM_LFLAGS} -PDtParser -o$(srcdir)/dtparserlex.c $<
        ${YACC} ${AM_YFLAGS} -bdtparser -pDtParser 
../acpica/source/compiler/dtparser.y
        mv dtparser.tab.c dtparser.c
-       mv dtparser.tab.h dtparser.y.h
+       cp dtparser.tab.h dtparser.y.h
 
 .NOTPARALLEL: $(srcdir)/prparserlex.c
 $(srcdir)/prparserlex.c $(srcdir)/prparser.c $(srcdir)/prparser.y.h: 
../acpica/source/compiler/prparser.l ../acpica/source/compiler/prparser.y
        ${LEX} ${AM_LFLAGS} -PPrParser -o$(srcdir)/prparserlex.c $<
        ${YACC} ${AM_YFLAGS} -bprparser -pPrParser 
../acpica/source/compiler/prparser.y
        mv prparser.tab.c prparser.c
-       mv prparser.tab.h prparser.y.h
+       cp prparser.tab.h prparser.y.h
 
 pkglib_LTLIBRARIES = libfwtsiasl.la
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/opal/reserv_mem.c new/src/opal/reserv_mem.c
--- old/src/opal/reserv_mem.c   2020-06-23 10:41:26.000000000 +0200
+++ new/src/opal/reserv_mem.c   2020-07-29 09:32:51.000000000 +0200
@@ -143,6 +143,11 @@
        /* Get the number of memory reserved regions */
        nr_regions = fwts_dt_stringlist_count(fw, fw->fdt, offset,
                                "reserved-names");
+       if (nr_regions < 0) {
+               fwts_failed(fw, LOG_LEVEL_MEDIUM, "DTNoRegions",
+                       "DT No regions");
+               return FWTS_ERROR;
+       }
 
        /* Check for the reservd-names property */
        region_names = (const char *)fdt_getprop(fw->fdt, offset,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/src/tpm/tpmevlogdump/tpmevlogdump.c 
new/src/tpm/tpmevlogdump/tpmevlogdump.c
--- old/src/tpm/tpmevlogdump/tpmevlogdump.c     1970-01-01 01:00:00.000000000 
+0100
+++ new/src/tpm/tpmevlogdump/tpmevlogdump.c     2020-07-29 09:32:51.000000000 
+0200
@@ -0,0 +1,530 @@
+/*
+ * Copyright (C) 2020 Canonical
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 
USA.
+ *
+ */
+#include "fwts.h"
+
+#include <sys/types.h>
+#include <dirent.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include "fwts_tpm.h"
+
+#define FWTS_TPM_LOG_DIR_PATH          "/sys/kernel/security"
+
+
+static void tpmevlogdump_data_hexdump(fwts_framework *fw, uint8_t *data, 
size_t size, char *str)
+{
+       size_t i;
+
+       fwts_log_info_verbatim(fw, "%s: ", str);
+       for (i = 0; i < size; i += 16) {
+               char buffer[128];
+               size_t left = size - i;
+
+               fwts_dump_raw_data(buffer, sizeof(buffer), data + i, i, left > 
16 ? 16 : left);
+               fwts_log_info_verbatim(fw, "%s", buffer + 2);
+       }
+}
+
+static char *tpmevlogdump_evtype_to_string (fwts_tpmlog_event_type event_type)
+{
+
+       char *str;
+
+       switch (event_type) {
+       case EV_PREBOOT_CERT:
+               str = "EV_PREBOOT_CERT";
+               break;
+       case EV_POST_CODE:
+               str = "EV_POST_CODE";
+               break;
+       case EV_UNUSED:
+               str = "EV_UNUSED";
+               break;
+       case EV_NO_ACTION:
+               str = "EV_NO_ACTION";
+               break;
+       case EV_SEPARATOR:
+               str = "EV_SEPARATOR";
+               break;
+       case EV_ACTION:
+               str = "EV_ACTION";
+               break;
+       case EV_EVENT_TAG:
+               str = "EV_EVENT_TAG";
+               break;
+       case EV_S_CRTM_CONTENTS:
+               str = "EV_S_CRTM_CONTENTS";
+               break;
+       case EV_S_CRTM_VERSION:
+               str = "EV_S_CRTM_VERSION";
+               break;
+       case EV_CPU_MICROCODE:
+               str = "EV_CPU_MICROCODE";
+               break;
+       case EV_PLATFORM_CONFIG_FLAGS:
+               str = "EV_PLATFORM_CONFIG_FLAGS";
+               break;
+       case EV_TABLE_OF_DEVICES:
+               str = "EV_TABLE_OF_DEVICES";
+               break;
+       case EV_IPL:
+               str = "EV_IPL";
+               break;
+       case EV_IPL_PARTITION_DATA:
+               str = "EV_IPL_PARTITION_DATA";
+               break;
+       case EV_NONHOST_CODE:
+               str = "EV_NONHOST_CODE";
+               break;
+       case EV_NONHOST_CONFIG:
+               str = "EV_NONHOST_CONFIG";
+               break;
+       case EV_NONHOST_INFO:
+               str = "EV_NONHOST_INFO";
+               break;
+       case EV_OMIT_BOOT_DEVICE_EVENTS:
+               str = "EV_OMIT_BOOT_DEVICE_EVENTS";
+               break;
+       case EV_EFI_EVENT_BASE:
+               str = "EV_EFI_EVENT_BASE";
+               break;
+       case EV_EFI_VARIABLE_DRIVER_CONFIG:
+               str = "EV_EFI_VARIABLE_DRIVER_CONFIG";
+               break;
+       case EV_EFI_VARIABLE_BOOT:
+               str = "EV_EFI_VARIABLE_BOOT";
+               break;
+       case EV_EFI_BOOT_SERVICES_APPLICATION:
+               str = "EV_EFI_BOOT_SERVICES_APPLICATION";
+               break;
+       case EV_EFI_BOOT_SERVICES_DRIVER:
+               str = "EV_EFI_BOOT_SERVICES_DRIVER";
+               break;
+       case EV_EFI_RUNTIME_SERVICES_DRIVER:
+               str = "EV_EFI_RUNTIME_SERVICES_DRIVER";
+               break;
+       case EV_EFI_GPT_EVENT:
+               str = "EV_EFI_GPT_EVENT";
+               break;
+       case EV_EFI_ACTION:
+               str = "EV_EFI_ACTION";
+               break;
+       case EV_EFI_PLATFORM_FIRMWARE_BLOB:
+               str = "EV_EFI_PLATFORM_FIRMWARE_BLOB";
+               break;
+       case EV_EFI_HANDOFF_TABLES:
+               str = "EV_EFI_HANDOFF_TABLES";
+               break;
+       case EV_EFI_HCRTM_EVENT:
+               str = "EV_EFI_HCRTM_EVENT";
+               break;
+       case EV_EFI_VARIABLE_AUTHORITY:
+               str = "EV_EFI_VARIABLE_AUTHORITY";
+               break;
+       default:
+               str = "Unknown";
+               break;
+       }
+
+       return str;
+}
+
+static char *tpmevlogdump_hash_to_string (TPM2_ALG_ID hash)
+{
+
+       char *str;
+
+       switch (hash) {
+       case TPM2_ALG_SHA1:
+               str = "SHA1";
+               break;
+       case TPM2_ALG_SHA256:
+               str = "SHA256";
+               break;
+       case TPM2_ALG_SHA384:
+               str = "SHA384";
+               break;
+       case TPM2_ALG_SHA512:
+               str = "SHA512";
+               break;
+       default:
+               str = "Unknown";
+               break;
+       }
+
+       return str;
+}
+
+static uint8_t tpmevlogdump_get_hash_size (TPM2_ALG_ID hash)
+{
+       uint8_t sz;
+
+       switch (hash) {
+       case TPM2_ALG_SHA1:
+               sz = TPM2_SHA1_DIGEST_SIZE;
+               break;
+       case TPM2_ALG_SHA256:
+               sz = TPM2_SHA256_DIGEST_SIZE;
+               break;
+       case TPM2_ALG_SHA384:
+               sz = TPM2_SHA384_DIGEST_SIZE;
+               break;
+       case TPM2_ALG_SHA512:
+               sz = TPM2_SHA512_DIGEST_SIZE;
+               break;
+       default:
+               sz = 0;
+               break;
+       }
+
+       return sz;
+}
+
+static char *tpmevlogdump_pcrindex_to_string (uint32_t pcr)
+{
+
+       char *str;
+
+       switch (pcr) {
+       case 0:
+               str = "SRTM, BIOS, Host Platform Extensions, Embedded Option 
ROMs and PI Drivers";
+               break;
+       case 1:
+               str = "Host Platform Configuration";
+               break;
+       case 2:
+               str = "UEFI driver and application Code";
+               break;
+       case 3:
+               str = "UEFI driver and application Configuration and Data";
+               break;
+       case 4:
+               str = "UEFI Boot Manager Code and Boot Attempts";
+               break;
+       case 5:
+               str = "Boot Manager Code Configuration and Data and 
GPT/Partition Table";
+               break;
+       case 6:
+               str = "Host Platform Manufacturer Specific";
+               break;
+       case 7:
+               str = "Secure Boot Policy";
+               break;
+       case 8:
+       case 9:
+       case 10:
+       case 11:
+       case 12:
+       case 13:
+       case 14:
+       case 15:
+               str = "Defined for use by the Static OS";
+               break;
+       case 16:
+               str = "Debug";
+               break;
+       case 23:
+               str = "Application Support";
+               break;
+       default:
+               str = "Unknown";
+               break;
+       }
+
+       return str;
+}
+
+static size_t tpmevlogdump_specid_event_dump(fwts_framework *fw, uint8_t 
*data, size_t len)
+{
+
+       uint32_t i;
+       size_t len_remain = len;
+       uint8_t *pdata = data;
+       char *str_info;
+
+       /* check the data length for dumping */
+       if (len_remain < sizeof(fwts_pc_client_pcr_event)) {
+               fwts_log_info(fw, "Cannot get enough length for dumping data.");
+               return 0;
+       }
+       fwts_pc_client_pcr_event *pc_event = (fwts_pc_client_pcr_event *)pdata;
+       str_info = tpmevlogdump_pcrindex_to_string(pc_event->pcr_index);
+       fwts_log_info_verbatim(fw, "PCRIndex:                    0x%8.8" PRIx32 
"(%s)", pc_event->pcr_index, str_info);
+       str_info = tpmevlogdump_evtype_to_string(pc_event->event_type);
+       fwts_log_info_verbatim(fw, "EventType:                   0x%8.8" PRIx32 
"(%s)", pc_event->event_type, str_info);
+       tpmevlogdump_data_hexdump(fw, pc_event->digest, 
sizeof(pc_event->digest), "Digest");
+       fwts_log_info_verbatim(fw, "EventSize:                   0x%8.8" 
PRIx32, pc_event->event_data_size);
+
+       pdata += sizeof(fwts_pc_client_pcr_event);
+       len_remain -= sizeof(fwts_pc_client_pcr_event);
+
+       /* check the data length for dumping */
+       if (len_remain < sizeof(fwts_efi_spec_id_event)) {
+               fwts_log_info(fw, "Cannot get enough length for dumping data.");
+               return 0;
+       }
+       fwts_efi_spec_id_event *specid_evcent = (fwts_efi_spec_id_event *)pdata;
+       fwts_log_info_verbatim(fw, "EfiSpecIdEvent:");
+       fwts_log_info_verbatim(fw, "  Signature:                 %s", (char 
*)specid_evcent->signature);
+       fwts_log_info_verbatim(fw, "  platformClass:             0x%8.8" 
PRIx32, specid_evcent->platform_class);
+       fwts_log_info_verbatim(fw, "  specVersionMinor:          0x%" PRIx8, 
specid_evcent->spec_version_minor);
+       fwts_log_info_verbatim(fw, "  specVersionMajor:          0x%" PRIx8, 
specid_evcent->platform_class);
+       fwts_log_info_verbatim(fw, "  specErrata:                0x%" PRIx8, 
specid_evcent->spec_errata);
+       fwts_log_info_verbatim(fw, "  uintnSize:                 0x%" PRIx8, 
specid_evcent->uintn_size);
+       fwts_log_info_verbatim(fw, "  NumberOfAlgorithms:        0x%8.8" 
PRIx32, specid_evcent->number_of_alg);
+
+       pdata += sizeof(fwts_efi_spec_id_event);
+       len_remain -= sizeof(fwts_efi_spec_id_event);
+       fwts_spec_id_event_alg_sz *alg_sz = (fwts_spec_id_event_alg_sz *)pdata;
+       for (i = 0; i < specid_evcent->number_of_alg; i++) {
+               /* check the data length for dumping */
+               if (len_remain < sizeof(fwts_spec_id_event_alg_sz)) {
+                       fwts_log_info(fw, "Cannot get enough length for dumping 
data.");
+                       return 0;
+               }
+               str_info = tpmevlogdump_hash_to_string(alg_sz->algorithm_id);
+               fwts_log_info_verbatim(fw, "  digestSizes[%d].AlgId:      
0x%4.4" PRIx16 "(%s)", i, alg_sz->algorithm_id, str_info);
+               fwts_log_info_verbatim(fw, "  digestSizes[%d].DigestSize: %" 
PRIu16, i, alg_sz->digest_size);
+               pdata += sizeof(fwts_spec_id_event_alg_sz);
+               len_remain -= sizeof(fwts_spec_id_event_alg_sz);
+               alg_sz = (fwts_spec_id_event_alg_sz *)pdata;
+       }
+
+       uint8_t vendor_info_size = *(uint8_t *)pdata;
+       fwts_log_info_verbatim(fw, "  vendorInfoSize:            0x%" PRIx8, 
vendor_info_size);
+       pdata += sizeof(vendor_info_size);
+       len_remain -= sizeof(vendor_info_size);
+       if (vendor_info_size > 0) {
+               /* check the data length for dumping */
+               if (len_remain < vendor_info_size) {
+                       fwts_log_info(fw, "Cannot get enough length for dumping 
data.");
+                       return 0;
+               }
+               tpmevlogdump_data_hexdump(fw, pdata, vendor_info_size, "  
vendorInfo");
+               len_remain -= vendor_info_size;
+       }
+
+       return len_remain;
+}
+
+static size_t tpmevlogdump_event_v2_dump(fwts_framework *fw, uint8_t *data, 
size_t len)
+{
+       uint32_t i;
+       uint8_t *pdata = data;
+       size_t len_remain = len;
+       char *str_info;
+
+       /* check the data length for dumping */
+       if (len_remain < sizeof(fwts_tcg_pcr_event2)) {
+               fwts_log_info(fw, "Cannot get enough length for dumping data.");
+               return 0;
+       }
+       fwts_tcg_pcr_event2 *pcr_event2 = (fwts_tcg_pcr_event2 *)pdata;
+       str_info = tpmevlogdump_pcrindex_to_string(pcr_event2->pcr_index);
+       fwts_log_info_verbatim(fw, "PCRIndex:           0x%8.8" PRIx32 "(%s)", 
pcr_event2->pcr_index, str_info);
+       str_info = tpmevlogdump_evtype_to_string(pcr_event2->event_type);
+       fwts_log_info_verbatim(fw, "EventType:          0x%8.8" PRIx32 "(%s)", 
pcr_event2->event_type, str_info);
+       fwts_log_info_verbatim(fw, "Digests Count :     0x%8.8" PRIx32, 
pcr_event2->digests_count);
+       pdata += sizeof(fwts_tcg_pcr_event2);
+       len_remain -= sizeof(fwts_tcg_pcr_event2);
+       for (i = 0; i < pcr_event2->digests_count; i++) {
+
+               uint8_t hash_size = 0;
+               TPM2_ALG_ID alg_id = *(TPM2_ALG_ID *)pdata;
+
+               /* check the data length for dumping */
+               if (len_remain < sizeof(TPM2_ALG_ID)) {
+                       fwts_log_info(fw, "Cannot get enough length for dumping 
data.");
+                       return 0;
+               }
+               str_info = tpmevlogdump_hash_to_string(alg_id);
+               fwts_log_info_verbatim(fw, "  Digests[%d].AlgId: 0x%4.4" PRIx16 
"(%s)", i, alg_id, str_info);
+               hash_size = tpmevlogdump_get_hash_size(alg_id);
+               if (!hash_size) {
+                       fwts_log_info(fw, "Unknown hash algorithm. Aborted.");
+                       return 0;
+               }
+               pdata += sizeof(TPM2_ALG_ID);
+               len_remain -= sizeof(TPM2_ALG_ID);
+               /* check the data length for dumping */
+               if (len_remain < sizeof(TPM2_ALG_ID)) {
+                       fwts_log_info(fw, "Cannot get enough length for dumping 
data.");
+                       return 0;
+               }
+               tpmevlogdump_data_hexdump(fw, pdata, hash_size, "  Digest");
+               pdata += hash_size;
+               len_remain -= hash_size;
+       }
+
+       uint32_t event_size = *(uint32_t *)pdata;
+
+       /* check the data length for dumping */
+       if (len_remain < event_size + sizeof(event_size)) {
+               fwts_log_info(fw, "Cannot get enough length for dumping data.");
+               return 0;
+       }
+       pdata += sizeof(event_size);
+       len_remain -= sizeof(event_size);
+
+       fwts_log_info_verbatim(fw, "  EventSize:        %" PRIu32, event_size);
+       if (event_size > 0) {
+               tpmevlogdump_data_hexdump(fw, pdata, event_size, "  Event");
+               len_remain -= event_size;
+       }
+
+       return len_remain;
+}
+
+static void tpmevlogdump_parser(fwts_framework *fw, uint8_t *data, size_t len)
+{
+       size_t t_len = len;
+       size_t len_remain = 0;
+       uint8_t *pdata = data;
+
+       len_remain = tpmevlogdump_specid_event_dump(fw, pdata, t_len);
+       fwts_log_nl(fw);
+       pdata += (t_len - len_remain);
+       while (len_remain > 0) {
+               t_len = len_remain;
+               len_remain = tpmevlogdump_event_v2_dump(fw, pdata, t_len);
+               pdata += (t_len - len_remain);
+               fwts_log_nl(fw);
+       }
+       return;
+}
+
+static uint8_t *tpmevlogdump_load_file(const int fd, size_t *length)
+{
+       uint8_t *ptr = NULL, *tmp;
+       size_t size = 0;
+       char buffer[4096];
+
+       *length = 0;
+
+       for (;;) {
+               ssize_t n = read(fd, buffer, sizeof(buffer));
+
+               if (n == 0)
+                       break;
+               if (n < 0) {
+                       if (errno != EINTR && errno != EAGAIN) {
+                               free(ptr);
+                               return NULL;
+                       }
+                       continue;
+               }
+               if (n > (ssize_t)sizeof(buffer))
+                       goto err;
+               if (size + n > 0xffffffff)
+                       goto err;
+
+               if ((tmp = (uint8_t*)realloc(ptr, size + n + 1)) == NULL) {
+                       free(ptr);
+                       return NULL;
+               }
+               ptr = tmp;
+               memcpy(ptr + size, buffer, n);
+               size += n;
+       }
+
+       if (!ptr || !size)
+               goto err_no_data;
+
+       *length = size;
+       return ptr;
+
+err:
+       free(ptr);
+err_no_data:
+       *length = 0;
+       return NULL;
+}
+
+static int tpmevlogdump_test1(fwts_framework *fw)
+{
+       DIR *dir;
+       struct dirent *tpmdir;
+       bool tpm_logfile_found = false;
+
+       if (!(dir = opendir(FWTS_TPM_LOG_DIR_PATH))) {
+               fwts_log_info(fw, "Cannot find the tpm event log. Aborted.");
+               return FWTS_ABORTED;
+       }
+
+       do {
+               tpmdir = readdir(dir);
+               if (tpmdir && strstr(tpmdir->d_name, "tpm")) {
+                       char path[PATH_MAX];
+                       uint8_t *data;
+                       int fd;
+                       size_t length;
+
+                       fwts_log_nl(fw);
+                       fwts_log_info_verbatim(fw, "%s", tpmdir->d_name);
+
+                       snprintf(path, sizeof(path), FWTS_TPM_LOG_DIR_PATH 
"/%s/binary_bios_measurements", tpmdir->d_name);
+
+                       if ((fd = open(path, O_RDONLY)) >= 0) {
+                               data = tpmevlogdump_load_file(fd, &length);
+                               tpm_logfile_found = true;
+                               if (data == NULL) {
+                                       fwts_log_info(fw, "Cannot load the tpm 
event logs. Aborted.");
+                                       (void)closedir(dir);
+                                       (void)close(fd);
+                                       return FWTS_ABORTED;
+                               } else {
+                                       /* check if the TPM2 eventlog */
+                                       if (strstr((char *)(data + 
sizeof(fwts_pc_client_pcr_event)), FWTS_TPM_EVENTLOG_V2_SIGNATURE))
+                                               tpmevlogdump_parser(fw, data, 
length);
+                                       else {
+                                               fwts_log_info(fw, "Cannot find 
the tpm2 event log. Aborted.");
+                                               free(data);
+                                               (void)closedir(dir);
+                                               (void)close(fd);
+                                               return FWTS_ABORTED;
+                                       }
+                                       free(data);
+                               }
+                               (void)close(fd);
+                       }
+               }
+       } while (tpmdir);
+
+       (void)closedir(dir);
+
+       if (!tpm_logfile_found) {
+               fwts_log_info(fw, "Cannot find the tpm event log. Aborted.");
+               return FWTS_ABORTED;
+       }
+       return FWTS_OK;
+}
+
+static fwts_framework_minor_test tpmevlogdump_tests[] = {
+       { tpmevlogdump_test1, "Dump Tpm2 Event Log." },
+       { NULL, NULL }
+};
+
+static fwts_framework_ops tpmevlogdump_ops = {
+       .description = "Dump Tpm2 Event Log.",
+       .minor_tests = tpmevlogdump_tests
+};
+
+FWTS_REGISTER("tpmevlogdump", &tpmevlogdump_ops, FWTS_TEST_ANYTIME, 
FWTS_FLAG_UTILS | FWTS_FLAG_ROOT_PRIV)


Reply via email to