Fix OpenSSL initialization.

GitOrigin-RevId: 83eb7addf7d0407432fc8d4ba1a4cb6464818cc7
This commit is contained in:
levlam 2020-06-11 01:49:20 +03:00
parent a726450e0b
commit 8e7c6fcda2
2 changed files with 7 additions and 2 deletions

View File

@ -112,13 +112,13 @@ BENCH(SslRand, "ssl_rand_int32") {
std::vector<td::thread> v;
std::atomic<td::uint32> sum{0};
for (int i = 0; i < 3; i++) {
v.push_back(td::thread([&] {
v.emplace_back([&sum, n] {
td::int32 res = 0;
for (int j = 0; j < n; j++) {
res ^= td::Random::secure_int32();
}
sum += res;
}));
});
}
for (auto &x : v) {
x.join();
@ -196,6 +196,8 @@ class Crc64Bench : public td::Benchmark {
};
int main() {
td::init_openssl_threads();
td::bench(Pbkdf2Bench());
td::bench(RandBench());
td::bench(CppRandBench());

View File

@ -7,6 +7,7 @@
#include "td/utils/tests.h"
#include "td/utils/common.h"
#include "td/utils/crypto.h"
#include "td/utils/logging.h"
#include <cstring>
@ -16,6 +17,8 @@
#endif
int main(int argc, char **argv) {
td::init_openssl_threads();
// TODO port OptionsParser to Windows
td::TestsRunner &runner = td::TestsRunner::get_default();
SET_VERBOSITY_LEVEL(VERBOSITY_NAME(ERROR));