Skip to content

Commit c7651e0

Browse files
evenlrlubos
authored andcommitted
scripts: generate psa key attributes strips to many zeros
Turns out that the string strip function in python doesn't just strip any occurrence of any sub string which is equal to the string I pass in but also also any occurrence of any of the characters I pass in to the function. Replaced the strip function with a function that strips away only the sub-string I pass in to the function from the beginning of the string. Signed-off-by: Even Falch-Larsen <[email protected]>
1 parent 92e5c0d commit c7651e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/generate_psa_key_attributes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,9 @@ def main() -> None:
242242
if args.trng_key:
243243
value = f'TRNG:{int(math.ceil(args.size / 8))}'
244244
elif args.key:
245-
key = args.key.strip("0x")
245+
key = args.key
246+
while key.startswith("0x"):
247+
key = key.removeprefix("0x")
246248
if not is_valid_hexa_code(key):
247249
print("Invalid KEY value")
248250
return

0 commit comments

Comments
 (0)