| OLD | NEW |
| 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
| 4 */ | 4 */ |
| 5 | 5 |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "file_keys.h" | 9 #include "file_keys.h" |
| 10 #include "padding.h" | 10 #include "padding.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 uint32_t digest_len, sig_len; | 25 uint32_t digest_len, sig_len; |
| 26 RSAPublicKey* key = NULL; | 26 RSAPublicKey* key = NULL; |
| 27 ClockTimerState ct; | 27 ClockTimerState ct; |
| 28 char* sha_strings[] = { /* Maps algorithm->SHA algorithm. */ | 28 char* sha_strings[] = { /* Maps algorithm->SHA algorithm. */ |
| 29 "sha1", "sha256", "psha512", /* RSA-1024 */ | 29 "sha1", "sha256", "psha512", /* RSA-1024 */ |
| 30 "sha1", "sha256", "sha512", /* RSA-2048 */ | 30 "sha1", "sha256", "sha512", /* RSA-2048 */ |
| 31 "sha1", "sha256", "sha512", /* RSA-4096 */ | 31 "sha1", "sha256", "sha512", /* RSA-4096 */ |
| 32 "sha1", "sha256", "sha512", /* RSA-8192 */ | 32 "sha1", "sha256", "sha512", /* RSA-8192 */ |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 key_size = siglen_map[algorithm] * sizeof(uint32_t) * 8; /* in bits. */ | 35 key_size = siglen_map[algorithm] * 8; /* in bits. */ |
| 36 /* Get key. */ | 36 /* Get key. */ |
| 37 snprintf(file_name, FILE_NAME_SIZE, "testkeys/key_rsa%d.keyb", key_size); | 37 snprintf(file_name, FILE_NAME_SIZE, "testkeys/key_rsa%d.keyb", key_size); |
| 38 key = RSAPublicKeyFromFile(file_name); | 38 key = RSAPublicKeyFromFile(file_name); |
| 39 if (!key) { | 39 if (!key) { |
| 40 fprintf(stderr, "Couldn't read key from file.\n"); | 40 fprintf(stderr, "Couldn't read key from file.\n"); |
| 41 error_code = 1; | 41 error_code = 1; |
| 42 goto failure; | 42 goto failure; |
| 43 } | 43 } |
| 44 | 44 |
| 45 /* Get expected digest. */ | 45 /* Get expected digest. */ |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 85 |
| 86 int main(int argc, char* argv[]) { | 86 int main(int argc, char* argv[]) { |
| 87 int i; | 87 int i; |
| 88 int error_code = 0; | 88 int error_code = 0; |
| 89 for (i = 0; i < kNumAlgorithms; ++i) { | 89 for (i = 0; i < kNumAlgorithms; ++i) { |
| 90 if(SpeedTestAlgorithm(i)) | 90 if(SpeedTestAlgorithm(i)) |
| 91 error_code = 1; | 91 error_code = 1; |
| 92 } | 92 } |
| 93 return error_code; | 93 return error_code; |
| 94 } | 94 } |
| OLD | NEW |