Loading verifier_test.cpp +36 −10 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <stdarg.h> #include "verifier.h" #include "ui.h" // This is build/target/product/security/testkey.x509.pem after being // dumped out by dumpkey.jar. Loading Loading @@ -58,7 +59,22 @@ RSAPublicKey test_key = 367251975, 810756730, -1941182952, 1175080310 } }; void ui_print(const char* fmt, ...) { RecoveryUI* ui = NULL; // verifier expects to find a UI object; we provide one that does // nothing but print. class FakeUI : public RecoveryUI { void Init() { } void SetBackground(Icon icon) { } void SetProgressType(ProgressType determinate) { } void ShowProgress(float portion, float seconds) { } void SetProgress(float fraction) { } void ShowText(bool visible) { } bool IsTextVisible() { return false; } bool WasTextEverVisible() { return false; } void Print(const char* fmt, ...) { char buf[256]; va_list ap; va_start(ap, fmt); Loading @@ -68,8 +84,16 @@ void ui_print(const char* fmt, ...) { fputs(buf, stderr); } void ui_set_progress(float fraction) { } int WaitKey() { return 0; } bool IsKeyPressed(int key) { return false; } void FlushKeys() { } KeyAction CheckKey(int key) { return ENQUEUE; } void StartMenu(const char* const * headers, const char* const * items, int initial_selection) { } int SelectMenu(int sel) { return 0; } void EndMenu() { } }; int main(int argc, char **argv) { if (argc != 2) { Loading @@ -77,6 +101,8 @@ int main(int argc, char **argv) { return 2; } ui = new FakeUI(); int result = verify_file(argv[1], &test_key, 1); if (result == VERIFY_SUCCESS) { printf("SUCCESS\n"); Loading Loading
verifier_test.cpp +36 −10 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <stdarg.h> #include "verifier.h" #include "ui.h" // This is build/target/product/security/testkey.x509.pem after being // dumped out by dumpkey.jar. Loading Loading @@ -58,7 +59,22 @@ RSAPublicKey test_key = 367251975, 810756730, -1941182952, 1175080310 } }; void ui_print(const char* fmt, ...) { RecoveryUI* ui = NULL; // verifier expects to find a UI object; we provide one that does // nothing but print. class FakeUI : public RecoveryUI { void Init() { } void SetBackground(Icon icon) { } void SetProgressType(ProgressType determinate) { } void ShowProgress(float portion, float seconds) { } void SetProgress(float fraction) { } void ShowText(bool visible) { } bool IsTextVisible() { return false; } bool WasTextEverVisible() { return false; } void Print(const char* fmt, ...) { char buf[256]; va_list ap; va_start(ap, fmt); Loading @@ -68,8 +84,16 @@ void ui_print(const char* fmt, ...) { fputs(buf, stderr); } void ui_set_progress(float fraction) { } int WaitKey() { return 0; } bool IsKeyPressed(int key) { return false; } void FlushKeys() { } KeyAction CheckKey(int key) { return ENQUEUE; } void StartMenu(const char* const * headers, const char* const * items, int initial_selection) { } int SelectMenu(int sel) { return 0; } void EndMenu() { } }; int main(int argc, char **argv) { if (argc != 2) { Loading @@ -77,6 +101,8 @@ int main(int argc, char **argv) { return 2; } ui = new FakeUI(); int result = verify_file(argv[1], &test_key, 1); if (result == VERIFY_SUCCESS) { printf("SUCCESS\n"); Loading