fusee/exo/sept: fix dev key derivation

This commit is contained in:
Jan4V
2020-01-19 09:26:10 +01:00
committed by Michael Scire
parent 9df7f0aada
commit 471bc7cc92
9 changed files with 83 additions and 23 deletions

View File

@@ -10,11 +10,29 @@ HOVI_SIG_KEY_PRD = [
bytearray.fromhex('00000000000000000000000000000000'),
]
HOVI_ENC_KEY_DEV = [
bytearray.fromhex('00000000000000000000000000000000'),
bytearray.fromhex('00000000000000000000000000000000'),
]
HOVI_SIG_KEY_DEV = [
bytearray.fromhex('00000000000000000000000000000000'),
bytearray.fromhex('00000000000000000000000000000000'),
]
IV = [
bytearray.fromhex('00000000000000000000000000000000'),
bytearray.fromhex('00000000000000000000000000000000'),
]
IV_DEV = [
bytearray.fromhex('00000000000000000000000000000000'),
bytearray.fromhex('00000000000000000000000000000000'),
]
assert len(HOVI_ENC_KEY_PRD) == NUM_KEYS
assert len(HOVI_SIG_KEY_PRD) == NUM_KEYS
assert len(IV) == NUM_KEYS
assert len(HOVI_ENC_KEY_DEV) == NUM_KEYS
assert len(HOVI_SIG_KEY_DEV) == NUM_KEYS
assert len(IV) == NUM_KEYS
assert len(IV_DEV) == NUM_KEYS

View File

@@ -131,6 +131,8 @@ else
@touch $(TOPDIR)/$(TARGET).bin
@cp $(SEPT_00_ENC_PATH) $(TOPDIR)/$(TARGET)_00.enc
@cp $(SEPT_01_ENC_PATH) $(TOPDIR)/$(TARGET)_01.enc
@cp $(SEPT_DEV_00_ENC_PATH) $(TOPDIR)/$(TARGET)_dev_00.enc
@cp $(SEPT_DEV_01_ENC_PATH) $(TOPDIR)/$(TARGET)_dev_01.enc
endif
#---------------------------------------------------------------------------------
@@ -150,7 +152,11 @@ DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all : $(OUTPUT)_01.enc
all : $(OUTPUT)_dev_01.enc
$(OUTPUT)_dev_01.enc : $(OUTPUT)_dev_00.enc
$(OUTPUT)_dev_00.enc : $(OUTPUT)_01.enc
$(OUTPUT)_01.enc : $(OUTPUT)_00.enc

View File

@@ -71,11 +71,12 @@ def main(argc, argv):
code = f.read()
if len(code) & 0xF:
code = code + bytearray(0x10 - (len(code) & 0xF))
# TODO: Support dev unit crypto
fn, fext = os.path.splitext(argv[2])
for key in range(KEYS.NUM_KEYS):
with open(fn + ('_%02X' % key) + fext, 'wb') as f:
f.write(sign_encrypt_code(code, KEYS.HOVI_SIG_KEY_PRD[key], KEYS.HOVI_ENC_KEY_PRD[key], KEYS.IV[key], b'THANKS_NVIDIA_<3', key))
with open(fn + ('_dev_%02X' % key) + fext, 'wb') as f:
f.write(sign_encrypt_code(code, KEYS.HOVI_SIG_KEY_DEV[key], KEYS.HOVI_ENC_KEY_DEV[key], KEYS.IV_DEV[key], b'THANKS_NVIDIA_<3', key))
return 0