[Qt] seed OpenSSL PNRG with Windows event data #4399

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:openssl_win_events changing 1 files +16 −3
  1. Diapolo commented at 12:37 PM on June 24, 2014: none
  2. in src/qt/winshutdownmonitor.cpp:None in 23e3a1ed42 outdated
      21 | @@ -19,6 +22,10 @@ bool WinShutdownMonitor::nativeEventFilter(const QByteArray &eventType, void *pM
      22 |  
      23 |         MSG *pMsg = static_cast<MSG *>(pMessage);
      24 |  
      25 | +       // Seed OpenSSL PNRG with Windows event data (e.g.  mouse movements and other user interactions)
      26 | +       if (RAND_event(pMsg->message, pMsg->wParam, pMsg->lParam) == 0)
      27 | +           LogPrint("rand", "RAND_event : Warning, OpenSSL PRNG has NOT been seeded with enough data.\n");
    


    laanwj commented at 12:48 PM on June 24, 2014:

    There should be rate limiting on this message (for example log it only once using a static bool flag). I think this is likely to return 0, and generating a message on every windows event is bound to bog down the interface.


    Diapolo commented at 12:52 PM on June 24, 2014:

    That's a good idea, but it's only visible when using rand category or log everything anyway. I also didn't get a single occurance of that log message during testing yet.


    laanwj commented at 12:56 PM on June 24, 2014:

    Right, but there is still overhead to calling this function for every event, even if the message is generated then discarded. This is a very low-level function and performance is important here. What I'm afraid of are situations like that at some point the entropy pool runs out and suddenly the interface becomes lots slower.


    Diapolo commented at 2:04 PM on June 24, 2014:

    Added, thanks for your code in #4392 ^^.

  3. in src/qt/winshutdownmonitor.cpp:None in 3b93aac011 outdated
      10 |  
      11 |  #include <windows.h>
      12 |  
      13 |  #include <QDebug>
      14 |  
      15 | +#include <openssl/rand.h>
    


    laanwj commented at 11:43 AM on June 29, 2014:

    Going to merge this after the random.h/cpp change, so that we can have a function there instead of creating a dependency on OpenSSL here.


    Diapolo commented at 6:14 AM on July 2, 2014:

    Yeah that is fine, are you currently testing/using the random.h/.cpp change?


    laanwj commented at 6:20 AM on July 2, 2014:

    Yes but you do realize that randomness is one of the most critical parts of cryptographic software like this, and it's notoriously hard to test, so that change needs to be reviewed really carefully by multiple people.


    Diapolo commented at 6:27 AM on July 2, 2014:

    Indeed and as the changes shall increase that part I agree, we need reviewers and testers.

  4. laanwj commented at 5:55 AM on July 4, 2014: member

    ACK. Will merge this after rebase.

  5. [Qt] seed OpenSSL PNRG with Windows event data
    - see https://bitcointalk.org/index.php?topic=113496.msg1228193#msg1228193
      for the initial suggestion for this
    - also ensure consistent debug.log message format
    674c070e5d
  6. Diapolo commented at 3:17 PM on July 4, 2014: none

    Rebased...

  7. BitcoinPullTester commented at 3:55 PM on July 4, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p4399_674c070e5d28bdf1e4e631abc157f6ea0b0b1698/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  8. laanwj merged this on Jul 7, 2014
  9. laanwj closed this on Jul 7, 2014

  10. laanwj referenced this in commit 642c8e75bc on Jul 7, 2014
  11. Diapolo deleted the branch on Jul 7, 2014
  12. fanquake referenced this in commit 5794695379 on Oct 14, 2019
  13. fanquake referenced this in commit cc3b5289ef on Oct 15, 2019
  14. fanquake referenced this in commit 3a809eeb5b on Oct 15, 2019
  15. fanquake referenced this in commit 0d233cd86a on Oct 16, 2019
  16. fanquake referenced this in commit 0bc7a28f9d on Oct 16, 2019
  17. fanquake referenced this in commit fa1e498a8b on Oct 17, 2019
  18. fanquake referenced this in commit f13769a0cb on Oct 18, 2019
  19. fanquake referenced this in commit ddc3cf26ff on Oct 18, 2019
  20. sidhujag referenced this in commit e6a7ea19a7 on Oct 21, 2019
  21. deadalnix referenced this in commit bd779b7d26 on May 20, 2020
  22. ftrader referenced this in commit 5510da5d81 on Aug 17, 2020
  23. silence48 referenced this in commit c0f71f2f90 on Nov 13, 2020
  24. Fuzzbawls referenced this in commit 6eacf1b904 on Mar 30, 2021
  25. Fuzzbawls referenced this in commit ada98689c9 on Apr 14, 2021
  26. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me