summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-10-23 04:56:00 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-10-23 04:56:00 +0200
commit10c9282e0797b7edbe324d27f8fb6d48d134ab00 (patch)
tree71581affea0fcb88009058fe67263214a6eda5c5
parentMerge "Fix instrumentation_for to refer to name of module" am: 24ead5672b (diff)
parentMerge "Recovery now expects public keys in zipfile" (diff)
downloadandroid_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.tar
android_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.tar.gz
android_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.tar.bz2
android_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.tar.lz
android_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.tar.xz
android_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.tar.zst
android_bootable_recovery-10c9282e0797b7edbe324d27f8fb6d48d134ab00.zip
-rw-r--r--install.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/install.cpp b/install.cpp
index e379ef307..42d264157 100644
--- a/install.cpp
+++ b/install.cpp
@@ -695,18 +695,18 @@ int install_package(const std::string& path, bool* wipe_cache, bool needs_mount,
}
bool verify_package(const unsigned char* package_data, size_t package_size) {
- static constexpr const char* PUBLIC_KEYS_FILE = "/res/keys";
- std::vector<Certificate> loadedKeys;
- if (!load_keys(PUBLIC_KEYS_FILE, loadedKeys)) {
+ static constexpr const char* CERTIFICATE_ZIP_FILE = "/system/etc/security/otacerts.zip";
+ std::vector<Certificate> loaded_keys = LoadKeysFromZipfile(CERTIFICATE_ZIP_FILE);
+ if (loaded_keys.empty()) {
LOG(ERROR) << "Failed to load keys";
return false;
}
- LOG(INFO) << loadedKeys.size() << " key(s) loaded from " << PUBLIC_KEYS_FILE;
+ LOG(INFO) << loaded_keys.size() << " key(s) loaded from " << CERTIFICATE_ZIP_FILE;
// Verify package.
ui->Print("Verifying update package...\n");
auto t0 = std::chrono::system_clock::now();
- int err = verify_file(package_data, package_size, loadedKeys,
+ int err = verify_file(package_data, package_size, loaded_keys,
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);