Change uss to ent to remove confusion

This commit is contained in:
Joachim Strömbergson 2022-09-21 09:38:44 +02:00
parent dde3b56bbf
commit 43ec0641c0
No known key found for this signature in database
GPG Key ID: 5DDC7C542422EC8D

View File

@ -22,17 +22,17 @@ from hkdf import Hkdf
#------------------------------------------------------------------- #-------------------------------------------------------------------
#------------------------------------------------------------------- #-------------------------------------------------------------------
def gen_uds(verbose, arg_uss): def gen_uds(verbose, arg_ent):
if verbose: if verbose:
print("\nGenerating UDS") print("\nGenerating UDS")
if arg_uss == None: if arg_ent == None:
uss = str.encode(input("Enter user supplied secret: ")) ent = str.encode(input("Enter additional entropy: "))
else: else:
uss = str.encode(arg_uss) ent = str.encode(arg_ent)
ikm = token_bytes(256) ikm = token_bytes(256)
my_hkdf = Hkdf(uss, ikm) my_hkdf = Hkdf(ent, ikm)
uds = my_hkdf.expand(b"TillitisKey UDS", 32) uds = my_hkdf.expand(b"TillitisKey UDS", 32)
uds_hex = uds.hex() uds_hex = uds.hex()
@ -104,7 +104,7 @@ def enc_str(b):
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", help="Verbose operation", action="store_true") parser.add_argument("-v", "--verbose", help="Verbose operation", action="store_true")
parser.add_argument("--uss", help="User supplied secret", type=str) parser.add_argument("--ent", help="User supplied entropy", type=str)
parser.add_argument("--vid", help="Vendor id (0 - 65535)", type=int) parser.add_argument("--vid", help="Vendor id (0 - 65535)", type=int)
parser.add_argument("--pid", help="Product id (0 - 2555", type=int) parser.add_argument("--pid", help="Product id (0 - 2555", type=int)
parser.add_argument("--rev", help="Revision number (0 - 15)", type=int) parser.add_argument("--rev", help="Revision number (0 - 15)", type=int)
@ -114,7 +114,7 @@ def main():
if args.verbose: if args.verbose:
print("TillitisKey Provisining Tool (TPT)") print("TillitisKey Provisining Tool (TPT)")
uds = gen_uds(args.verbose, args.uss) uds = gen_uds(args.verbose, args.ent)
save_uds(args.verbose, uds) save_uds(args.verbose, uds)
udi = gen_udi(args.verbose, args.pid, args.vid, args.rev, args.serial) udi = gen_udi(args.verbose, args.pid, args.vid, args.rev, args.serial)