Update mtkclient, prepare for rpmb key gen

This commit is contained in:
Bjoern Kerler 2021-12-08 21:06:26 +01:00
parent e546bf2a83
commit 6726a14212
9 changed files with 98 additions and 86 deletions

View file

@ -1160,7 +1160,7 @@ class dxcc(metaclass=LogBase):
pdesc[5] = 0
self.sasi_sb_adddescsequence(pdesc)
dstaddr = self.da_payload_addr - 0x300
self.SB_HalWaitDescCompletion(dstaddr)
self.SB_HalWaitDescCompletion()
# data=self.read32(0x200D90)
self.tzcc_clk(0)
return platkey, provkey
@ -1205,13 +1205,13 @@ class dxcc(metaclass=LogBase):
dmaMode = dmaMode
self.writemem(inputSramAddr, DataIn[:bufferlen])
if self.SBROM_AesCmacDriver(aesKeyType, pInternalKey, inputSramAddr, dmaMode, bufferlen, sramAddr):
return pInternalKey
return sramAddr
return 0
def SB_HalInit(self):
return self.SB_HalClearInterruptBit()
def SB_HalWaitDescCompletion(self, destptr):
def SB_HalWaitDescCompletion(self, destptr=0):
data = []
self.SB_HalClearInterruptBit()
val = self.sasi_paldmamap(0)
@ -1236,7 +1236,7 @@ class dxcc(metaclass=LogBase):
else:
return 0xF6000001
def SBROM_AesCmacDriver(self, aesKeyType, pInternalKey, pDataIn, dmaMode, blockSize, pCMacResult):
def SBROM_AesCmacDriver(self, aesKeyType, pInternalKey, pDataIn, dmaMode, blockSize, pDataOut):
ivSramAddr = 0
if aesKeyType == HwCryptoKey.ROOT_KEY:
if self.read32(self.dxcc_base + self.DX_HOST_SEP_HOST_GPR4) & 2 != 0:
@ -1289,14 +1289,14 @@ class dxcc(metaclass=LogBase):
xdesc = hw_desc_set_setup_mode(xdesc, SetupOp.SETUP_WRITE_STATE0) # desc[4]=0x8001C00
xdesc = hw_desc_set_flow_mode(xdesc, FlowMode.S_AES_to_DOUT) # desc[4]=0x8001C26
if dmaMode == DmaMode.DMA_SRAM:
xdesc = hw_desc_set_dout_sram(xdesc, pInternalKey, AES_BLOCK_SIZE_IN_BYTES)
xdesc = hw_desc_set_dout_sram(xdesc, pDataOut, AES_BLOCK_SIZE_IN_BYTES)
else:
xdesc = hw_desc_set_dout_dlli(xdesc, pInternalKey, AES_BLOCK_SIZE_IN_BYTES, SB_AXI_ID,
xdesc = hw_desc_set_dout_dlli(xdesc, pDataOut, AES_BLOCK_SIZE_IN_BYTES, SB_AXI_ID,
0) # desc[2]=0x200E08, desc[3]=0x42
# xdesc = hw_desc_set_din_sram(xdesc, 0, 0)
xdesc = hw_desc_set_din_nodma(xdesc, 0, 0)
self.sasi_sb_adddescsequence(xdesc)
return self.SB_HalWaitDescCompletion(pCMacResult) == 0
return self.SB_HalWaitDescCompletion() == 0
def mtee_decrypt(self, data):
key = bytes.fromhex("B936C14D95A99585073E5607784A51F7444B60D6BFD6110F76D004CCB7E1950E")
@ -1352,7 +1352,7 @@ class dxcc(metaclass=LogBase):
self.sasi_sb_adddescsequence(tdesc)
def sbrom_cryptoupdate(self, inputptr, outputptr, blockSize, islastblock, cryptodrivermode, waitforcrypto):
if waitforcrypto != 2 or self.SB_HalWaitDescCompletion(self.dxcc_base) == 0:
if waitforcrypto != 2 or self.SB_HalWaitDescCompletion() == 0:
if islastblock == 1 and (cryptodrivermode & 0xFFFFFFFD) == 0:
# 0=0
# 1=0
@ -1373,7 +1373,7 @@ class dxcc(metaclass=LogBase):
udesc = hw_desc_set_flow_mode(udesc, FlowMode.DIN_HASH)
self.sasi_sb_adddescsequence(udesc)
if (waitforcrypto == 2 and not islastblock) or waitforcrypto == 3:
self.SB_HalWaitDescCompletion(self.dxcc_base)
self.SB_HalWaitDescCompletion()
elif waitforcrypto == 0:
return 0
else:
@ -1394,7 +1394,7 @@ class dxcc(metaclass=LogBase):
# 4 = 0x80C082B
# 5 = outputptr>>32<<16
self.sasi_sb_adddescsequence(fdesc)
return self.SB_HalWaitDescCompletion(self.dxcc_base)
return self.SB_HalWaitDescCompletion()
if __name__ == "__main__":

View file

@ -4,7 +4,7 @@ from mtkclient.config.payloads import pathconfig
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.hwcrypto import crypto_setup, hwcrypto
from mtkclient.Library.utils import LogBase, progress, logsetup, find_binary
from mtkclient.Library.settings import writesetting, loadsetting
from mtkclient.Library.settings import hwparam
from mtkclient.Library.seccfg import seccfg
from binascii import hexlify
import hashlib
@ -24,6 +24,7 @@ class legacyext(metaclass=LogBase):
self.error = self.__logger.error
self.warning = self.__logger.warning
self.mtk = mtk
self.hwparam = hwparam(mtk.config.meid)
self.loglevel = loglevel
self.__logger = self.__logger
self.eh = ErrorHandler()
@ -172,8 +173,8 @@ class legacyext(metaclass=LogBase):
def generate_keys(self):
hwc = self.cryptosetup()
meid = b""
meidv = loadsetting("meid")
socidv = loadsetting("socid")
meidv = self.hwparam.loadsetting("meid")
socidv = self.hwparam.loadsetting("socid")
if meidv is not None:
meid = bytes.fromhex(meidv)
self.info("MEID : " + meidv)
@ -181,7 +182,7 @@ class legacyext(metaclass=LogBase):
try:
if self.config.chipconfig.meid_addr is not None:
meid = b"".join([pack("<I", val) for val in self.readmem(self.config.chipconfig.meid_addr, 4)])
writesetting("meid", hexlify(meid).decode('utf-8'))
self.hwparam.writesetting("meid", hexlify(meid).decode('utf-8'))
self.info("MEID : " + hexlify(meid).decode('utf-8'))
except Exception as err:
pass
@ -192,7 +193,7 @@ class legacyext(metaclass=LogBase):
try:
if self.config.chipconfig.socid_addr is not None:
socid = b"".join([pack("<I",val) for val in self.readmem(self.config.chipconfig.socid_addr,8)])
writesetting("socid", hexlify(socid).decode('utf-8'))
self.hwparam.writesetting("socid", hexlify(socid).decode('utf-8'))
self.info("SOCID : " + hexlify(socid).decode('utf-8'))
except Exception as err:
pass
@ -211,20 +212,20 @@ class legacyext(metaclass=LogBase):
#self.info("Platkey : " + hexlify(platkey).decode('utf-8'))
if rpmbkey is not None:
self.info("RPMB : " + hexlify(rpmbkey).decode('utf-8'))
writesetting("rpmbkey",hexlify(rpmbkey).decode('utf-8'))
self.hwparam.writesetting("rpmbkey",hexlify(rpmbkey).decode('utf-8'))
if rpmb2key is not None:
self.info("RPMB2 : " + hexlify(rpmb2key).decode('utf-8'))
writesetting("rpmb2key",hexlify(rpmb2key).decode('utf-8'))
self.hwparam.writesetting("rpmb2key",hexlify(rpmb2key).decode('utf-8'))
if fdekey is not None:
self.info("FDE : " + hexlify(fdekey).decode('utf-8'))
writesetting("fdekey",hexlify(fdekey).decode('utf-8'))
self.hwparam.writesetting("fdekey",hexlify(fdekey).decode('utf-8'))
if ikey is not None:
self.info("iTrustee : " + hexlify(ikey).decode('utf-8'))
writesetting("kmkey", hexlify(ikey).decode('utf-8'))
self.hwparam.writesetting("kmkey", hexlify(ikey).decode('utf-8'))
if self.config.chipconfig.prov_addr:
provkey = self.custom_read(self.config.chipconfig.prov_addr, 16)
self.info("PROV : " + hexlify(provkey).decode('utf-8'))
writesetting("provkey", hexlify(provkey).decode('utf-8'))
self.hwparam.writesetting("provkey", hexlify(provkey).decode('utf-8'))
"""
hrid = self.xflash.get_hrid()
if hrid is not None:
@ -240,7 +241,7 @@ class legacyext(metaclass=LogBase):
self.setotp(hwc)
rpmbkey = hwc.aes_hwcrypt(mode="rpmb", data=meid, btype="sej")
self.info("RPMB : " + hexlify(rpmbkey).decode('utf-8'))
writesetting("rpmbkey", hexlify(rpmbkey).decode('utf-8'))
self.hwparam.writesetting("rpmbkey", hexlify(rpmbkey).decode('utf-8'))
else:
self.info("SEJ Mode: No meid found. Are you in brom mode ?")
return True

View file

@ -10,7 +10,6 @@ from struct import unpack, pack
from binascii import hexlify
from mtkclient.Library.utils import LogBase, logsetup
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.settings import writesetting
class META(metaclass=LogBase):
class Mode(Enum):

View file

@ -13,7 +13,7 @@ from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.daconfig import DaStorage, EMMC_PartitionType
from mtkclient.Library.partition import Partition
from mtkclient.config.payloads import pathconfig
from mtkclient.Library.settings import writesetting
from mtkclient.Library.settings import hwparam
from mtkclient.Library.legacy_ext import legacyext
class norinfo:
@ -149,10 +149,11 @@ class emmcinfo:
m_emmc_cid = None
m_emmc_fwver = None
def __init__(self, data = None):
def __init__(self, hwparam: hwparam, data = None):
if data is None:
return
sh = structhelper(data)
self.hwparam = hwparam
self.m_emmc_ret = sh.dword(True)
self.m_emmc_boot1_size = sh.qword(True)
self.m_emmc_boot2_size = sh.qword(True)
@ -174,7 +175,8 @@ class emmcinfo:
res += f"m_emmc_ua_size = {hex(self.m_emmc_ua_size)}\n"
cid = pack("<QQ", self.m_emmc_cid[0], self.m_emmc_cid[1])
res += f"m_emmc_cid = {hexlify(cid).decode('utf-8')}\n"
writesetting("cid", hexlify(cid).decode('utf-8'))
if self.hwparam is not None:
self.hwparam.writesetting("cid", hexlify(cid).decode('utf-8'))
res += f"m_emmc_fwver = {hexlify(self.m_emmc_fwver).decode('utf-8')}\n"
return res
@ -184,10 +186,11 @@ class sdcinfo:
m_sdmmc_ua_size = None
m_sdmmc_cid = None
def __init__(self, data = None):
def __init__(self, hwparam:hwparam, data = None):
if data is None:
return
sh = structhelper(data)
self.hwparam = hwparam
self.m_sdmmc_info = sh.dword(True)
self.m_sdmmc_ua_size = sh.qword(True)
self.m_sdmmc_cid = sh.qwords(2, True)
@ -196,7 +199,8 @@ class sdcinfo:
print(f"m_sdmmc_info = {hex(self.m_sdmmc_info)}")
print(f"m_sdmmc_ua_size = {hex(self.m_sdmmc_ua_size)}")
cid = pack("<QQ", self.m_sdmmc_cid[0], self.m_sdmmc_cid[1])
writesetting("cid", hexlify(cid).decode('utf-8'))
if self.hwparam is not None:
self.hwparam.writesetting("cid", hexlify(cid).decode('utf-8'))
print(f"m_sdmmc_cid = {hexlify(cid).decode('utf-8')}")
@ -676,6 +680,7 @@ class DALegacy(metaclass=LogBase):
self.pathconfig = pathconfig()
self.patch = False
self.generatekeys = self.mtk.config.generatekeys
self.hwparam = hwparam(self.mtk.config.meid)
if self.generatekeys:
self.patch = True
self.lft = legacyext(self.mtk, self, loglevel)
@ -949,8 +954,8 @@ class DALegacy(metaclass=LogBase):
m_nand_dev_code = unpack(">" + str(nandcount) + "H", nc)
self.nand.m_nand_flash_dev_code = m_nand_dev_code
self.nand.info2 = nandinfo2(self.usbread(9))
self.emmc = emmcinfo(self.usbread(0x5C))
self.sdc = sdcinfo(self.usbread(0x1C))
self.emmc = emmcinfo(self.hwparam,self.usbread(0x5C))
self.sdc = sdcinfo(self.hwparam,self.usbread(0x1C))
self.flashconfig = configinfo(self.usbread(0x26))
pi = passinfo(self.usbread(0xA))
if pi.ack == 0x5A:

View file

@ -13,7 +13,7 @@ from mtkclient.Library.mtk_daxflash import DAXFlash
from mtkclient.config.brom_config import damodes
from mtkclient.Library.xflash_ext import xflashext
from mtkclient.Library.legacy_ext import legacyext
from mtkclient.Library.settings import hwparam
class DAloader(metaclass=LogBase):
def __init__(self, mtk, loglevel=logging.INFO):
@ -31,6 +31,7 @@ class DAloader(metaclass=LogBase):
self.rword = self.mtk.port.rword
self.daconfig = DAconfig(mtk=self.mtk, loader=self.mtk.config.loader,
preloader=self.mtk.config.preloader, loglevel=loglevel)
self.hwparam = hwparam(mtk.config.meid)
self.xft = None
self.lft = None
self.da = None
@ -105,8 +106,8 @@ class DAloader(metaclass=LogBase):
self.daconfig.flashsize = config["flashsize"]
self.da.nor = norinfo()
self.da.nand = nandinfo64()
self.da.emmc = emmcinfo()
self.da.sdc = sdcinfo()
self.da.emmc = emmcinfo(self.hwparam)
self.da.sdc = sdcinfo(self.hwparam)
self.lft=legacyext(self.mtk, self.da, self.loglevel)
self.da.emmc.m_emmc_ua_size = config["m_emmc_ua_size"]
self.da.emmc.m_emmc_boot1_size = config["m_emmc_boot1_size"]

View file

@ -7,7 +7,7 @@ import os
import hashlib
from binascii import hexlify
from struct import pack, unpack
from mtkclient.Library.settings import writesetting
from mtkclient.Library.settings import hwparam
from mtkclient.Library.utils import LogBase, progress, logsetup
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.daconfig import EMMC_PartitionType, UFS_PartitionType, DaStorage
@ -153,6 +153,7 @@ class DAXFlash(metaclass=LogBase):
self.partition = Partition(self.mtk, self.readflash, self.read_pmt, loglevel)
self.progress = progress(self.daconfig.pagesize)
self.pathconfig = pathconfig()
self.hwparam = hwparam(self.mtk.config.meid)
self.patch = False
self.generatekeys = self.mtk.config.generatekeys
if self.generatekeys:
@ -559,7 +560,7 @@ class DAXFlash(metaclass=LogBase):
except:
pass
self.info(f"EMMC CID: {hexlify(emmc.cid).decode('utf-8')}")
writesetting("cid", hexlify(emmc.cid).decode('utf-8'))
self.hwparam.writesetting("cid", hexlify(emmc.cid).decode('utf-8'))
self.info(f"EMMC Boot1 Size: {hex(emmc.boot1_size)}")
self.info(f"EMMC Boot2 Size: {hex(emmc.boot2_size)}")
self.info(f"EMMC GP1 Size: {hex(emmc.gp1_size)}")
@ -663,7 +664,7 @@ class DAXFlash(metaclass=LogBase):
except:
pass
self.info(f"UFS CID: {hexlify(ufs.cid).decode('utf-8')}")
writesetting("cid", hexlify(ufs.cid).decode('utf-8'))
self.hwparam.writesetting("cid", hexlify(ufs.cid).decode('utf-8'))
self.info(f"UFS LU0 Size: {hex(ufs.lu0_size)}")
self.info(f"UFS LU1 Size: {hex(ufs.lu1_size)}")
self.info(f"UFS LU2 Size: {hex(ufs.lu2_size)}")
@ -1106,7 +1107,7 @@ class DAXFlash(metaclass=LogBase):
# if self.get_da_stor_life_check() == 0x0:
cid = self.get_chip_id()
self.info("DA-CODE : 0x%X", (cid.hw_code << 4) + (cid.hw_code >> 4))
writesetting("hwcode", hex(self.config.hwcode))
self.hwparam.writesetting("hwcode", hex(self.config.hwcode))
daextdata = self.xft.patch()
if daextdata is not None:

View file

@ -9,7 +9,7 @@ from struct import unpack, pack
from binascii import hexlify
from mtkclient.Library.utils import LogBase, logsetup
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.settings import writesetting
from mtkclient.Library.settings import hwparam
def calc_xflash_checksum(data):
checksum = 0
@ -124,6 +124,7 @@ class Preloader(metaclass=LogBase):
self.usbwrite = self.mtk.port.usbwrite
self.echo = self.mtk.port.echo
self.sendcmd = self.mtk.port.mtk_cmd
self.hwparam = None
def init(self, maxtries=None, display=True):
if os.path.exists(".state"):
@ -131,17 +132,6 @@ class Preloader(metaclass=LogBase):
os.remove(".state")
except:
pass
settings=os.path.join("logs","hwparam.json")
if os.path.exists(settings):
try:
os.remove(settings)
except:
pass
if os.path.exists("logs"):
try:
shutil.rmtree("logs")
except:
pass
readsocid=self.config.readsocid
skipwdt = self.config.skipwdt
@ -190,7 +180,6 @@ class Preloader(metaclass=LogBase):
self.setreg_disablewatchdogtimer(self.config.hwcode) # D4
if self.display:
self.info("HW code:\t\t\t" + hex(self.config.hwcode))
writesetting("hwcode",hex(self.config.hwcode))
self.config.target_config = self.get_target_config(self.display)
self.info("Get Target info")
self.get_blver()
@ -207,16 +196,19 @@ class Preloader(metaclass=LogBase):
self.info("\tHW subcode:\t\t" + hex(self.config.hwsubcode))
self.info("\tHW Ver:\t\t\t" + hex(self.config.hwver))
self.info("\tSW Ver:\t\t\t" + hex(self.config.swver))
meid = self.get_meid()
if len(meid) >= 16:
writesetting("meid", hexlify(meid).decode('utf-8'))
if meid != b"":
self.config.meid = self.get_meid()
if len(self.config.meid) >= 16:
self.hwparam = hwparam(hexlify(self.config.meid).decode('utf-8'))
self.hwparam.writesetting("meid",hexlify(self.config.meid).decode('utf-8'))
self.hwparam.writesetting("hwcode",hex(self.config.hwcode))
if self.config.meid != b"":
if self.display:
self.info("ME_ID:\t\t\t" + hexlify(meid).decode('utf-8').upper())
self.info("ME_ID:\t\t\t" + hexlify(self.config.meid).decode('utf-8').upper())
if readsocid or self.config.chipconfig.socid_addr:
socid = self.get_socid()
if len(socid) >= 16:
writesetting("socid", hexlify(socid).decode('utf-8'))
if self.hwparam is not None:
self.hwparam.writesetting("socid", hexlify(socid).decode('utf-8'))
if self.display:
if socid != b"":
self.info("SOC_ID:\t\t\t" + hexlify(socid).decode('utf-8').upper())

View file

@ -1,25 +1,37 @@
import json
import os.path
from binascii import hexlify
logpath = "logs"
paramfile = os.path.join(logpath, "hwparam.json")
class hwparam:
paramsetting = None
hwcode = None
logpath = "logs"
paramfile = os.path.join(logpath, "hwparam.json")
def loadsetting(key):
if os.path.exists(paramfile):
paramsetting = json.loads(open(paramfile, "r").read())
if key in paramsetting:
return paramsetting[key]
return None
def __init__(self, meid:str):
if isinstance(meid,bytearray) or isinstance(meid,bytes):
meid=hexlify(meid).decode('utf-8')
if meid is None:
self.paramsetting = None
if os.path.exists(self.paramfile):
self.paramsetting = json.loads(open(self.paramfile, "r").read())
if "meid" in self.paramsetting:
if meid!=self.paramsetting["meid"]:
self.paramsetting = {}
def writesetting(key:str,value:str):
try:
paramsetting={}
if not os.path.exists(logpath):
os.mkdir(logpath)
if os.path.exists(paramfile):
paramsetting=json.loads(open(paramfile,"r").read())
paramsetting[key]=value
open(paramfile,"w").write(json.dumps(paramsetting))
return True
except:
return False
def loadsetting(self,key:str):
if self.paramsetting is not None:
if key in self.paramsetting:
return self.paramsetting[key]
return None
def writesetting(self, key:str,value:str):
if self.paramsetting is not None:
self.paramsetting[key]=value
self.write_json()
def write_json(self):
if self.paramsetting is not None:
if not os.path.exists(self.logpath):
os.mkdir(self.logpath)
open(self.paramfile, "w").write(json.dumps(self.paramsetting))

View file

@ -5,7 +5,7 @@ from mtkclient.config.payloads import pathconfig
from mtkclient.Library.error import ErrorHandler
from mtkclient.Library.hwcrypto import crypto_setup, hwcrypto
from mtkclient.Library.utils import LogBase, progress, logsetup, find_binary
from mtkclient.Library.settings import writesetting, loadsetting
from mtkclient.Library.settings import hwparam
from mtkclient.Library.seccfg import seccfg
from binascii import hexlify
import hashlib
@ -61,6 +61,7 @@ class xflashext(metaclass=LogBase):
self.send_devctrl = self.xflash.send_devctrl
self.xread = self.xflash.xread
self.status = self.xflash.status
self.hwparam = hwparam(self.mtk.config.meid)
self.da2 = None
self.da2address = None
@ -497,8 +498,8 @@ class xflashext(metaclass=LogBase):
def generate_keys(self):
hwc = self.cryptosetup()
meid = b""
meidv = loadsetting("meid")
socidv = loadsetting("socid")
meidv = self.hwparam.loadsetting("meid")
socidv = self.hwparam.loadsetting("socid")
if meidv is not None:
meid = bytes.fromhex(meidv)
self.info("MEID : " + meidv)
@ -506,7 +507,7 @@ class xflashext(metaclass=LogBase):
try:
if self.config.chipconfig.meid_addr is not None:
meid = b"".join([pack("<I", val) for val in self.readmem(self.config.chipconfig.meid_addr, 4)])
writesetting("meid", hexlify(meid).decode('utf-8'))
self.hwparam.writesetting("meid", hexlify(meid).decode('utf-8'))
self.info("MEID : " + hexlify(meid).decode('utf-8'))
except Exception as err:
pass
@ -517,7 +518,7 @@ class xflashext(metaclass=LogBase):
try:
if self.config.chipconfig.socid_addr is not None:
socid = b"".join([pack("<I", val) for val in self.readmem(self.config.chipconfig.socid_addr, 8)])
writesetting("socid", hexlify(socid).decode('utf-8'))
self.hwparam.writesetting("socid", hexlify(socid).decode('utf-8'))
self.info("SOCID : " + hexlify(socid).decode('utf-8'))
except Exception as err:
pass
@ -538,20 +539,20 @@ class xflashext(metaclass=LogBase):
# self.info("Platkey : " + hexlify(platkey).decode('utf-8'))
if rpmbkey is not None:
self.info("RPMB : " + hexlify(rpmbkey).decode('utf-8'))
writesetting("rpmbkey", hexlify(rpmbkey).decode('utf-8'))
self.hwparam.writesetting("rpmbkey", hexlify(rpmbkey).decode('utf-8'))
if rpmb2key is not None:
self.info("RPMB2 : " + hexlify(rpmb2key).decode('utf-8'))
writesetting("rpmb2key", hexlify(rpmb2key).decode('utf-8'))
self.hwparam.writesetting("rpmb2key", hexlify(rpmb2key).decode('utf-8'))
if fdekey is not None:
self.info("FDE : " + hexlify(fdekey).decode('utf-8'))
writesetting("fdekey", hexlify(fdekey).decode('utf-8'))
self.hwparam.writesetting("fdekey", hexlify(fdekey).decode('utf-8'))
if ikey is not None:
self.info("iTrustee : " + hexlify(ikey).decode('utf-8'))
writesetting("kmkey", hexlify(ikey).decode('utf-8'))
self.hwparam.writesetting("kmkey", hexlify(ikey).decode('utf-8'))
if self.config.chipconfig.prov_addr:
provkey = self.custom_read(self.config.chipconfig.prov_addr, 16)
self.info("PROV : " + hexlify(provkey).decode('utf-8'))
writesetting("provkey", hexlify(provkey).decode('utf-8'))
self.hwparam.writesetting("provkey", hexlify(provkey).decode('utf-8'))
"""
hrid = self.xflash.get_hrid()
if hrid is not None:
@ -567,7 +568,7 @@ class xflashext(metaclass=LogBase):
self.setotp(hwc)
rpmbkey = hwc.aes_hwcrypt(mode="rpmb", data=meid, btype="sej")
self.info("RPMB : " + hexlify(rpmbkey).decode('utf-8'))
writesetting("rpmbkey", hexlify(rpmbkey).decode('utf-8'))
self.hwparam.writesetting("rpmbkey", hexlify(rpmbkey).decode('utf-8'))
else:
self.info("SEJ Mode: No meid found. Are you in brom mode ?")
return True