summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-03-17 01:37:38 +0100
committerTao Bao <tbao@google.com>2017-03-17 22:14:07 +0100
commit7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2 (patch)
tree50e5c63d245b942bca1efac8e96600a456e73d2d /install.cpp
parentMerge "updater: Remove some obsoleted functions for file-based OTA." am: 342717d148 am: 000f364c19 (diff)
downloadandroid_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.tar
android_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.tar.gz
android_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.tar.bz2
android_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.tar.lz
android_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.tar.xz
android_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.tar.zst
android_bootable_recovery-7b22c92ac1265f439f8e2623c4a1d6b45bbb05f2.zip
Diffstat (limited to '')
-rw-r--r--install.cpp40
1 files changed, 21 insertions, 19 deletions
diff --git a/install.cpp b/install.cpp
index f51bbf05c..68d3f54bc 100644
--- a/install.cpp
+++ b/install.cpp
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <chrono>
+#include <functional>
#include <limits>
#include <map>
#include <string>
@@ -578,23 +579,24 @@ install_package(const char* path, bool* wipe_cache, const char* install_file,
}
bool verify_package(const unsigned char* package_data, size_t package_size) {
- std::vector<Certificate> loadedKeys;
- if (!load_keys(PUBLIC_KEYS_FILE, loadedKeys)) {
- LOG(ERROR) << "Failed to load keys";
- return false;
- }
- LOG(INFO) << loadedKeys.size() << " key(s) loaded from " << PUBLIC_KEYS_FILE;
-
- // Verify package.
- ui->Print("Verifying update package...\n");
- auto t0 = std::chrono::system_clock::now();
- int err = verify_file(const_cast<unsigned char*>(package_data), package_size, loadedKeys);
- std::chrono::duration<double> duration = std::chrono::system_clock::now() - t0;
- ui->Print("Update package verification took %.1f s (result %d).\n", duration.count(), err);
- if (err != VERIFY_SUCCESS) {
- LOG(ERROR) << "Signature verification failed";
- LOG(ERROR) << "error: " << kZipVerificationFailure;
- return false;
- }
- return true;
+ std::vector<Certificate> loadedKeys;
+ if (!load_keys(PUBLIC_KEYS_FILE, loadedKeys)) {
+ LOG(ERROR) << "Failed to load keys";
+ return false;
+ }
+ LOG(INFO) << loadedKeys.size() << " key(s) loaded from " << PUBLIC_KEYS_FILE;
+
+ // Verify package.
+ ui->Print("Verifying update package...\n");
+ auto t0 = std::chrono::system_clock::now();
+ int err = verify_file(const_cast<unsigned char*>(package_data), package_size, loadedKeys,
+ std::bind(&RecoveryUI::SetProgress, ui, std::placeholders::_1));
+ std::chrono::duration<double> duration = std::chrono::system_clock::now() - t0;
+ ui->Print("Update package verification took %.1f s (result %d).\n", duration.count(), err);
+ if (err != VERIFY_SUCCESS) {
+ LOG(ERROR) << "Signature verification failed";
+ LOG(ERROR) << "error: " << kZipVerificationFailure;
+ return false;
+ }
+ return true;
}