summaryrefslogtreecommitdiffstats
path: root/verifier.h
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-09-08 13:50:54 +0200
committerEthan Yonker <dees_troy@teamw.in>2017-09-08 14:14:59 +0200
commit8373cfe28cf1b5ad758faa1d502e21787c3665e4 (patch)
tree2f567c52cd6f89e1052481497d236b58d230b7e2 /verifier.h
parentDO NOT MERGE Android 8.0 stuff (diff)
parentrelease-request-f4ecf242-5d1c-45e0-8c7c-ede48d1a9e82-for-git_oc-release-4111650 snap-temp-L02200000075283731 (diff)
downloadandroid_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.tar
android_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.tar.gz
android_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.tar.bz2
android_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.tar.lz
android_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.tar.xz
android_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.tar.zst
android_bootable_recovery-8373cfe28cf1b5ad758faa1d502e21787c3665e4.zip
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);