Add perf counter data to GetStrongRandBytes state in scheduler #10372

pull TheBlueMatt wants to merge 2 commits into bitcoin:master from TheBlueMatt:2017-05-scheduler-rng changing 3 files +46 −0
  1. TheBlueMatt commented at 7:29 PM on May 9, 2017: member

    No description provided.

  2. TheBlueMatt force-pushed on May 9, 2017
  3. fanquake added the label Utils and libraries on May 10, 2017
  4. in src/random.cpp:230 in addee9fe03 outdated
     225 | +        hasher.Write((const unsigned char*)&nPerfCounter2, sizeof(nPerfCounter2));
     226 | +        hasher.Finalize(buf);
     227 | +        memcpy(rng_state, buf + 32, 32);
     228 | +    }
     229 | +    memory_cleanse((void*)&nPerfCounter1, sizeof(nPerfCounter1));
     230 | +    memory_cleanse((void*)&nPerfCounter2, sizeof(nPerfCounter2));
    


    ryanofsky commented at 3:49 PM on May 10, 2017:

    I don't think you actually need these casts.


    TheBlueMatt commented at 6:10 PM on May 10, 2017:

    Removed, I had just copied code from above.

  5. in src/random.h:31 in addee9fe03 outdated
      23 | @@ -24,6 +24,13 @@ int GetRandInt(int nMax);
      24 |  uint256 GetRandHash();
      25 |  
      26 |  /**
      27 | + * Add a little bit of randomness to the output of GetStrongRangBytes.
      28 | + * This sleeps for a millisecond, so should only be called when there is
      29 | + * no other work to be done.
      30 | + */
      31 | +void RandAddSeedSleep();
    


    ryanofsky commented at 3:50 PM on May 10, 2017:

    Maybe move declaration up nearer to RandAddSeed()


    TheBlueMatt commented at 6:11 PM on May 10, 2017:

    I deliberately left it down by the GetStrongRandBytes instead of up by the RAND_add stuff. I'll let @sipa handle moving things around when he removes OpenSSL's rng.

  6. ryanofsky commented at 4:32 PM on May 10, 2017: member

    utACK addee9fe03d4529b3e13c829861f98374f6f0d92. Implementation looks good and concept seems fine. There was discussion about it here: https://botbot.me/freenode/bitcoin-core-dev/msg/85210380/

  7. TheBlueMatt force-pushed on May 10, 2017
  8. in src/random.cpp:233 in 1dd6c61513 outdated
     215 | +
     216 | +    unsigned char buf[64];
     217 | +    CSHA512 hasher;
     218 | +    // Combine with and update state
     219 | +    {
     220 | +        std::unique_lock<std::mutex> lock(cs_rng_state);
    


    laanwj commented at 8:59 AM on May 17, 2017:

    Would be nice to factor out the 'add this data to the random state' to a function, to make sure the same algorithm is used everywhere (e.g. to reduce the chance of accidental 'oops I replaced the state with all zeros' when there are more of these functions that add different entropy measurements).

  9. ryanofsky commented at 3:03 PM on May 17, 2017: member

    utACK 1dd6c6151381a39d4f734e05a38f71021c9c719c. Only change since last review was removing void* casts.

  10. Add internal method to add new random data to our internal RNG state 399fb8f2d0
  11. Add perf counter data to GetStrongRandBytes state in scheduler 888cce57a6
  12. TheBlueMatt force-pushed on May 22, 2017
  13. TheBlueMatt commented at 8:02 PM on May 22, 2017: member

    Added a separate AddDataToRng function for general use later.

  14. laanwj commented at 3:54 PM on May 23, 2017: member

    utACK 888cce5

  15. sipa commented at 4:42 PM on May 23, 2017: member

    utACK 888cce57a67c901b89c86cc645f275071d021285

  16. laanwj merged this on May 23, 2017
  17. laanwj closed this on May 23, 2017

  18. laanwj referenced this in commit 15254e907e on May 23, 2017
  19. PastaPastaPasta referenced this in commit 9629f0f5a6 on Jun 10, 2019
  20. PastaPastaPasta referenced this in commit 6dbb250aa1 on Jun 11, 2019
  21. PastaPastaPasta referenced this in commit 9dc974c49d on Jun 11, 2019
  22. PastaPastaPasta referenced this in commit 8d2bbb6f36 on Jun 15, 2019
  23. PastaPastaPasta referenced this in commit a8501bea47 on Jun 19, 2019
  24. PastaPastaPasta referenced this in commit c17e58c23b on Jun 19, 2019
  25. PastaPastaPasta referenced this in commit 8a0405c1e9 on Jun 19, 2019
  26. PastaPastaPasta referenced this in commit 391de333d5 on Jun 19, 2019
  27. PastaPastaPasta referenced this in commit 4873409c40 on Jun 19, 2019
  28. PastaPastaPasta referenced this in commit d13bad743e on Jun 20, 2019
  29. PastaPastaPasta referenced this in commit b42fc3b059 on Jun 22, 2019
  30. PastaPastaPasta referenced this in commit be6aa26303 on Jun 22, 2019
  31. PastaPastaPasta referenced this in commit 6600432801 on Jun 22, 2019
  32. PastaPastaPasta referenced this in commit e824dbbd27 on Jun 22, 2019
  33. PastaPastaPasta referenced this in commit a842d545e5 on Jun 22, 2019
  34. PastaPastaPasta referenced this in commit 3dae8f270c on Jun 24, 2019
  35. barrystyle referenced this in commit 377df00fcd on Jan 22, 2020
  36. DrahtBot 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-13 15:15 UTC

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