move key loading to verifier code

Add an option to verifier_test to load keys from a file, the way the
recovery does.

Change-Id: Icba0e391164f2c1a9fefeab4b0bcb878e91d17b4
This commit is contained in:
Doug Zongker
2012-11-02 15:09:57 -07:00
parent bf80f49edc
commit 6c249f7ae8
4 changed files with 112 additions and 103 deletions
+8 -3
View File
@@ -129,21 +129,26 @@ class FakeUI : public RecoveryUI {
};
int main(int argc, char **argv) {
if (argc != 2 && argc != 3) {
fprintf(stderr, "Usage: %s [-f4] <package>\n", argv[0]);
if (argc < 2 || argc > 4) {
fprintf(stderr, "Usage: %s [-f4 | -file <keys>] <package>\n", argv[0]);
return 2;
}
RSAPublicKey* key = &test_key;
int num_keys = 1;
++argv;
if (strcmp(argv[0], "-f4") == 0) {
++argv;
key = &test_f4_key;
} else if (strcmp(argv[0], "-file") == 0) {
++argv;
key = load_keys(argv[0], &num_keys);
++argv;
}
ui = new FakeUI();
int result = verify_file(*argv, key, 1);
int result = verify_file(*argv, key, num_keys);
if (result == VERIFY_SUCCESS) {
printf("SUCCESS\n");
return 0;