summaryrefslogtreecommitdiffstats
path: root/src/tool/speed.cc
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2015-10-02 16:09:15 -0700
committerKenny Root <kroot@google.com>2015-10-02 16:09:49 -0700
commitfe7305364c3369f9222a61646c5c9842eae9bceb (patch)
tree360ada970b7bb1046ae069d253ba24d9622eb3ad /src/tool/speed.cc
parent691ef9d0ff0ece39ffd6a58960a7cd195ef584ae (diff)
parentb452bce3bf2034466cee6206ebf3994409468ee4 (diff)
downloadexternal_boringssl-fe7305364c3369f9222a61646c5c9842eae9bceb.zip
external_boringssl-fe7305364c3369f9222a61646c5c9842eae9bceb.tar.gz
external_boringssl-fe7305364c3369f9222a61646c5c9842eae9bceb.tar.bz2
Merge mnc-dr-dev-plus-aosp into mnc-ub-dev
This pulls in the latest version of BoringSSL. Change-Id: I0ab5c73d60f41a696c9a828fac87670aaca10dec
Diffstat (limited to 'src/tool/speed.cc')
-rw-r--r--src/tool/speed.cc33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/tool/speed.cc b/src/tool/speed.cc
index ab17c2f..307b0b9 100644
--- a/src/tool/speed.cc
+++ b/src/tool/speed.cc
@@ -36,16 +36,9 @@
#endif
#include "../crypto/test/scoped_types.h"
+#include "internal.h"
-extern "C" {
-// These values are DER encoded, RSA private keys.
-extern const uint8_t kDERRSAPrivate2048[];
-extern size_t kDERRSAPrivate2048Len;
-extern const uint8_t kDERRSAPrivate4096[];
-extern size_t kDERRSAPrivate4096Len;
-}
-
// TimeResults represents the results of benchmarking a function.
struct TimeResults {
// num_calls is the number of function calls done in the time period.
@@ -414,9 +407,9 @@ bool Speed(const std::vector<std::string> &args) {
selected = args[0];
}
- RSA *key = NULL;
- const uint8_t *inp = kDERRSAPrivate2048;
- if (NULL == d2i_RSAPrivateKey(&key, &inp, kDERRSAPrivate2048Len)) {
+ RSA *key = RSA_private_key_from_bytes(kDERRSAPrivate2048,
+ kDERRSAPrivate2048Len);
+ if (key == NULL) {
fprintf(stderr, "Failed to parse RSA key.\n");
ERR_print_errors_fp(stderr);
return false;
@@ -427,10 +420,22 @@ bool Speed(const std::vector<std::string> &args) {
}
RSA_free(key);
- key = NULL;
+ key = RSA_private_key_from_bytes(kDERRSAPrivate3Prime2048,
+ kDERRSAPrivate3Prime2048Len);
+ if (key == NULL) {
+ fprintf(stderr, "Failed to parse RSA key.\n");
+ ERR_print_errors_fp(stderr);
+ return false;
+ }
- inp = kDERRSAPrivate4096;
- if (NULL == d2i_RSAPrivateKey(&key, &inp, kDERRSAPrivate4096Len)) {
+ if (!SpeedRSA("RSA 2048 (3 prime, e=3)", key, selected)) {
+ return false;
+ }
+
+ RSA_free(key);
+ key = RSA_private_key_from_bytes(kDERRSAPrivate4096,
+ kDERRSAPrivate4096Len);
+ if (key == NULL) {
fprintf(stderr, "Failed to parse 4096-bit RSA key.\n");
ERR_print_errors_fp(stderr);
return 1;