Skip to content

Commit

Permalink
cryptomb: avoid speed test on arm
Browse files Browse the repository at this point in the history
Signed-off-by: Xie Zhihao <[email protected]>
  • Loading branch information
zhxie committed Mar 29, 2024
1 parent ac72768 commit 068f576
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions contrib/cryptomb/private_key_providers/test/speed_test.cc
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
#include "source/common/common/assert.h"

#include "benchmark/benchmark.h"
#include "crypto_mb/ec_nistp256.h"
#include "crypto_mb/rsa.h"
#include "crypto_mb/x25519.h"
#include "gtest/gtest.h"
#include "openssl/curve25519.h"
#include "openssl/evp.h"
#include "openssl/pem.h"
#include "openssl/rand.h"
#include "openssl/ssl.h"

#ifndef IPP_CRYPTO_DISABLED
#include "crypto_mb/ec_nistp256.h"
#include "crypto_mb/rsa.h"
#include "crypto_mb/x25519.h"
#endif

namespace Envoy {

constexpr absl::string_view RsaKey = R"EOF(
Expand Down Expand Up @@ -124,6 +127,7 @@ static void BM_ECDSA_Signing(benchmark::State& state) {
}
BENCHMARK(BM_ECDSA_Signing);

#ifndef IPP_CRYPTO_DISABLED
// NOLINTNEXTLINE(readability-identifier-naming)
static void BM_ECDSA_Signing_CryptoMB(benchmark::State& state) {
bssl::UniquePtr<EVP_PKEY> pkey = makeEcdsaKey();
Expand Down Expand Up @@ -200,6 +204,7 @@ static void BM_ECDSA_Signing_CryptoMB(benchmark::State& state) {
benchmark::Counter(state.iterations() * 8, benchmark::Counter::kIsRate);
}
BENCHMARK(BM_ECDSA_Signing_CryptoMB);
#endif

// NOLINTNEXTLINE(readability-identifier-naming)
static void BM_RSA_Signing(benchmark::State& state) {
Expand All @@ -224,6 +229,7 @@ static void BM_RSA_Signing(benchmark::State& state) {
}
BENCHMARK(BM_RSA_Signing);

#ifndef IPP_CRYPTO_DISABLED
// NOLINTNEXTLINE(readability-identifier-naming)
static void BM_RSA_Signing_CryptoMB(benchmark::State& state) {
bssl::UniquePtr<EVP_PKEY> pkey = makeRsaKey();
Expand Down Expand Up @@ -282,6 +288,7 @@ static void BM_RSA_Signing_CryptoMB(benchmark::State& state) {
benchmark::Counter(state.iterations() * 8, benchmark::Counter::kIsRate);
}
BENCHMARK(BM_RSA_Signing_CryptoMB);
#endif

const std::vector<uint8_t>& x25519Key() {
CONSTRUCT_ON_FIRST_USE(std::vector<uint8_t>,
Expand Down Expand Up @@ -357,6 +364,7 @@ static void BM_X25519_Computing(benchmark::State& state) {
}
BENCHMARK(BM_X25519_Computing);

#ifndef IPP_CRYPTO_DISABLED
// NOLINTNEXTLINE(readability-identifier-naming)
static void BM_X25519_Computing_CryptoMB(benchmark::State& state) {
uint8_t ciphertext[8][32];
Expand Down Expand Up @@ -403,6 +411,7 @@ static void BM_X25519_Computing_CryptoMB(benchmark::State& state) {
benchmark::Counter(state.iterations() * 8, benchmark::Counter::kIsRate);
}
BENCHMARK(BM_X25519_Computing_CryptoMB);
#endif

// NOLINTNEXTLINE(readability-identifier-naming)
static void BM_P256_Computing(benchmark::State& state) {
Expand Down Expand Up @@ -434,6 +443,7 @@ static void BM_P256_Computing(benchmark::State& state) {
}
BENCHMARK(BM_P256_Computing);

#ifndef IPP_CRYPTO_DISABLED
// NOLINTNEXTLINE(readability-identifier-naming)
static void BM_P256_Computing_CryptoMB(benchmark::State& state) {
const EC_GROUP* group = EC_group_p256();
Expand Down Expand Up @@ -508,5 +518,6 @@ static void BM_P256_Computing_CryptoMB(benchmark::State& state) {
benchmark::Counter(state.iterations() * 8, benchmark::Counter::kIsRate);
}
BENCHMARK(BM_P256_Computing_CryptoMB);
#endif

} // namespace Envoy

0 comments on commit 068f576

Please sign in to comment.