Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: src/platform/vboot_reference/utils/verify_data.c

Issue 661353: Vboot Reference: Refactor Code. (Closed)
Patch Set: Review Fixes. Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/platform/vboot_reference/utils/signature_digest.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/utils/verify_data.c
diff --git a/src/platform/vboot_reference/utils/verify_data.c b/src/platform/vboot_reference/utils/verify_data.c
index 8a79d0f32ac0a71d298043addd87482e9eb49452..4b0b785ad7d607213c453a01da41793004e38161 100644
--- a/src/platform/vboot_reference/utils/verify_data.c
+++ b/src/platform/vboot_reference/utils/verify_data.c
@@ -74,23 +74,22 @@ int main(int argc, char* argv[]) {
return 0;
}
/* Length of the RSA Signature/RSA Key */
- sig_len = siglen_map[algorithm];
- if (!(key = RSAPublicKeyFromFile(argv[2])))
- goto failure;
- if (!(signature = read_signature(argv[3], sig_len)))
- goto failure;
- if (!(digest = DigestFile(argv[4], algorithm)))
- goto failure;
- if(RSA_verify(key, signature, sig_len, algorithm, digest)) {
- return_code = 0;
- fprintf(stderr, "Signature Verification "
- COL_GREEN "SUCCEEDED" COL_STOP "\n");
- } else {
- fprintf(stderr, "Signature Verification "
- COL_RED "FAILED" COL_STOP "\n");
+ sig_len = siglen_map[algorithm];
+ if ((key = RSAPublicKeyFromFile(argv[2])) &&
+ (signature = read_signature(argv[3], sig_len)) &&
+ (digest = DigestFile(argv[4], algorithm))) {
+ if (RSAVerify(key, signature, sig_len, algorithm, digest)) {
+ return_code = 0;
+ fprintf(stderr, "Signature Verification "
+ COL_GREEN "SUCCEEDED" COL_STOP "\n");
+ } else {
+ fprintf(stderr, "Signature Verification "
+ COL_RED "FAILED" COL_STOP "\n");
+ }
}
+ else
+ return_code = -1;
-failure:
free(key);
free(signature);
free(digest);
« no previous file with comments | « src/platform/vboot_reference/utils/signature_digest.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698