summaryrefslogtreecommitdiffstats
path: root/verifier.h
diff options
context:
space:
mode:
Diffstat (limited to 'verifier.h')
-rw-r--r--verifier.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/verifier.h b/verifier.h
index db068639a..665e5a9b1 100644
--- a/verifier.h
+++ b/verifier.h
@@ -17,6 +17,7 @@
#ifndef _RECOVERY_VERIFIER_H
#define _RECOVERY_VERIFIER_H
+#include <functional>
#include <memory>
#include <vector>
@@ -26,18 +27,18 @@
#define ASSUMED_UPDATE_BINARY_NAME "META-INF/com/google/android/update-binary"
-enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT };
+enum { INSTALL_SUCCESS, INSTALL_ERROR, INSTALL_CORRUPT, INSTALL_RETRY };
-static const float VERIFICATION_PROGRESS_FRACTION = 0.25;
+static const float VERIFICATION_PROGRESS_FRAC = 0.25;
struct RSADeleter {
- void operator()(RSA* rsa) {
+ void operator()(RSA* rsa) const {
RSA_free(rsa);
}
};
struct ECKEYDeleter {
- void operator()(EC_KEY* ec_key) {
+ void operator()(EC_KEY* ec_key) const {
EC_KEY_free(ec_key);
}
};
@@ -64,12 +65,14 @@ struct Certificate {
std::unique_ptr<EC_KEY, ECKEYDeleter> ec;
};
-/* addr and length define a an update package file that has been
- * loaded (or mmap'ed, or whatever) into memory. Verify that the file
- * is signed and the signature matches one of the given keys. Return
- * one of the constants below.
+/*
+ * 'addr' and 'length' define an update package file that has been loaded (or mmap'ed, or
+ * whatever) into memory. Verifies that the file is signed and the signature matches one of the
+ * given keys. It optionally accepts a callback function for posting the progress to. Returns one
+ * of the constants of VERIFY_SUCCESS and VERIFY_FAILURE.
*/
-int verify_file(unsigned char* addr, size_t length);
+int verify_file(const unsigned char* addr, size_t length, const std::vector<Certificate>& keys,
+ const std::function<void(float)>& set_progress = nullptr);
bool load_keys(const char* filename, std::vector<Certificate>& certs);