Heavily inspired by systemd ().
We now also have
nm_random_get_crypto_bytes(), like systemd's
- instead of systemd's
nm_random_get_bytes_full()also estimates whether the output is of high quality. The caller may find that interesting. Due to that, we will first try to call
getrandom(GRND_INSECURE). That is reversed from systemd's
random_bytes(), because we want to find out whether we can get good random numbers. In most cases, kernel should have entropy already, and it makes no difference.
Otherwise, heavily rework the code. It should be easy to understand and correct.