@@ -234,20 +234,8 @@ try_update_binary(const char *path, ZipArchive *zip) {
234
234
}
235
235
236
236
static int
237
- handle_update_package (const char * path , ZipArchive * zip ,
238
- const RSAPublicKey * keys , int numKeys )
237
+ handle_update_package (const char * path , ZipArchive * zip )
239
238
{
240
- // Give verification half the progress bar...
241
- ui_print ("Verifying update package...\n" );
242
- ui_show_progress (
243
- VERIFICATION_PROGRESS_FRACTION ,
244
- VERIFICATION_PROGRESS_TIME );
245
-
246
- if (!verify_jar_signature (zip , keys , numKeys )) {
247
- LOGE ("Verification failed\n" );
248
- return INSTALL_CORRUPT ;
249
- }
250
-
251
239
// Update should take the rest of the progress bar.
252
240
ui_print ("Installing update...\n" );
253
241
@@ -360,19 +348,33 @@ install_package(const char *root_path)
360
348
}
361
349
LOGI ("%d key(s) loaded from %s\n" , numKeys , PUBLIC_KEYS_FILE );
362
350
351
+ // Give verification half the progress bar...
352
+ ui_print ("Verifying update package...\n" );
353
+ ui_show_progress (
354
+ VERIFICATION_PROGRESS_FRACTION ,
355
+ VERIFICATION_PROGRESS_TIME );
356
+
357
+ int err ;
358
+ err = verify_file (path , loadedKeys , numKeys );
359
+ free (loadedKeys );
360
+ LOGI ("verify_file returned %d\n" , err );
361
+ if (err != VERIFY_SUCCESS ) {
362
+ LOGE ("signature verification failed\n" );
363
+ return INSTALL_CORRUPT ;
364
+ }
365
+
363
366
/* Try to open the package.
364
367
*/
365
368
ZipArchive zip ;
366
- int err = mzOpenZipArchive (path , & zip );
369
+ err = mzOpenZipArchive (path , & zip );
367
370
if (err != 0 ) {
368
371
LOGE ("Can't open %s\n(%s)\n" , path , err != -1 ? strerror (err ) : "bad" );
369
372
return INSTALL_CORRUPT ;
370
373
}
371
374
372
375
/* Verify and install the contents of the package.
373
376
*/
374
- int status = handle_update_package (path , & zip , loadedKeys , numKeys );
377
+ int status = handle_update_package (path , & zip );
375
378
mzCloseZipArchive (& zip );
376
- free (loadedKeys );
377
379
return status ;
378
380
}
0 commit comments