trustfence: get bytes from the console passphrase to feed the hash method
In Python 3, feeding string objects into hash method is not supported. Hashes work on bytes, not on characters. So we use 'encode()' on the passphrase to get the bytes object. See: * https://docs.python.org/3/howto/pyporting.html#text-versus-binary-data * https://docs.python.org/3/library/hashlib.html#module-hashlib This commit fixes build failures as: Exception: TypeError: Unicode-objects must be encoded before hashing https://jira.digi.com/browse/DEL-3984 Signed-off-by: Tatiana Leon <tatiana.leon@digi.com>
This commit is contained in:
parent
a776eb1bd8
commit
38740f9a04
|
|
@ -40,7 +40,7 @@ python () {
|
|||
if (d.getVar("TRUSTFENCE_CONSOLE_DISABLE", True) == "1"):
|
||||
d.appendVar("UBOOT_EXTRA_CONF", "CONFIG_CONSOLE_DISABLE=y ")
|
||||
if d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE", True):
|
||||
passphrase_hash = hashlib.sha256(d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE", True)).hexdigest()
|
||||
passphrase_hash = hashlib.sha256(d.getVar("TRUSTFENCE_CONSOLE_PASSPHRASE_ENABLE", True).encode()).hexdigest()
|
||||
d.appendVar("UBOOT_EXTRA_CONF", 'CONFIG_CONSOLE_ENABLE_PASSPHRASE=y CONFIG_CONSOLE_ENABLE_PASSPHRASE_KEY=\\"%s\\" ' % passphrase_hash)
|
||||
elif d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE", True):
|
||||
d.appendVar("UBOOT_EXTRA_CONF", " CONFIG_CONSOLE_ENABLE_GPIO=y CONFIG_CONSOLE_ENABLE_GPIO_NR=%s " % d.getVar("TRUSTFENCE_CONSOLE_GPIO_ENABLE", True))
|
||||
|
|
|
|||
Loading…
Reference in New Issue