예제 #1
0
def test_unlock_caam():
    cmd = CmdUnlockCAAM(features=CmdUnlockCAAM.FEATURE_UNLOCK_MID)
    assert cmd.features == 1
    assert cmd.unlock_mid
    assert not cmd.unlock_mfg
    assert not cmd.unlock_rng
    assert "CmdUnlockCAAM" in str(cmd)

    assert cmd.info()

    data = cmd.export()
    cmd2 = CmdUnlock.parse(data)
    assert data == cmd2.export()
    assert cmd == cmd2
예제 #2
0
def test_unlock_snvs():
    """Test Unlock SNVS command"""
    cmd = CmdUnlockSNVS(CmdUnlockSNVS.FEATURE_UNLOCK_LP_SWR | CmdUnlockSNVS.FEATURE_UNLOCK_ZMK_WRITE)
    assert cmd.engine == EnumEngine.SNVS
    assert cmd.size == CmdHeader.SIZE + 4
    assert cmd.unlock_lp_swr
    assert cmd.unlock_zmk_write
    cmd = CmdUnlockSNVS()
    assert not cmd.unlock_lp_swr
    assert not cmd.unlock_zmk_write

    assert cmd.info()

    data = cmd.export()
    cmd2 = CmdUnlock.parse(data)
    assert data == cmd2.export()
    assert cmd == cmd2
예제 #3
0
def test_unlock_ocotp():
    cmd = CmdUnlockOCOTP(
        features=CmdUnlockOCOTP.FEATURE_UNLOCK_FLD_RTN
        | CmdUnlockOCOTP.FEATURE_UNLOCK_JTAG
        | CmdUnlockOCOTP.FEATURE_UNLOCK_SCS,
        uid=0x123456789,
    )

    assert cmd.unlock_fld_rtn
    assert not cmd.unlock_srk_rvk
    assert "CmdUnlockOCOTP" in str(cmd)

    assert "UID" in cmd.info()
    assert "UID" not in CmdUnlockOCOTP().info()

    data = cmd.export()
    cmd2 = CmdUnlock.parse(data)
    assert data == cmd2.export()
    assert cmd == cmd2
예제 #4
0
def test_unlock_cmd_export_parse():
    cmd = CmdUnlock()
    data = cmd.export()
    assert len(data) == 8
    assert cmd == CmdUnlock.parse(data)
예제 #5
0
def test_unlock_parse_others():
    cmd = CmdUnlock(engine=EnumEngine.SRTC)
    assert "CmdUnlock" in str(cmd)
    data = cmd.export()
    cmd2 = CmdUnlock.parse(data)
    assert cmd == cmd2