summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lottery.c
AgeCommit message (Collapse)Author
21 hourslbutils: only use GNU SOURCE for syscallLeah Rowe
and remove manual prototypes; fchmod, realpath and so on rely on the _XOPEN_SOURCE macro. the POSIX macro wasn't needed: _XOPEN_SOURCE is sufficient. Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hourslibreboot-utils: don't use the GNU SOURCE macroLeah Rowe
use the POSIX one declare prototypes where necessary. Signed-off-by: Leah Rowe <leah@libreboot.org>
39 hourslibreboot-utils: stricter errno handlingLeah Rowe
where possible, try not to clobber sys errno. override it only when relatively safe. also: when a syscall succeeds, it may set errno. this is rare, but permitted (nothing specified against it in specs, and the specs say that errno is undefined on success). i'm not libc, but i'm wrapping around it, so i need to be careful in how i handle the errno value. also: i removed the requirement for directories to be executable, in mkhtemp.c, because this isn't required and will only break certain setups. in world_writeable and sticky, i made the checks stricter: the faccessat check was being skipped on some paths, so i've closed that loophole now. i also generally cleaned up some code, as part of the errno handling refactoring, where it made sense to do so, plus a few other bits of code cleanup. Signed-off-by: Leah Rowe <leah@libreboot.org>
2 dayslibreboot-utils: unified max path lengthsLeah Rowe
just use PATH_MAX like a normal person with additional safety Signed-off-by: Leah Rowe <leah@libreboot.org>
3 dayscorrect exit statusLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
3 daysbe reasonableLeah Rowe
8GB of entropy is a tad extreme Signed-off-by: Leah Rowe <leah@libreboot.org>
3 dayslibreboot-utils: safe memcmpLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
4 dayshexdump performance test, part 1Leah Rowe
spoiler alert: it's slow as molasses part 2 will be presented at a later date (yes, please don't fill 8GB of memory with random data and hexdump it) Signed-off-by: Leah Rowe <leah@libreboot.org>
4 dayslbutils: simplify getprogname usageLeah Rowe
the functions no longer return errors, so i don't need to handle them. furthermore, the handling in state.c is redundant, so i've removed that too. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 dayslibreboot-utils: simplify random tmpdir namegenLeah Rowe
generalise it in rand.c because this logic will be useful for other programs in the future. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 dayslbutils: rename mkrbuf to rmallocLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: better hexdumpLeah Rowe
this is a more generic one that i implemented for "lottery.c" (which is really just a tester of my rset function in lib/rand.c) i could probably actually write a full hexdump program in libreboot-utils to be honest. Signed-off-by: Leah Rowe <leah@libreboot.org>
4 dayscleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
5 dayslibreboot-utils: unified error handlingLeah Rowe
i now use a singleton hook function per program: nvmutil, mkhtemp and lottery call this at the startup of your program: (void) errhook(exit_cleanup); then provide that function. make it static, so that each program has its own version. if you're writing a program that handles lots of files for example, and you want to do certain cleanup on exit (including error exit), this can be quite useful. Signed-off-by: Leah Rowe <leah@libreboot.org>
5 daysrand.c: fix initialisation bug in mrkbufLeah Rowe
should be null on bad return Signed-off-by: Leah Rowe <leah@libreboot.org>
5 dayscleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
5 daysheaderLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
6 daysutil/libreboot-utils: finish implementing hellLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
6 dayschallengeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
6 dayscleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
7 dayscleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
7 daysfurther cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
7 dayslibreboot-utils: improved randomness testLeah Rowe
and the module bias handling is fully correct Signed-off-by: Leah Rowe <leah@libreboot.org>
7 daysmore cleanup on rand.cLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
7 dayslibreboot-utils: tidy up rand.cLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
7 daysrmallocLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
7 daysutil/libreboot-utils: randomisation testLeah Rowe
to test the effectiveness of the rand function Signed-off-by: Leah Rowe <leah@libreboot.org>