Skip to content

Commit

Permalink
Fix bad cpu codes + minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Jul 7, 2024
1 parent f9b5b78 commit a789e6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
21 changes: 9 additions & 12 deletions mtkclient/Library/DA/xml/xml_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
from struct import pack, unpack
from queue import Queue
from threading import Thread
from Cryptodome.Hash import SHA256
from Cryptodome.Util.number import bytes_to_long, size
from Cryptodome.Cipher import PKCS1_OAEP
from Cryptodome.PublicKey import RSA
from Cryptodome.Util.number import size
from mtkclient.Library.DA.xml.xml_param import DataType, FtSystemOSE, LogLevel
from mtkclient.Library.utils import logsetup, LogBase
from mtkclient.Library.error import ErrorHandler
Expand All @@ -20,7 +17,7 @@
from mtkclient.Library.DA.xml.xml_cmd import XMLCmd, BootModes
from mtkclient.Library.DA.xml.extension.v6 import XmlFlashExt
from mtkclient.Library.Auth.sla import generate_da_sla_signature
from mtkclient.Library.Auth.sla_keys import da_sla_keys
from mtkclient.Library.Auth.sla_keys import da_sla_keys, SlaKey

rq = Queue()

Expand Down Expand Up @@ -619,11 +616,12 @@ def upload_da(self):
self.dev_info = self.get_dev_info()
found = False
for key in da_sla_keys:
if da2.find(bytes.fromhex(key.n)) != -1:
sla_signature = generate_da_sla_signature(data=self.dev_info["rnd"], key=key.key)
if self.handle_sla(data=sla_signature):
found = True
break
if isinstance(key, SlaKey):
if da2.find(bytes.fromhex(key.n)) != -1:
sla_signature = generate_da_sla_signature(data=self.dev_info["rnd"], key=key.key)
if self.handle_sla(data=sla_signature):
found = True
break
if not found:
print("No valid sla key found, using dummy auth ....")
sla_signature = b"\x00" * 0x100
Expand Down Expand Up @@ -848,8 +846,7 @@ def partitiontype_and_size(self, storage=None, parttype=None, length=0):
if self.daconfig.flashtype == "emmc":
length = min(length, self.emmc.gp1_size)
else:
self.error("Unknown parttype. Known parttypes are \"boot1\",\"boot2\",\"gp1\"," +
"\"gp2\",\"gp3\",\"gp4\",\"rpmb\"")
self.error("Unknown parttype. Known parttypes are \"boot1\",\"boot2\",\"gp1\",\"gp2\",\"gp3\",\"gp4\",\"rpmb\"")
return []
elif storage == DaStorage.MTK_DA_STORAGE_UFS:
if parttype is None or parttype == "lu3" or parttype == "user": # USER
Expand Down
4 changes: 2 additions & 2 deletions mtkclient/config/brom_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ def __init__(self, var1=None, watchdog=None, uart=None, brom_payload_addr=None,
socid_addr=0x102BA8,
efuse_addr=0x11cb0000,
damode=DAmodes.XFLASH,
dacode=0x6781,
dacode=0x1066,
name="MT6781",
description="Helio G96",
loader="mt6781_payload.bin"
Expand Down Expand Up @@ -1413,7 +1413,7 @@ def __init__(self, var1=None, watchdog=None, uart=None, brom_payload_addr=None,
socid_addr=0x100934,
# prov_addr=0x1066C0,
damode=DAmodes.XML,
dacode=0x6983,
dacode=0x907,
name="MT6983",
description="Dimensity 9000/9000+"
# loader="mt6983_payload.bin"
Expand Down

0 comments on commit a789e6c

Please sign in to comment.