diff options
author | Jeffrey Carlyle <jcarlyle@google.com> | 2021-05-20 17:02:32 -0700 |
---|---|---|
committer | Jeffrey Carlyle <jcarlyle@google.com> | 2021-06-25 15:51:31 -0700 |
commit | 2700a199adb602b13bf3850547f159c520aba771 (patch) | |
tree | 84cbe4548aeb26bf48d6b6e66944064bd3baacda /recovery | |
parent | 895b049bfe3a098019137ec931a51627596f9f53 (diff) | |
download | pixel-2700a199adb602b13bf3850547f159c520aba771.tar.gz |
recovery: enable support for device-specific WipeSe implementation
Bug: 182508814
Test: data wipe issued through recovery mode UI, verified keys were deleted
Signed-off-by: Jeffrey Carlyle <jcarlyle@google.com>
Change-Id: I943d97b2616a1e43760ec54baa7f8416608cc579
Diffstat (limited to 'recovery')
-rw-r--r-- | recovery/recovery_ui.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/recovery/recovery_ui.cpp b/recovery/recovery_ui.cpp index 34387320..8149da73 100644 --- a/recovery/recovery_ui.cpp +++ b/recovery/recovery_ui.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <dlfcn.h> #include <stdint.h> #include <string.h> @@ -64,6 +65,18 @@ bool WipeTitanM() { return true; } +/** Call device-specifc WipeKeys function, if any. */ +bool WipeKeysHook(::RecoveryUI *const ui) { + bool *(*WipeKeysFunc)(::RecoveryUI *const); + reinterpret_cast<void *&>(WipeKeysFunc) = dlsym(RTLD_DEFAULT, "WipeKeys"); + if (WipeKeysFunc == nullptr) { + LOG(INFO) << "No WipeKeys implementation"; + return true; + } + + return (*WipeKeysFunc)(ui); +} + // Wipes the provisioned flag as part of data wipe. bool WipeProvisionedFlag() { // Must be consistent with the one in init.hardware.rc (10-byte `theme-dark`). @@ -111,6 +124,10 @@ class PixelDevice : public ::Device { } } + if (!WipeKeysHook(ui)) { + totalSuccess = false; + } + if (!WipeProvisionedFlag()) { totalSuccess = false; } |