| 56 | namespace ThirdParty { |
| 57 | |
| 58 | void start() { |
| 59 | Platform::ThirdParty::start(); |
| 60 | |
| 61 | if (!RAND_status()) { // should be always inited in all modern OS |
| 62 | const auto FeedSeed = [](auto value) { |
| 63 | RAND_seed(&value, sizeof(value)); |
| 64 | }; |
| 65 | #ifdef Q_OS_WIN |
| 66 | LARGE_INTEGER li; |
| 67 | QueryPerformanceFrequency(&li); |
| 68 | FeedSeed(li.QuadPart); |
| 69 | QueryPerformanceCounter(&li); |
| 70 | FeedSeed(li.QuadPart); |
| 71 | #elif defined Q_OS_MAC |
| 72 | mach_timebase_info_data_t tb = { 0 }; |
| 73 | mach_timebase_info(&tb); |
| 74 | FeedSeed(tb); |
| 75 | FeedSeed(mach_absolute_time()); |
| 76 | #else |
| 77 | timespec ts = { 0 }; |
| 78 | clock_gettime(CLOCK_MONOTONIC, &ts); |
| 79 | FeedSeed(ts); |
| 80 | #endif |
| 81 | if (!RAND_status()) { |
| 82 | LOG(("MTP Error: Could not init OpenSSL rand, RAND_status() is 0...")); |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | void finish() { |
| 88 | #if OPENSSL_VERSION_NUMBER >= 0x30000000L |
no outgoing calls
no test coverage detected