Skip to content
Commit e026c367 authored by Piotr Dymacz's avatar Piotr Dymacz Committed by Fabio Utzig
Browse files

imgtool: sign: allow using 16-bit custom TLVs from valid range



The TLV type field in trailer TLV struct is defined as unsigned 16-bit
(in LE byte order). Currently, due to Python's struct format specified
as 'BBH', the 'imgtool' accepts only single byte for this field.

This results in error when trying to use 16-bit TLV type with option
'--custom-tlv':

  struct.error: ubyte format requires 0 <= number <= 255

This changes format to 'HH' which allows using 16-bit TLV types and
while at it, adds also simple range validation for custom TLV type.
As defined in image.h header, the vendor reserved TLVs value should
be from 0x00a0 to 0xfffe range.

Signed-off-by: default avatarPiotr Dymacz <pepe2k@gmail.com>
parent 4d51038c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment