ADeadTrousers / twrp_device_Unihertz_Atom_LXL

Common device tree for the Unihertz Atom L and XL
Apache License 2.0
7 stars 3 forks source link

Decryption not working on my device #8

Open nanerbs25 opened 7 months ago

nanerbs25 commented 7 months ago

I have this Umidigi A7S, and my friend and i already fixed the issues, and now the last part, Decryption,

Now, my friend and i already imported the libs from stock vendor and the init.recovery.trustkernel.rc file, but for some reason, decryption menu doesnt appear and files are still encrypted, now i do have the tkcore.log file

[2023-11-28 13:01:22] TKCORE_LOG_START
------ beginning of tee
[    0.000000]: <0>INF TKCore:init_teecore:98: teecore: init ctors
[    0.000000]: <0>INF TKCore:init_teecore:102: teecore: init time source
[    0.000000]: <0>INF TKCore:init_teecore:106: teecore: init calls
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002a0
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002a4
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002a8
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002ac
[    0.000000]: <0>DBG TKCore:thread_enable_vfp:1311: Enable VFP in kernel with no context and IRQ disabled
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002b0
[    0.000000]: <0>INF TKCore:spi_init:957: spi_init setup SPI driver
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002b4
[    0.000000]: <0>DBG TKCore:call_initcalls:58: service addr: 0xf00002b8
[    0.000000]: <0>MSG TKCore:start_devapc:228: DEVAPC already inited in ATF
[    0.000000]: <0>INF TKCore:init_teecore:109: teecore inits done
[    0.000000]: <0>INF TKCore:parse_cert:545: projectid: 5389
[    0.000000]: <0>INF TKCore:set_pl_key_id:396: TURKEY ID = 1
[    0.000000]: <0>INF TKCore:init_primary_helper:233: Primary CPU switching to normal world boot
[    0.000000]: <0>MSG TKCore:dump_tee_boot_params:260: tee_boot_params.magic: 0x54534958
[    0.000000]: <0>MSG TKCore:dump_tee_boot_params:261: tee_boot_params.length: 0xc8
[    0.000000]: <0>MSG TKCore:dump_tee_boot_params:262: tee_boot_params.version : 0x20001
[    0.000000]: <0>DBG TKCore:dump_tee_boot_params:265: tee_boot_params.uart_base: 0x11002000
[    0.000000]: <0>DBG TKCore:dump_tee_boot_params:266: tee_boot_params.total_number_spi: 288
[    0.000000]: <0>DBG TKCore:dump_tee_boot_params:267: tee_boot_params.ssiq_number: 0
[    0.000000]: <0>DBG TKCore:dump_tee_boot_params:268: tee_boot_params.flags: 0
[    0.000000]: <0>MSG TKCore:dump_tee_boot_params:273: PROGRAM KEY programed: 1
[    0.000000]: <0>MSG TKCore:dump_tee_boot_params:278: SOC ID programmed: 1
[    0.000000]: <0>MSG TKCore:dump_tee_boot_params:280: RTC Time: 1701176450
[   21.606518]: <1>DBG TKCore:tee_ta_init_static_ta_session:1854:  Run tee_user_init.ta : 4dd88ba0-4c11-5669-dd-c3-26-24-bf-84-a4-e0
[   21.608145]: <1>DBG TKCore:tee_ta_open_session:1990: [TA 4dd88ba0: 0] init session
[   21.609409]: <1>DBG TKCore:invoke_command:417: cmd_id=2820 nParamTypes=0x2
[   21.610386]: <1>ERR TKCore:invoke_command:723: Unsupported command id: 0xb04
[   21.611389]: <1>DBG TKCore:tee_ta_invoke_command:2201:   => Error: ffff0006 of 4
[   21.623280]: <2>DBG TKCore:tee_ta_init_static_ta_session:1854:  Run tee_user_init.ta : 4dd88ba0-4c11-5669-dd-c3-26-24-bf-84-a4-e0
[   21.624913]: <2>DBG TKCore:tee_ta_open_session:1990: [TA 4dd88ba0: 0] init session
[   21.626305]: <2>DBG TKCore:invoke_command:417: cmd_id=0 nParamTypes=0x555
[   21.627345]: <2>ERR TKCore:tee_rpmb_get_dev_info:1004: send rpmb command failed with 0xffff0009
[   21.628571]: <2>ERR TKCore:tee_rpmb_init:1122: Failed to retrieve rpmb device info with 0xffff0009
[   21.629920]: <2>ERR TKCore:init_truststore:132: Init rpmb device failed with 0xffff0009
[   21.631054]: <2>MSG TKCore:truststore_source_init_with_type:124: Init truststore with type=4
[   21.632239]: <2>INF TKCore:init_truststore:274: DEFAULT TRUSTSTORE Setup ... Done
[   21.633440]: <2>INF TKCore:license_init:2009: Check secondary external certificate
[   21.646405]: <2>ERR TKCore:extract_secondary_cert:821: Invalid block size: 0
[   21.647425]: <2>ERR TKCore:init_secondary_cert:921: Failed to extract secondary cert with 0xffff0010
[   21.648709]: <2>INF TKCore:license_init:2017: Check full external certificate
[   21.657569]: <2>ERR TKCore:extract_cert:942: Invalid veriblk size: 0
[   21.658479]: <2>ERR TKCore:init_external_cert:1282: Failed to extract cert: 0xffff0010
[   21.659690]: <2>ERR TKCore:license_init:2019: Invalid external cert: 0xffff0010
[   21.694367]: <3>DBG TKCore:wq_rpc:56: [00000000: 1] sleep <thread_big_lock>
[   21.709196]: <0>INF TKCore:license_expiring:1111: expiring counter: 994
[   21.710141]: <0>INF TKCore:license_init:2044: VERIFY_STATE: 1 TRIAL_STATE: 2
[   21.711144]: <0>DBG TKCore:wq_rpc:56: [00000000: 1] wake <thread_big_lock>
[   21.712394]: <0>DBG TKCore:wq_rpc:56: [00000000: 0] sleep <thread_big_lock>
[   21.713715]: <3>ERR TKCore:tee_ta_rpc_load:1502: load TA failed with 0xffff0007
[   21.714788]: <3>DBG TKCore:tee_dispatch_open_session:141: TA <9ef77781-7bd5-4e39-96-5f-20-f6-f2-11-f4-6b> => Error: ffff0007 of 2
[   21.716497]: <3>DBG TKCore:wq_rpc:56: [00000000: 0] wake <thread_big_lock>
[   21.718368]: <3>DBG TKCore:tee_ta_init_static_ta_session:1854:  Run tee_user_init.ta : 4dd88ba0-4c11-5669-dd-c3-26-24-bf-84-a4-e0
[   21.720098]: <3>DBG TKCore:tee_ta_open_session:1990: [TA 4dd88ba0: 0] init session
[   21.721324]: <3>DBG TKCore:invoke_command:417: cmd_id=2561 nParamTypes=0x67
[   21.728481]: <3>DBG TKCore:elf_load_body:450: Set TLS offset for TA: 0x20e0bc
[   21.729674]: <3>DBG TKCore:tee_ta_load:1172: Loaded TA at 0xf0200000
[   21.730584]: <3>DBG TKCore:tee_ta_load:1173: ELF load address 0x200000
[   21.731527]: <3>DBG TKCore:tee_ta_init_session_with_signed_ta:1884:       dyn TA : 02662e8e-e126-11e5-b8-6d-9a-79-f0-6e-94-78
[   21.733343]: <3>DBG TKCore:tee_ta_open_session:1990: [TA 02662e8e: 0] init session
[   22.726798]: <1>DBG TKCore:elf_load_body:450: Set TLS offset for TA: 0x255c84
[   22.728338]: <1>DBG TKCore:tee_ta_load:1172: Loaded TA at 0xf021b000
[   22.729670]: <1>DBG TKCore:tee_ta_load:1173: ELF load address 0x200000
[   22.730617]: <1>DBG TKCore:tee_ta_init_session_with_signed_ta:1884:       dyn TA : 9ef77781-7bd5-4e39-96-5f-20-f6-f2-11-f4-6b
[   22.732750]: <1>DBG TKCore:tee_ta_open_session:1990: [TA 9ef77781: 0] init session
[   22.734055]: <1>ERR KEYMASTER:judge_rpmb:93: TEE_RPMB_MakeFileSystem return 0xf0100003
[   22.735259]: <1>INF KEYMASTER:key_store_init:147: no RPMB for ksk
[   22.737153]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x19 pSessionContext 0x0 nParamTypes 0x53
[   22.738931]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2095: configure
[   25.302556]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x1b pSessionContext 0x0 nParamTypes 0x603
[   25.304343]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2104: get_hmac_sharing_param
[   25.305991]: <0>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x1c pSessionContext 0x0 nParamTypes 0x653
[   25.307773]: <0>INF KEYMASTER:TA_InvokeCommandEntryPoint:2105: compute_hmac
[   25.310766]: <0>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x10 pSessionContext 0x0 nParamTypes 0x653
[   25.312653]: <0>INF KEYMASTER:TA_InvokeCommandEntryPoint:2086: begin
[   25.314513]: <0>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x1a pSessionContext 0x0 nParamTypes 0x653
[   25.316363]: <0>INF KEYMASTER:TA_InvokeCommandEntryPoint:2096: upgrade_key
[   25.317545]: <0>ERR KEYMASTER:upgrade_key:1691: Can't upgrade key params
[   25.328212]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x10 pSessionContext 0x0 nParamTypes 0x653
[   25.330090]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2086: begin
[   25.331941]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x1a pSessionContext 0x0 nParamTypes 0x653
[   25.333783]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2096: upgrade_key
[   25.334964]: <1>ERR KEYMASTER:upgrade_key:1691: Can't upgrade key params
[   25.345957]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x10 pSessionContext 0x0 nParamTypes 0x653
[   25.347743]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2086: begin
[   25.349662]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2080: TA_InvokeCommandEntryPoint nCommandID 0x1a pSessionContext 0x0 nParamTypes 0x653
[   25.351446]: <1>INF KEYMASTER:TA_InvokeCommandEntryPoint:2096: upgrade_key
[   25.352832]: <0>ERR KEYMASTER:upgrade_key:1691: Can't upgrade key params
>>>>> END OF TKCORE_LOG

my friend and i has no idea about this, and also, this is the only device that i found with the same decryption function, would appreciate your help

P.S ofcourse not a valid log, since mtp doesnt wanna work, and also sorry for offtopic

nanerbs25 commented 7 months ago

also, you can check the twrp tree here thanks

ADeadTrousers commented 7 months ago

You need to activate encryption in your TWRP BoardConfig. https://github.com/ADeadTrousers/twrp_device_Unihertz_Atom_LXL/blob/master/BoardConfigCommon.mk#L106

nanerbs25 commented 7 months ago

oh i forgot, the branch that has decryption is android-10.0_test sorry @ADeadTrousers

nanerbs25 commented 7 months ago

okay, i got more logs, and this time the recovery is stuck at ofox logo here is some logs: Logcat: 12-02 11:24:42.820 274 274 D tkcore-teec: open session to TA UUID 9ef77781 7bd5 4e39 failed 12-02 11:24:42.820 274 274 D tkcore-teec: 12-02 11:24:42.821 274 274 E KeymasterHAL: TrustKernelKeymasterImplementation.cpp:2013: OpenSession failed with 0xffff0000 12-02 11:24:43.395 271 271 W ServiceManagement: Waited one second for android.hardware.keymaster@4.0::IKeymasterDevice/default 12-02 11:24:43.396 271 271 I ServiceManagement: getService: Trying again for android.hardware.keymaster@4.0::IKeymasterDevice/default... this line gets repeated

Dmesg: [ 288.811527] (0)[1:init]init: Received control message 'interface_start' for 'android.hardware.keymaster@4.0::IKeymasterDevice/default' from pid: 258 (/system/bin/hwservicemanager) [ 288.811579] (0)[1:init]init: Could not find 'android.hardware.keymaster@4.0::IKeymasterDevice/default' for ctl.interface_start [ 288.852338] (0)[274:android.hardwar]teed not ready. id=0x1003 [ 288.855129] (0)[274:android.hardwar]ERROR ret=0 (err=0xffff0000, org=2, sessid=0x00000054) [ 288.855145] (0)[274:android.hardwar]ERROR can't create the session (ret=0, err=0xffff0000, org=2) [ 288.932638] (0)[67:tee-log][ 288.852222]: <0>ERR TKCore:tee_ta_rpc_load:1502: load TA failed with 0xffff0000 [ 288.932667] (0)[67:tee-log][ 288.853334]: <0>DBG TKCore:tee_dispatch_open_session:141: TA <9ef77781-7bd5-4e39-96-5f-20-f6-f2-11-f4-6b> => Error: f<...> [ 288.932679] (0)[67:tee-log]fff0000 of 2

also, the branch with decryption is android-10.0_test

would appreciate your help, Thanks.

ADeadTrousers commented 7 months ago

have you checked if the processes "teed", "android.hardware.gatekeeper@1.0-service" and "android.hardware.keymaster@4.0-service.trustkernel" are running? Best to do that is to remove the decryption settings from the twrp build once more and then try to get the three services to run first.

nanerbs25 commented 6 months ago

well, i actually already fixed that, the problem was some .rc files are still not running in root