TeamWin / android_bootable_recovery

1.3k stars 408 forks source link

FBE decryption doesn't work #305

Closed kayrus closed 1 year ago

kayrus commented 1 year ago

Device codename: xiaomi-mi8937 TWRP version: twrp-3.7.0_12-0-mi8937

WHAT STEPS WILL REPRODUCE THE PROBLEM?

Enable the file-based encryption in Android 11 with screen lock password, try to decrypt the FS in TWRP

WHAT IS THE EXPECTED RESULT?

The screen lock password should be valid.

WHAT HAPPENS INSTEAD?

The password is not accepted, while it's accepted in screen unlock in a regular Android 11 system.

ADDITIONAL INFORMATION

Here's the decryption log I get in TWRP:

# tail /tmp/recovery
I:Set page: 'trydecrypt'
I:operation_start: 'Decrypt'
Attempting to decrypt FBE for user 0...
Attempting to decrypt user
Handle is 'xxx'
password type: password
Using synthetic password method
Attempting to decrypt user's synthetic password
fscrypt::GetPassword_Token
Is_Weaver
using secdis to decrypt spblob
Attempting to unwrap synthetic password blob
spblob v2 / v3
key not found
failed to unwrapSyntheticPasswordBlob
Free_Return
Failed to decrypt user 0
I:Set page: 'decrypt'
I:operation_end - status=1

cc @me-cafebabe

kayrus commented 1 year ago

UPD: I noticed the difference between the recovery log and system log:

recovery has: recovery: Installed de key for user 0 entry and it runs init.svc.keystore2

system has: vold : Installed ce key for user 0 entry and it runs init.svc.keystore

maybe this info can help.

kayrus commented 1 year ago

When the FS was encrypted on the LineageOS 20, the TWRP successfully decrypts the FS