Skip to content

Commit e0027a2

Browse files
committed
imgtool: Rename key-ids to psa-key-ids
Since the key id concept in the PSA specific, rename the variables accordingly. Signed-off-by: Maulik Patel <[email protected]> Change-Id: I8a8a5ceba5554211f185cc4045a6081b6d407507
1 parent 591c3e5 commit e0027a2

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

scripts/imgtool/image.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def __init__(self, version=None, header_size=IMAGE_HEADER_SIZE,
297297
self.enctlv_len = 0
298298
self.max_align = max(DEFAULT_MAX_ALIGN, align) if max_align is None else int(max_align)
299299
self.non_bootable = non_bootable
300-
self.key_ids = None
300+
self.psa_key_ids = None
301301

302302
if self.max_align == DEFAULT_MAX_ALIGN:
303303
self.boot_magic = bytes([
@@ -663,9 +663,9 @@ def create(self, keys, public_key_format, enckey, dependencies=None,
663663
self.signatures = []
664664
for i, key in enumerate(keys):
665665
# If key IDs are provided, and we have enough for this key, add it first.
666-
if self.key_ids is not None and len(self.key_ids) > i:
666+
if self.psa_key_ids is not None and len(self.psa_key_ids) > i:
667667
# Convert key id (an integer) to 4-byte big-endian bytes.
668-
kid_bytes = self.key_ids[i].to_bytes(4, 'big')
668+
kid_bytes = self.psa_key_ids[i].to_bytes(4, 'big')
669669
tlv.add('KEYID', kid_bytes) # Using the TLV tag that corresponds to key IDs.
670670

671671
if public_key_format == 'hash':
@@ -937,9 +937,9 @@ def verify(imgfile, key):
937937
return VerifyResult.INVALID_SIGNATURE, None, None, None
938938

939939

940-
def set_key_ids(self, key_ids):
940+
def set_key_ids(self, psa_key_ids):
941941
"""Set list of key IDs (integers) to be inserted before each signature."""
942-
self.key_ids = key_ids
942+
self.psa_key_ids = psa_key_ids
943943

944944
def _add_key_id_tlv_to_unprotected(self, tlv, key_id: int):
945945
"""Add a key ID TLV into the *unprotected* TLV area."""

scripts/imgtool/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ def convert(self, value, param, ctx):
446446
help='send to OUTFILE the payload or payload''s digest instead '
447447
'of complied image. These data can be used for external image '
448448
'signing')
449-
@click.option('--key-ids', multiple=True, type=int, required=False,
449+
@click.option('--psa-key-ids', multiple=True, type=int, required=False,
450450
help='List of integer key IDs for each signature.')
451451
@click.command(help='''Create a signed or unsigned image\n
452452
INFILE and OUTFILE are parsed as Intel HEX if the params have
@@ -457,7 +457,7 @@ def sign(key, public_key_format, align, version, pad_sig, header_size,
457457
dependencies, load_addr, hex_addr, erased_val, save_enctlv,
458458
security_counter, boot_record, custom_tlv, rom_fixed, max_align,
459459
clear, fix_sig, fix_sig_pubkey, sig_out, user_sha, is_pure,
460-
vector_to_sign, non_bootable, key_ids):
460+
vector_to_sign, non_bootable, psa_key_ids):
461461

462462
if confirm:
463463
# Confirmed but non-padded images don't make much sense, because

0 commit comments

Comments
 (0)