diff options
author | David Benjamin <davidben@google.com> | 2021-01-27 16:49:50 -0500 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2021-01-27 22:53:04 +0000 |
commit | ab5edbe7fca2deeccf3f0aa567d1612bf918b2a2 (patch) | |
tree | fae00c9be58032fcc3951b5235a7d57b07e8208f /tool | |
parent | 1c919724d3f887b184f5194a8709c8ae652e4b7f (diff) | |
download | boringssl-ab5edbe7fca2deeccf3f0aa567d1612bf918b2a2.zip boringssl-ab5edbe7fca2deeccf3f0aa567d1612bf918b2a2.tar.gz boringssl-ab5edbe7fca2deeccf3f0aa567d1612bf918b2a2.tar.bz2 |
Benchmark BORINGSSL_self_test in FIPS mode.
Probably worth benchmarking this, given it slows down every process
startup.
Change-Id: I603c79a445203f87e26fa23d9afc4450688f2929
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/45245
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'tool')
-rw-r--r-- | tool/speed.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tool/speed.cc b/tool/speed.cc index 8aa8f85..1b89b42 100644 --- a/tool/speed.cc +++ b/tool/speed.cc @@ -28,6 +28,7 @@ #include <openssl/aes.h> #include <openssl/bn.h> #include <openssl/curve25519.h> +#include <openssl/crypto.h> #include <openssl/digest.h> #include <openssl/err.h> #include <openssl/ec.h> @@ -1221,6 +1222,24 @@ static bool SpeedTrustToken(std::string name, const TRUST_TOKEN_METHOD *method, return true; } +#if defined(BORINGSSL_FIPS) +static bool SpeedSelfTest(const std::string &selected) { + if (!selected.empty() && selected.find("self-test") == std::string::npos) { + return true; + } + + TimeResults results; + if (!TimeFunction(&results, []() -> bool { return BORINGSSL_self_test(); })) { + fprintf(stderr, "BORINGSSL_self_test faileid.\n"); + ERR_print_errors_fp(stderr); + return false; + } + + results.Print("self-test"); + return true; +} +#endif + static const struct argument kArguments[] = { { "-filter", @@ -1367,6 +1386,11 @@ bool Speed(const std::vector<std::string> &args) { TRUST_TOKEN_experiment_v2_pmb(), 10, selected)) { return false; } +#if defined(BORINGSSL_FIPS) + if (!SpeedSelfTest(selected)) { + return false; + } +#endif if (g_print_json) { puts("\n]"); } |