From cdcfee48b9720d589a4e2cd43725e8229ca336f9 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Wed, 27 Feb 2013 21:11:26 -0500 Subject: use md5.c for computation of md5sums create a framework for computing digests and reading digests in TWRP add space for backwards compatibility with bb md5sum Change-Id: Ia18e3f430eed5eba22e5052d39b9b8d88ecd4536 --- twinstall.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'twinstall.cpp') diff --git a/twinstall.cpp b/twinstall.cpp index 40d715564..e1133c01e 100644 --- a/twinstall.cpp +++ b/twinstall.cpp @@ -39,6 +39,7 @@ #include "variables.h" #include "data.hpp" #include "partitions.hpp" +#include "twrpDigest.hpp" #include "twrp-functions.hpp" extern RecoveryUI* ui; @@ -261,7 +262,8 @@ exit: extern "C" int TWinstall_zip(const char* path, int* wipe_cache) { int err, zip_verify, md5_return; - + twrpDigest md5sum; + string strpath = path; ui_print("Installing '%s'...\n", path); if (!PartitionManager.Mount_By_Path(path, 0)) { @@ -270,14 +272,15 @@ extern "C" int TWinstall_zip(const char* path, int* wipe_cache) { } ui_print("Checking for MD5 file...\n"); - md5_return = TWFunc::Check_MD5(path); - if (md5_return == 0) { + md5sum.setfn(strpath); + md5_return = md5sum.verify_md5digest(); + if (md5_return == -2) { // MD5 did not match. LOGE("Zip MD5 does not match.\nUnable to install zip.\n"); return INSTALL_CORRUPT; } else if (md5_return == -1) { ui_print("Skipping MD5 check: no MD5 file found.\n"); - } else if (md5_return == 1) + } else if (md5_return == 0) ui_print("Zip MD5 matched.\n"); // MD5 found and matched. DataManager::GetValue(TW_SIGNED_ZIP_VERIFY_VAR, zip_verify); -- cgit v1.2.3