Last active
October 1, 2021 15:04
-
-
Save mauronofrio/af29bad34ad87a1a957d193794f0bf5f to your computer and use it in GitHub Desktop.
Patch to make decryption works on OnePlus fajita
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To Compile Fajita TWRP and make decryption working | |
--- hardware/interfaces/keymaster/4.0/support/Keymaster.cpp | |
+++ hardware/interfaces/keymaster/4.0/support/Keymaster.cpp | |
@@ -111,11 +111,10 @@ | |
CHECK(serviceManager) << "Could not retrieve ServiceManager"; | |
auto km4s = enumerateDevices<Keymaster4>(serviceManager); | |
- auto km3s = enumerateDevices<Keymaster3>(serviceManager); | |
auto result = std::move(km4s); | |
- result.insert(result.end(), std::make_move_iterator(km3s.begin()), | |
- std::make_move_iterator(km3s.end())); | |
+ result.insert(result.end(), std::make_move_iterator(km4s.begin()), | |
+ std::make_move_iterator(km4s.end())); | |
std::sort(result.begin(), result.end(), | |
[](auto& a, auto& b) { return a->halVersion() > b->halVersion(); }); | |
--- bootable/recovery/crypto/ext4crypt/Decrypt.cpp | |
+++ bootable/recovery/crypto/ext4crypt/Decrypt.cpp | |
@@ -1319,11 +1319,11 @@ | |
ret = gk_device->verify(gk_device, user_id, 0, (const uint8_t *)handle.c_str(), st.st_size, | |
(const uint8_t *)Password.c_str(), (uint32_t)Password.size(), &auth_token, &auth_token_len, | |
&should_reenroll); | |
+#endif | |
if (ret !=0) { | |
- printf("failed to verify\n"); | |
+ printf("failed to verify, ret=%d\n", ret); | |
return false; | |
} | |
-#endif | |
char token_hex[(auth_token_len*2)+1]; | |
token_hex[(auth_token_len*2)] = 0; | |
uint32_t i; | |
@@ -1336,7 +1336,7 @@ | |
printf("e4crypt_unlock_user_key returned fail\n"); | |
return false; | |
} | |
- if (!e4crypt_prepare_user_storage(nullptr, user_id, 0, flags)) { | |
+ if (!e4crypt_prepare_user_storage("", user_id, 0, flags)) { | |
printf("failed to e4crypt_prepare_user_storage\n"); | |
return false; | |
} | |
+++ b/minuitwrp/graphics_fbdev.cpp | |
@@ -288,7 +288,7 @@ static GRSurface* fbdev_flip(minui_backend* backend __unused) { | |
- unsigned int idx; | |
+ int idx; | |
unsigned char tmp; | |
unsigned char* ucfb_vaddr = (unsigned char*)gr_draw->data; | |
for (idx = 0 ; idx < (gr_draw->height * gr_draw->row_bytes); | |
idx += 4) { | |
tmp = ucfb_vaddr[idx]; | |
ucfb_vaddr[idx ] = ucfb_vaddr[idx + 2]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, we're trying to build TWRP for the TicWatch Pro 3. It has a Snapdragon Wear 4100, which is a modified version of the Snapdragon 430. While the SoC is 64 bit, the bootloader, firmware and OS are all 32 bit.
We're getting the following error when trying to decrypt the data partition (F2FS, ice file based encryption):
As your patch touches this code, I'm wondering if it solves a similar issue? Do you have any advice on how to fix this sort of thing?