{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14623","repository_url":"https://api.github.com/repos/bitcoin/bitcoin","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14623/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14623/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14623/events","html_url":"https://github.com/bitcoin/bitcoin/issues/14623","id":376176095,"node_id":"MDU6SXNzdWUzNzYxNzYwOTU=","number":14623,"title":"[RFC] Built-in RNG design","user":{"login":"sipa","id":548488,"node_id":"MDQ6VXNlcjU0ODQ4OA==","avatar_url":"https://avatars1.githubusercontent.com/u/548488?v=4","gravatar_id":"","url":"https://api.github.com/users/sipa","html_url":"https://github.com/sipa","followers_url":"https://api.github.com/users/sipa/followers","following_url":"https://api.github.com/users/sipa/following{/other_user}","gists_url":"https://api.github.com/users/sipa/gists{/gist_id}","starred_url":"https://api.github.com/users/sipa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sipa/subscriptions","organizations_url":"https://api.github.com/users/sipa/orgs","repos_url":"https://api.github.com/users/sipa/repos","events_url":"https://api.github.com/users/sipa/events{/privacy}","received_events_url":"https://api.github.com/users/sipa/received_events","type":"User","site_admin":false},"labels":[{"id":64584,"node_id":"MDU6TGFiZWw2NDU4NA==","url":"https://api.github.com/repos/bitcoin/bitcoin/labels/Brainstorming","name":"Brainstorming","color":"ebd775","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-31T21:56:28Z","updated_at":"2018-11-08T19:38:01Z","closed_at":null,"author_association":"MEMBER","body":"This is a proposal for the operation of our internal random number generator.\r\n\r\nClear classification of what use case uses which interface:\r\n* **Random numbers whose security is critical** (private keys, seeds, encryption keys) use the `GetStrongRandBytes` function, which draws from our own RNG state, after mixing in \"slow\" entropy (see further).\r\n* **Non-critical random numbers that are infrequently needed** use the `GetRandBytes` class of functions (designed to work in ~microsecond time), which draw from our own RNG state after mixing in \"fast\" entropy.\r\n* **Non-critical random numbers needed inside tight loops** use a local `FastRandomContext` (which produces cryptographically secure random numbers, but is only seeded once - using the `GetRandBytes` level (see previous bullet point).\r\n\r\nTo assist in generation, we have 3 levels of seeding:\r\n* **fast** This is automatically invoked by `GetRandBytes`, and mixes in things like stack pointer and high-precision timestamp.\r\n* **slow** This is automatically invoked by `GetStrongRandBytes`, and mixes in everything fast seeding mixes in, as well as all external sources of entropy (rdrand, getrandom, /dev/urandom, ...).\r\n* **very slow** This is automatically invoked once at startup, and can be invoked periodically by the scheduler thread when idle. It mixes in everything the slow seeding mixes in, as well as OS environment data, performance monitoring data if available, and time the duration of sleeps.\r\n\r\nInitially \"slow\" and \"very slow\" can include OpenSSL as an entropy source, and when sufficiently many replacements are added, it can be dropped.\r\n"},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/437128692","html_url":"https://github.com/bitcoin/bitcoin/issues/14623#issuecomment-437128692","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/14623","id":437128692,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzEyODY5Mg==","user":{"login":"pstratem","id":620611,"node_id":"MDQ6VXNlcjYyMDYxMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/620611?v=4","gravatar_id":"","url":"https://api.github.com/users/pstratem","html_url":"https://github.com/pstratem","followers_url":"https://api.github.com/users/pstratem/followers","following_url":"https://api.github.com/users/pstratem/following{/other_user}","gists_url":"https://api.github.com/users/pstratem/gists{/gist_id}","starred_url":"https://api.github.com/users/pstratem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pstratem/subscriptions","organizations_url":"https://api.github.com/users/pstratem/orgs","repos_url":"https://api.github.com/users/pstratem/repos","events_url":"https://api.github.com/users/pstratem/events{/privacy}","received_events_url":"https://api.github.com/users/pstratem/received_events","type":"User","site_admin":false},"created_at":"2018-11-08T19:38:01Z","updated_at":"2018-11-08T19:38:01Z","author_association":"CONTRIBUTOR","body":"change the GetRandBytes functions to GetWeakRandBytes\r\nmeasure latency of various entropy sources"}}
{"actor":{"display_login":"pstratem"}}