aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-02-04 17:00:28 +0100
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2020-02-07 15:15:16 +0100
commitb38c2458d4ccbabbfdf1beb9df483b609a9513f8 (patch)
tree86d4ee6642358988e5b9c51f589cef2828674820 /scripts
parent351aa2706e1d19e2ad878e5d9333ca9e9825d0cd (diff)
scripts/signrom: remove Python 2 support, add shebang
Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200204160028.16211-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/signrom.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/scripts/signrom.py b/scripts/signrom.py
index 313ee28a17..9be5dab1cf 100644
--- a/scripts/signrom.py
+++ b/scripts/signrom.py
@@ -1,3 +1,5 @@
+#!/usr/bin/env python3
+
from __future__ import print_function
#
# Option ROM signing utility
@@ -44,14 +46,8 @@ fout.write(data)
checksum = 0
for b in data:
- # catch Python 2 vs. 3 differences
- if isinstance(b, int):
- checksum += b
- else:
- checksum += ord(b)
-checksum = (256 - checksum) % 256
-
-# Python 3 no longer allows chr(checksum)
+ checksum = (checksum - b) & 255
+
fout.write(struct.pack('B', checksum))
fin.close()