summaryrefslogtreecommitdiff
path: root/util/nvmutil/lib/num.c
AgeCommit message (Collapse)Author
47 hoursutil/nvmutil: better getrandom safetyLeah Rowe
err if buf NULL, len -1 also getrandom may return fewer bytes, so loop that too. why can't linux be like bsd? bsd is: arc4random_buf(buf, len); no checks needed. it never errs. Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daysfix variable nameLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daysutil/nvmutil: re-add fallback timer randLeah Rowe
for 1989 enabled via ifdef. not enabled by default. Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daysutil/nvmutil: remove arandom fallback on randLeah Rowe
openbsd 2.1 has arc4random, which we detect here. arandom was apparently added much later, so this is dead code. remove it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daysutil/nvmutil: rand: use getrandom on newer linuxLeah Rowe
we still fall back to the old /dev/urandom read on older linux, via runtime detection (ENOSYS). getrandom is better, because it guarantees entropy via blocking, and works even when /dev/urandom is unavailable. it has the same practical benefit as arc4random, which i use on bsd. linux can have arc4random, but not every linux libc has it, so it's better to use getrandom on linux. older linux will fall back to /dev/urandom Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daysutil/nvmutil: buffered urandom readsLeah Rowe
also generally tidied the code and made it more robust e.g. retries Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daystidy some commentsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2 daysnvmutil: rename x_i_close to close_on_eintrLeah Rowe
that's what it does. waits for eintr to stop firing Signed-off-by: Leah Rowe <leah@libreboot.org>
3 daysutil/nvmutil: tidy up includesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
3 daysutil/nvmutil: major cleanupLeah Rowe
handle init in xstatus() it's now a singleton design also tidied up some other code also removed todo.c. bloat. will do all those anyway. too much change. i just kept touching the code until it looked good Signed-off-by: Leah Rowe <leah@libreboot.org>
3 daysnvmutil: move lib files to lib/Leah Rowe
only keep nvmutil.c in main Signed-off-by: Leah Rowe <leah@libreboot.org>