mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-10 17:41:54 +00:00
Make verify_data return the correct error code.
Review URL: http://codereview.chromium.org/600093
This commit is contained in:
@@ -79,6 +79,7 @@ uint8_t* read_signature(char* input_file, int len) {
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int i, algorithm, sig_len;
|
||||
int return_code = 1; /* Default to error. */
|
||||
uint8_t* digest = NULL;
|
||||
uint8_t* signature = NULL;
|
||||
RSAPublicKey* key = NULL;
|
||||
@@ -107,15 +108,18 @@ int main(int argc, char* argv[]) {
|
||||
goto failure;
|
||||
if (!(digest = DigestFile(argv[4], algorithm)))
|
||||
goto failure;
|
||||
if(RSA_verify(key, signature, sig_len, algorithm, digest))
|
||||
if(RSA_verify(key, signature, sig_len, algorithm, digest)) {
|
||||
return_code = 0;
|
||||
fprintf(stderr, "Signature Verification SUCCEEDED.\n");
|
||||
else
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Signature Verification FAILED!\n");
|
||||
}
|
||||
|
||||
failure:
|
||||
free(key);
|
||||
free(signature);
|
||||
free(digest);
|
||||
|
||||
return 0;
|
||||
return return_code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user