No description provided.
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-
TheBlueMatt commented at 7:29 PM on May 9, 2017: member
- TheBlueMatt force-pushed on May 9, 2017
- fanquake added the label Utils and libraries on May 10, 2017
-
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.
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.
ryanofsky commented at 4:32 PM on May 10, 2017: memberutACK addee9fe03d4529b3e13c829861f98374f6f0d92. Implementation looks good and concept seems fine. There was discussion about it here: https://botbot.me/freenode/bitcoin-core-dev/msg/85210380/
TheBlueMatt force-pushed on May 10, 2017in 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).
ryanofsky commented at 3:03 PM on May 17, 2017: memberutACK 1dd6c6151381a39d4f734e05a38f71021c9c719c. Only change since last review was removing void* casts.
Add internal method to add new random data to our internal RNG state 399fb8f2d0Add perf counter data to GetStrongRandBytes state in scheduler 888cce57a6TheBlueMatt force-pushed on May 22, 2017TheBlueMatt commented at 8:02 PM on May 22, 2017: memberAdded a separate AddDataToRng function for general use later.
laanwj commented at 3:54 PM on May 23, 2017: memberutACK 888cce5
sipa commented at 4:42 PM on May 23, 2017: memberutACK 888cce57a67c901b89c86cc645f275071d021285
laanwj merged this on May 23, 2017laanwj closed this on May 23, 2017laanwj referenced this in commit 15254e907e on May 23, 2017PastaPastaPasta referenced this in commit 9629f0f5a6 on Jun 10, 2019PastaPastaPasta referenced this in commit 6dbb250aa1 on Jun 11, 2019PastaPastaPasta referenced this in commit 9dc974c49d on Jun 11, 2019PastaPastaPasta referenced this in commit 8d2bbb6f36 on Jun 15, 2019PastaPastaPasta referenced this in commit a8501bea47 on Jun 19, 2019PastaPastaPasta referenced this in commit c17e58c23b on Jun 19, 2019PastaPastaPasta referenced this in commit 8a0405c1e9 on Jun 19, 2019PastaPastaPasta referenced this in commit 391de333d5 on Jun 19, 2019PastaPastaPasta referenced this in commit 4873409c40 on Jun 19, 2019PastaPastaPasta referenced this in commit d13bad743e on Jun 20, 2019PastaPastaPasta referenced this in commit b42fc3b059 on Jun 22, 2019PastaPastaPasta referenced this in commit be6aa26303 on Jun 22, 2019PastaPastaPasta referenced this in commit 6600432801 on Jun 22, 2019PastaPastaPasta referenced this in commit e824dbbd27 on Jun 22, 2019PastaPastaPasta referenced this in commit a842d545e5 on Jun 22, 2019PastaPastaPasta referenced this in commit 3dae8f270c on Jun 24, 2019barrystyle referenced this in commit 377df00fcd on Jan 22, 2020DrahtBot locked this on Sep 8, 2021ContributorsLabels
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
More mirrored repositories can be found on mirror.b10c.me