Reduce size of BlindingCacheConcurrency test under TSAN. When building with TSAN, having 2048 threads causes crypto_test to run for more than 20 minutes (when I gave up), vs about two minutes normally. This will remove our TSAN coverage (due to timeouts) unless we trim the size of the test. Change-Id: I381c77a8e9e09c49f3476c38993db40ffdac60d6 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/39346 Commit-Queue: Adam Langley <agl@google.com> Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/crypto/fipsmodule/rsa/rsa_impl.c b/crypto/fipsmodule/rsa/rsa_impl.c index 6fb8ce7..caa2eb4 100644 --- a/crypto/fipsmodule/rsa/rsa_impl.c +++ b/crypto/fipsmodule/rsa/rsa_impl.c
@@ -345,7 +345,12 @@ // MAX_BLINDINGS_PER_RSA defines the maximum number of cached BN_BLINDINGs per // RSA*. Then this limit is exceeded, BN_BLINDING objects will be created and // destroyed as needed. +#if defined(OPNESSL_TSAN) +// Smaller under TSAN so that the edge case can be hit with fewer threads. +#define MAX_BLINDINGS_PER_RSA 2 +#else #define MAX_BLINDINGS_PER_RSA 1024 +#endif // rsa_blinding_get returns a BN_BLINDING to use with |rsa|. It does this by // allocating one of the cached BN_BLINDING objects in |rsa->blindings|. If
diff --git a/crypto/rsa_extra/rsa_test.cc b/crypto/rsa_extra/rsa_test.cc index 4218cdb..0df21c0 100644 --- a/crypto/rsa_extra/rsa_test.cc +++ b/crypto/rsa_extra/rsa_test.cc
@@ -1125,8 +1125,13 @@ RSA_private_key_from_bytes(kKey1, sizeof(kKey1) - 1)); ASSERT_TRUE(rsa); +#if defined(OPENSSL_TSAN) + constexpr size_t kSignaturesPerThread = 10; + constexpr size_t kNumThreads = 10; +#else constexpr size_t kSignaturesPerThread = 100; constexpr size_t kNumThreads = 2048; +#endif const uint8_t kDummyHash[32] = {0}; auto worker = [&] {