mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #9783 from bridadan/fix_unsigned_crc_header
Ensure header CRC is written as unsigned intpull/9802/head
commit
091da53589
|
|
@ -398,8 +398,9 @@ def _fill_header(region_list, current_region):
|
|||
else:
|
||||
ih = intelhex_offset(region_dict[data].filename, offset=region_dict[data].start)
|
||||
if subtype.startswith("CRCITT32"):
|
||||
fmt = {"CRCITT32be": ">l", "CRCITT32le": "<l"}[subtype]
|
||||
header.puts(start, struct.pack(fmt, zlib.crc32(ih.tobinarray())))
|
||||
fmt = {"CRCITT32be": ">L", "CRCITT32le": "<L"}[subtype]
|
||||
crc_val = zlib.crc32(ih.tobinarray()) & 0xffffffff
|
||||
header.puts(start, struct.pack(fmt, crc_val))
|
||||
elif subtype.startswith("SHA"):
|
||||
if subtype == "SHA256":
|
||||
hash = hashlib.sha256()
|
||||
|
|
|
|||
Loading…
Reference in New Issue