From c7daf38f7017a63eb71edbd17be06dc6e740744a Mon Sep 17 00:00:00 2001 From: Gaurav Shah Date: Mon, 1 Mar 2010 20:24:37 -0800 Subject: [PATCH] Fix a typo in the RSA benchmark. Also fix error handling in RSAPublicKeyFromBuf(). BUG=1210 TEST=none Review URL: http://codereview.chromium.org/660310 --- tests/rsa_verify_benchmark.c | 7 ++++--- utils/file_keys.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/rsa_verify_benchmark.c b/tests/rsa_verify_benchmark.c index 29acf75c8a..e72c36fdc8 100644 --- a/tests/rsa_verify_benchmark.c +++ b/tests/rsa_verify_benchmark.c @@ -26,7 +26,7 @@ int SpeedTestAlgorithm(int algorithm) { RSAPublicKey* key = NULL; ClockTimerState ct; char* sha_strings[] = { /* Maps algorithm->SHA algorithm. */ - "sha1", "sha256", "psha512", /* RSA-1024 */ + "sha1", "sha256", "sha512", /* RSA-1024 */ "sha1", "sha256", "sha512", /* RSA-2048 */ "sha1", "sha256", "sha512", /* RSA-4096 */ "sha1", "sha256", "sha512", /* RSA-8192 */ @@ -37,7 +37,7 @@ int SpeedTestAlgorithm(int algorithm) { snprintf(file_name, FILE_NAME_SIZE, "testkeys/key_rsa%d.keyb", key_size); key = RSAPublicKeyFromFile(file_name); if (!key) { - fprintf(stderr, "Couldn't read key from file.\n"); + fprintf(stderr, "Couldn't read RSA Public key from file: %s\n", file_name); error_code = 1; goto failure; } @@ -74,7 +74,8 @@ int SpeedTestAlgorithm(int algorithm) { 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); + fprintf(stdout, "ms_rsa%d_%s:%.02f\n", key_size, sha_strings[algorithm], + msecs); failure: Free(signature); diff --git a/utils/file_keys.c b/utils/file_keys.c index 1aac93f989..98e878ae44 100644 --- a/utils/file_keys.c +++ b/utils/file_keys.c @@ -51,7 +51,7 @@ uint8_t* BufferFromFile(const char* input_file, uint32_t* len) { RSAPublicKey* RSAPublicKeyFromFile(const char* input_file) { uint32_t len; - RSAPublicKey* key; + RSAPublicKey* key = NULL; uint8_t* buf = BufferFromFile(input_file, &len); if (buf) key = RSAPublicKeyFromBuf(buf, len);