MD5 verification sanity
We can use switches and enums to make things more understandable
and work with results in a more sensible manner.
PS2: Move file MD5 verification and error handling into
a separate function to reduce code.
PS3: Default to false in Check_Restore_File_MD5 function
Change-Id: Id3ee0bb444cf13be67bb5dec2c43f7c26a86b954
(cherry picked from commit 5c3950716e5c7c6279efd5f3f338d6d22e5215e2)
diff --git a/twrpDigest.hpp b/twrpDigest.hpp
index 7ec25ed..ec4a65f 100644
--- a/twrpDigest.hpp
+++ b/twrpDigest.hpp
@@ -20,6 +20,14 @@
#include "digest/md5.h"
}
+/* verify_md5digest return codes */
+enum {
+ MD5_MATCH_FAIL = -2, // -2: md5 did not match
+ MD5_NOT_FOUND, // -1: no md5 file found
+ MD5_OK, // 0: md5 matches
+ MD5_FILE_UNREADABLE // 1: md5 file unreadable
+};
+
using namespace std;
class twrpDigest