[virt-tools-list] [PATCH virtio-win-pkg-scripts] cpdrivers: accept unsigned binaries

Roman Kagan rkagan at virtuozzo.com
Sat Feb 20 13:57:48 UTC 2016


PE binaries included in the driver package (.sys, .dll, etc) may contain
no internal signatures; in that case their digest in the catalog is
calculated till the end of the file.

Signed-off-by: Roman Kagan <rkagan at virtuozzo.com>
---
 util/cpdrivers.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/cpdrivers.py b/util/cpdrivers.py
index 305b3ae..f4b1d6e 100644
--- a/util/cpdrivers.py
+++ b/util/cpdrivers.py
@@ -65,6 +65,8 @@ def calcPEHash(data, hashobj):
         0x20b: 168     # PE32+
         }[pemagic]
     sec, seclen = struct.unpack_from("2I", data, secdir)
+    if sec == 0:
+        sec = len(data)
     # signature is always the tail part
     assert sec + seclen == len(data)
 
-- 
2.5.0




More information about the virt-tools-list mailing list