diff options
Diffstat (limited to 'verifier.h')
-rw-r--r-- | verifier.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/verifier.h b/verifier.h index 58083fe14..6fa8f2b0a 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> @@ -25,13 +26,13 @@ #include <openssl/sha.h> 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); } }; @@ -58,13 +59,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, - const std::vector<Certificate>& keys); +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); |