mirror of
https://github.com/bkerler/mtkclient.git
synced 2024-12-03 12:46:56 -05:00
Fix seccf
This commit is contained in:
parent
65c6ff01b7
commit
2816c173c0
1 changed files with 5 additions and 6 deletions
11
stage2
11
stage2
|
@ -354,7 +354,7 @@ class Stage2(metaclass=LogBase):
|
||||||
def keys(self, data=b"", otp=None, mode="dxcc") -> tuple[list or bytes or None,str]:
|
def keys(self, data=b"", otp=None, mode="dxcc") -> tuple[list or bytes or None,str]:
|
||||||
# self.hwcrypto.disable_range_blacklist("cqdma",self.cmd_C8)
|
# self.hwcrypto.disable_range_blacklist("cqdma",self.cmd_C8)
|
||||||
keyinfo=""
|
keyinfo=""
|
||||||
if self.setup.dxcc_base is not None:
|
if self.setup.dxcc_base is not None and mode not in ["sej_aes_decrypt","sej_aes_encrypt","dxcc_sha256"]:
|
||||||
rpmbkey = self.hwcrypto.aes_hwcrypt(btype="dxcc",mode="rpmb")
|
rpmbkey = self.hwcrypto.aes_hwcrypt(btype="dxcc",mode="rpmb")
|
||||||
fdekey = self.hwcrypto.aes_hwcrypt(btype="dxcc",mode="fde")
|
fdekey = self.hwcrypto.aes_hwcrypt(btype="dxcc",mode="fde")
|
||||||
tfdekey = self.hwcrypto.aes_hwcrypt(btype="dxcc",mode="itrustee-fde")
|
tfdekey = self.hwcrypto.aes_hwcrypt(btype="dxcc",mode="itrustee-fde")
|
||||||
|
@ -377,7 +377,7 @@ class Stage2(metaclass=LogBase):
|
||||||
with open(os.path.join("logs", "provkey.txt"), "wb") as wf:
|
with open(os.path.join("logs", "provkey.txt"), "wb") as wf:
|
||||||
wf.write(hexlify(provkey))
|
wf.write(hexlify(provkey))
|
||||||
return [rpmbkey, fdekey, tfdekey, platkey, provkey], keyinfo
|
return [rpmbkey, fdekey, tfdekey, platkey, provkey], keyinfo
|
||||||
elif self.setup.sej_base is not None:
|
elif self.setup.sej_base is not None and mode not in ["sej_aes_decrypt","sej_aes_encrypt","dxcc_sha256"]:
|
||||||
rpmbkey = self.hwcrypto.aes_hwcrypt(mode="rpmb", data=data, otp=otp, btype="sej")
|
rpmbkey = self.hwcrypto.aes_hwcrypt(mode="rpmb", data=data, otp=otp, btype="sej")
|
||||||
keyinfo+="\nKeys :\n-----------------------------------------\n"
|
keyinfo+="\nKeys :\n-----------------------------------------\n"
|
||||||
keyinfo+="RPMB: " + hexlify(rpmbkey).decode('utf-8')
|
keyinfo+="RPMB: " + hexlify(rpmbkey).decode('utf-8')
|
||||||
|
@ -498,14 +498,13 @@ def main():
|
||||||
|
|
||||||
parser_reboot = subparsers.add_parser("reboot", help="Reboot device")
|
parser_reboot = subparsers.add_parser("reboot", help="Reboot device")
|
||||||
|
|
||||||
|
parser_seccfg = subparsers.add_parser("seccfg", help="Generate seccfg")
|
||||||
|
|
||||||
parser_keys = subparsers.add_parser("keys", help="Write memory")
|
parser_keys = subparsers.add_parser("keys", help="Write memory")
|
||||||
parser_keys.add_argument('--otp', dest='otp', type=str,
|
parser_keys.add_argument('--otp', dest='otp', type=str,
|
||||||
help='OTP for keys (dxcc,sej,gcpu)')
|
help='OTP for keys (dxcc,sej,gcpu)')
|
||||||
parser_keys.add_argument('--mode', dest='mode', default=None, type=str,
|
parser_keys.add_argument('--mode', dest='mode', default=None, type=str,
|
||||||
help='keymode (dxcc,sej,gcpu)')
|
help='keymode (dxcc,sej,gcpu)')
|
||||||
|
|
||||||
parser_seccfg = subparsers.add_parser("seccfg", help="Generate seccfg")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
cmd = args.cmd
|
cmd = args.cmd
|
||||||
if cmd not in cmds:
|
if cmd not in cmds:
|
||||||
|
@ -627,7 +626,7 @@ def main():
|
||||||
data = seccfg_data + enc_hash
|
data = seccfg_data + enc_hash
|
||||||
data += b"\x00" * (0x200 - len(data))
|
data += b"\x00" * (0x200 - len(data))
|
||||||
wf.write(data)
|
wf.write(data)
|
||||||
print("Successfully wrote seccfg as seccfg.bin")
|
print("Successfully wrote seccfg to seccfg.bin.")
|
||||||
st2.close()
|
st2.close()
|
||||||
|
|
||||||
st2.close()
|
st2.close()
|
||||||
|
|
Loading…
Reference in a new issue