Skip to content

Commit cc3b528

Browse files
committed
gui: remove OpenSSL PRNG seeding (Windows, Qt only)
This removes the code introduced in [dashpay#4399](bitcoin#4399) that attempts to add additional entroy to the OpenSSL PRNG using Windows messages. Note that this is specific to bitcoin-qt running on Windows. ``` RAND_event() collects the entropy from Windows events such as mouse movements and other user interaction. It should be called with the iMsg, wParam and lParam arguments of all messages sent to the window procedure. It will estimate the entropy contained in the event message (if any), and add it to the PRNG. The program can then process the messages as usual. ``` Besides BIP70, this is the last place we are directly using OpenSSL in the GUI code. All other OpenSSL usage is in random.cpp. Note that we are still also doing Windows specific entropy gathering in multiple other places. Such as [RandAddSeedPerfmon](https://github.com/bitcoin/bitcoin/blob/master/src/random.cpp#L268) and [RAND_screen()](https://github.com/bitcoin/bitcoin/blob/master/src/random.cpp#L600). Also note that if RAND_event returns 0 (PRNG has NOT been seeded with enough data), we're just logging a message and continuing on, which seems less than ideal.
1 parent 029c65e commit cc3b528

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

src/qt/winshutdownmonitor.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66

77
#if defined(Q_OS_WIN)
88
#include <shutdown.h>
9-
#include <util/system.h>
109

1110
#include <windows.h>
1211

1312
#include <QDebug>
1413

15-
#include <openssl/rand.h>
16-
1714
// If we don't want a message to be processed by Qt, return true and set result to
1815
// the value that the window procedure should return. Otherwise return false.
1916
bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pMessage, long *pnResult)
@@ -22,16 +19,6 @@ bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pM
2219

2320
MSG *pMsg = static_cast<MSG *>(pMessage);
2421

25-
// Seed OpenSSL PRNG with Windows event data (e.g. mouse movements and other user interactions)
26-
if (RAND_event(pMsg->message, pMsg->wParam, pMsg->lParam) == 0) {
27-
// Warn only once as this is performance-critical
28-
static bool warned = false;
29-
if (!warned) {
30-
LogPrintf("%s: OpenSSL RAND_event() failed to seed OpenSSL PRNG with enough data.\n", __func__);
31-
warned = true;
32-
}
33-
}
34-
3522
switch(pMsg->message)
3623
{
3724
case WM_QUERYENDSESSION:

0 commit comments

Comments
 (0)