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

Unified Diff: src/platform/vboot_reference/tests/rsa_verify_benchmark.c

Issue 660228: Make crypto benchmark output compatible with autotest. (Closed)
Patch Set: 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 | « no previous file | src/platform/vboot_reference/tests/sha_benchmark.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/vboot_reference/tests/rsa_verify_benchmark.c
diff --git a/src/platform/vboot_reference/tests/rsa_verify_benchmark.c b/src/platform/vboot_reference/tests/rsa_verify_benchmark.c
index a728426dcffd698436d52956f59f6018fa42bbe6..eaa29965970af707f6a1dfb7d541d16832ab6943 100644
--- a/src/platform/vboot_reference/tests/rsa_verify_benchmark.c
+++ b/src/platform/vboot_reference/tests/rsa_verify_benchmark.c
@@ -15,8 +15,9 @@
#define FILE_NAME_SIZE 128
#define NUM_OPERATIONS 100 /* Number of signature operations to time. */
-void SpeedTestAlgorithm(int algorithm) {
+int SpeedTestAlgorithm(int algorithm) {
int i, key_size;
+ int error_code = 0;
double speed, msecs;
char file_name[FILE_NAME_SIZE];
uint8_t* digest = NULL;
@@ -38,6 +39,7 @@ void SpeedTestAlgorithm(int algorithm) {
key = RSAPublicKeyFromFile(file_name);
if (!key) {
fprintf(stderr, "Couldn't read key from file.\n");
+ error_code = 1;
goto failure;
}
@@ -47,6 +49,7 @@ void SpeedTestAlgorithm(int algorithm) {
digest = BufferFromFile(file_name, &digest_len);
if (!digest) {
fprintf(stderr, "Couldn't read digest file.\n");
+ error_code = 1;
goto failure;
}
@@ -56,6 +59,7 @@ void SpeedTestAlgorithm(int algorithm) {
signature = BufferFromFile(file_name, &sig_len);
if (!signature) {
fprintf(stderr, "Couldn't read signature file.\n");
+ error_code = 1;
goto failure;
}
@@ -68,20 +72,24 @@ void SpeedTestAlgorithm(int algorithm) {
msecs = (float) GetDurationMsecs(&ct) / NUM_OPERATIONS;
speed = 1000.0 / msecs ;
- fprintf(stderr, "rsa%d/%s bits:\tTime taken per verification = %.02f ms,"
+ fprintf(stderr, "# rsa%d/%s:\tTime taken per verification = %.02f ms,"
" Speed = %.02f verifications/s\n", key_size, sha_strings[algorithm],
msecs, speed);
+ fprintf(stdout, "rsa%d/%s:%.02f\n", key_size, sha_strings[algorithm], msecs);
failure:
Free(signature);
Free(digest);
Free(key);
+ return error_code;
}
int main(int argc, char* argv[]) {
int i;
+ int error_code = 0;
for (i = 0; i < kNumAlgorithms; ++i) {
- SpeedTestAlgorithm(i);
+ if(SpeedTestAlgorithm(i))
+ error_code = 1;
}
- return 0;
+ return error_code;
}
« no previous file with comments | « no previous file | src/platform/vboot_reference/tests/sha_benchmark.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698