summaryrefslogtreecommitdiffstats
path: root/install.c
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2009-11-13 03:45:15 +0100
committerJean-Baptiste Queru <jbq@google.com>2009-11-13 03:45:15 +0100
commita43c44f31f873d7e39d3c2872f0b9531b1584f11 (patch)
tree3089f7cc4eace77d713d6a756305ee2335238f99 /install.c
parentonly build flash_image for eng (diff)
downloadandroid_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.tar
android_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.tar.gz
android_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.tar.bz2
android_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.tar.lz
android_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.tar.xz
android_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.tar.zst
android_bootable_recovery-a43c44f31f873d7e39d3c2872f0b9531b1584f11.zip
Diffstat (limited to 'install.c')
-rw-r--r--install.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/install.c b/install.c
index 2c557eacb..7710cecf2 100644
--- a/install.c
+++ b/install.c
@@ -234,20 +234,8 @@ try_update_binary(const char *path, ZipArchive *zip) {
}
static int
-handle_update_package(const char *path, ZipArchive *zip,
- const RSAPublicKey *keys, int numKeys)
+handle_update_package(const char *path, ZipArchive *zip)
{
- // Give verification half the progress bar...
- ui_print("Verifying update package...\n");
- ui_show_progress(
- VERIFICATION_PROGRESS_FRACTION,
- VERIFICATION_PROGRESS_TIME);
-
- if (!verify_jar_signature(zip, keys, numKeys)) {
- LOGE("Verification failed\n");
- return INSTALL_CORRUPT;
- }
-
// Update should take the rest of the progress bar.
ui_print("Installing update...\n");
@@ -360,10 +348,25 @@ install_package(const char *root_path)
}
LOGI("%d key(s) loaded from %s\n", numKeys, PUBLIC_KEYS_FILE);
+ // Give verification half the progress bar...
+ ui_print("Verifying update package...\n");
+ ui_show_progress(
+ VERIFICATION_PROGRESS_FRACTION,
+ VERIFICATION_PROGRESS_TIME);
+
+ int err;
+ err = verify_file(path, loadedKeys, numKeys);
+ free(loadedKeys);
+ LOGI("verify_file returned %d\n", err);
+ if (err != VERIFY_SUCCESS) {
+ LOGE("signature verification failed\n");
+ return INSTALL_CORRUPT;
+ }
+
/* Try to open the package.
*/
ZipArchive zip;
- int err = mzOpenZipArchive(path, &zip);
+ err = mzOpenZipArchive(path, &zip);
if (err != 0) {
LOGE("Can't open %s\n(%s)\n", path, err != -1 ? strerror(err) : "bad");
return INSTALL_CORRUPT;
@@ -371,8 +374,7 @@ install_package(const char *root_path)
/* Verify and install the contents of the package.
*/
- int status = handle_update_package(path, &zip, loadedKeys, numKeys);
+ int status = handle_update_package(path, &zip);
mzCloseZipArchive(&zip);
- free(loadedKeys);
return status;
}