Skip to content

Commit

Permalink
Fix sla issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bkerler committed Sep 19, 2024
1 parent 8fff2ab commit 2a8131d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion mtkclient/Library/DA/xflash/xflash_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
from binascii import hexlify
from struct import pack, unpack

from Cryptodome.Util.number import long_to_bytes

from mtkclient.Library.Auth.sla import generate_da_sla_signature
from mtkclient.Library.DA.xflash.xflash_flash_param import NandExtension
from mtkclient.Library.DA.xflash.xflash_param import Cmd, ChecksumAlgorithm, FtSystemOSE, DataType
Expand Down Expand Up @@ -1142,7 +1144,7 @@ def handle_sla(self, da2):
rsakey = None
from mtkclient.Library.Auth.sla_keys import da_sla_keys
for key in da_sla_keys:
if da2.find(bytes.fromhex(key.n)) != -1:
if da2.find(long_to_bytes(key.n)) != -1:
rsakey = key
break
if rsakey is None:
Expand Down
3 changes: 2 additions & 1 deletion mtkclient/Library/DA/xml/xml_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from queue import Queue
from threading import Thread

from Cryptodome.Util.number import long_to_bytes
from Cryptodome.Cipher import PKCS1_OAEP
from Cryptodome.Hash import SHA256
from Cryptodome.PublicKey import RSA
Expand Down Expand Up @@ -624,7 +625,7 @@ def upload_da(self):
from mtkclient.Library.Auth.sla_keys import da_sla_keys, SlaKey
for key in da_sla_keys:
if isinstance(key, SlaKey):
if da2.find(bytes.fromhex(key.n)) != -1:
if da2.find(long_to_bytes(key.n)) != -1:
rsakey = key
if rsakey is None:
print("No valid sla key found, using dummy auth ....")
Expand Down

0 comments on commit 2a8131d

Please sign in to comment.