mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 23:33:57 -04:00
Tools: allow for only ArduPilot keys when creating bootloader
This commit is contained in:
parent
d7710e5ccf
commit
9f00076e15
@ -18,17 +18,13 @@ from argparse import ArgumentParser
|
||||
parser = ArgumentParser(description='make_secure_bl')
|
||||
parser.add_argument("--omit-ardupilot-keys", action='store_true', default=False, help="omit ArduPilot signing keys")
|
||||
parser.add_argument("bootloader", type=str, default=None, help="bootloader")
|
||||
parser.add_argument("keys", type=str, nargs='+', help="keys")
|
||||
parser.add_argument("keys", nargs='*', type=str, default=[], help="keys")
|
||||
args = parser.parse_args()
|
||||
|
||||
descriptor = b'\x4e\xcf\x4e\xa5\xa6\xb6\xf7\x29'
|
||||
max_keys = 10
|
||||
key_len = 32
|
||||
|
||||
if len(args.keys) <= 0:
|
||||
print("At least one key file required")
|
||||
sys.exit(1)
|
||||
|
||||
img = open(args.bootloader, 'rb').read()
|
||||
|
||||
offset = img.find(descriptor)
|
||||
@ -55,6 +51,10 @@ if len(keys) > max_keys:
|
||||
print("Too many key files %u, max is %u" % (len(keys), max_keys))
|
||||
sys.exit(1)
|
||||
|
||||
if len(keys) <= 0:
|
||||
print("At least one key file required")
|
||||
sys.exit(1)
|
||||
|
||||
def decode_key(ktype, key):
|
||||
ktype += "_KEYV1:"
|
||||
if not key.startswith(ktype):
|
||||
|
Loading…
Reference in New Issue
Block a user