1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

refactor path validation

This commit is contained in:
Adrian Nagy 2019-04-18 14:25:42 +02:00
parent da7bb8abf8
commit 2dd1ae6491

View File

@ -54,10 +54,14 @@ def validate_full_path(path: list) -> bool:
return False
if path[1] != 1729 | HARDENED:
return False
if length == 3 and (path[2] < HARDENED or path[2] > 1000000 | HARDENED):
return False
if length == 4 and (path[2] != 0 | HARDENED or path[3] < HARDENED or path[3] > 1000000 | HARDENED):
return False
if length == 3:
if path[2] < HARDENED or path[2] > 1000000 | HARDENED:
return False
if length == 4:
if path[2] != 0 | HARDENED:
return False
if path[3] < HARDENED or path[3] > 1000000 | HARDENED:
return False
return True