mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-22 04:18:10 +02:00
Heavily inspired by systemd ([1]).
We now also have nm_random_get_bytes{,_full}() and
nm_random_get_crypto_bytes(), like systemd's random_bytes()
and crypto_random_bytes(), respectively.
Differences:
- instead of systemd's random_bytes(), our 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_NONBLOCK) before 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.
There is also a major bugfix here. Previously, if getrandom() failed
with ENOSYS and we fell back to /dev/urandom, we would assume that we
have high quality random numbers. That assumption is not warranted.
Now instead poll on /dev/random to find out.
[1]
|
||
|---|---|---|
| .. | ||
| tests | ||
| meson.build | ||
| nm-c-list.h | ||
| nm-dbus-aux.c | ||
| nm-dbus-aux.h | ||
| nm-dedup-multi.c | ||
| nm-dedup-multi.h | ||
| nm-default-glib-i18n-lib.h | ||
| nm-default-glib-i18n-prog.h | ||
| nm-default-glib.h | ||
| nm-enum-utils.c | ||
| nm-enum-utils.h | ||
| nm-errno.c | ||
| nm-errno.h | ||
| nm-gassert-patch.h | ||
| nm-glib.h | ||
| nm-hash-utils.c | ||
| nm-hash-utils.h | ||
| nm-io-utils.c | ||
| nm-io-utils.h | ||
| nm-jansson.h | ||
| nm-json-aux.c | ||
| nm-json-aux.h | ||
| nm-keyfile-aux.c | ||
| nm-keyfile-aux.h | ||
| nm-logging-base.c | ||
| nm-logging-base.h | ||
| nm-logging-fwd.h | ||
| nm-logging-syslog.h | ||
| nm-macros-internal.h | ||
| nm-obj.h | ||
| nm-random-utils.c | ||
| nm-random-utils.h | ||
| nm-ref-string.c | ||
| nm-ref-string.h | ||
| nm-secret-utils.c | ||
| nm-secret-utils.h | ||
| nm-shared-utils.c | ||
| nm-shared-utils.h | ||
| nm-str-buf.h | ||
| nm-test-utils.h | ||
| nm-time-utils.c | ||
| nm-time-utils.h | ||
| nm-uuid.c | ||
| nm-uuid.h | ||
| nm-value-type.h | ||
| README.md | ||
libnm-glib-aux
A static helper library with general purpose helpers on top of glib.
This is similar to libnm-std-aux (on which this library depends). The difference is that libnm-std-aux only requires standard C (C11), while this has a dependency on glib.
As this has no additional dependencies, we should have all our glib code use this internal helper library. It contains helpers that should be available (and used) in all our C/glib applications/libraries.
Parts of this library are usually already included via the nm-default*.h
headers.