summaryrefslogtreecommitdiff
path: root/util/nvmutil
AgeCommit message (Collapse)Author
18 hoursutil/nvmutil: block O_APPEND in prw()Leah Rowe
O_APPEND allows writes at EOF, thus breaking positional read/write Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursutil/nvmutil: stricter i/o errorsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursutil/nvmutil: fix entropy issueLeah Rowe
the time difference used here could go negative, which would overflow in the xor op on mix, leading to a biased entropy pool. we want to ensure that they numbers do not overflow, because here they are cast to unsigned which would then produce very large numbers. Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursnvmutil: cast integer in printfLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: check defines/enum via assertLeah Rowe
not at runtime Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: r_type check in rw_gbe_file_partLeah Rowe
i already send the right arg anyway. this is a preventative bug fix against future maintenance. Signed-off-by: Leah Rowe <leah@libreboot.org>
26 hoursutil/nvmutil: remove pointless checkLeah Rowe
already checked below, then err() Signed-off-by: Leah Rowe <leah@libreboot.org>
26 hoursutil/nvmutil: add missing castLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
26 hoursutil/nvmutil: err in rw_file_exact on zero returnLeah Rowe
zero never occurs, because rw_file_once never returns zero, but only rw_file_once determines that. rw_file_exact must handle every possible error. right now, if that call returns zero, rw_file_exact would have an infinite loop. this doesn't actually happen at the moment, so this is a preventative bug fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
27 hoursutil/nvmutil: increment rc at end of rw_file_exactLeah Rowe
for fussy static analysers and/or compilers Signed-off-by: Leah Rowe <leah@libreboot.org>
27 hoursutil/nvmutil: further tidy up prw()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
27 hoursutil/nvmutil: clean up i/o functionsLeah Rowe
properly verify the value of the arguments, with asserts. add simpler runtime checks in-function, on prw, rw_file_once and rw_file_exact. variable names in english now, and the code is cleaner, while being functionally equivalent. Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: further tidy up rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: minor cleanup: rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: remove dead codeLeah Rowe
useless check. will never be true. Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: remove pointless commentLeah Rowe
itt's totally obvious Signed-off-by: Leah Rowe <leah@libreboot.org>
29 hoursutil/nvmutil: reduced indentation in rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
38 hoursanother correctionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
38 hoursutil/nvmutil: fix regression on openbsdLeah Rowe
when i removed arc4random integration, i forgot to change this line back. oops! Signed-off-by: Leah Rowe <leah@libreboot.org>
38 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
39 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
39 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: mitigate buggy libc i/oLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: implement zero-byte r/w timeoutLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: add some useful commentsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
40 hoursutil/nvmutil: split up rw_file_exactLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
41 hoursfix indentationLeah Rowe
i was editting this in another editor Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: add jitter to fallback_rand entropyLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: improved entropy in fallback_randLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: remove /dev/random fallbackLeah Rowe
only use the old fallback, or /dev/urandom /dev/random blocks on some older unix machines, or in embedded environments that may never have enough entropy, causing the code to hang. urandom is most certainly expected to exist on pretty much anything since the mid 90s. i could probably re-add the arc4random setup for BSDs. i'll think about it. gotta do that portably too. Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: include time.h after types.hLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: mitigate fast calls to randLeah Rowe
if someone calls rhex fast enough, the timestamp may not change. this mitigates that by adding a counter value to the mix Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: fallback randomiserLeah Rowe
used when a random device isn't available, on old unix, or on certain chroot environments. Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: correct install usageLeah Rowe
one for directory, then copy the binary Signed-off-by: Leah Rowe <leah@libreboot.org>
42 hoursutil/nvmutil: fix makefileLeah Rowe
forgot to include the binary in the path Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: remove errno externLeah Rowe
may break modern systems. and all old systems that i care about will handle errno just fine. Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: use install -d instead of mkdir -pLeah Rowe
-p isn't portable Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: fix commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: use chmod instead, in MakefileLeah Rowe
yeah, why not use a tool that's been around since the 80s? Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: add -m to install on MakefileLeah Rowe
also support LDFLAGS Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: simplify flags on urandomLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: fix mistake in random checkLeah Rowe
forgot this. oops Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: portable errnoLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: fix non-portable variable declarationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: disable urandom if not foundLeah Rowe
disable random mac address generation on really old operating systems. Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursutil/nvmutil: use ECANCELED on checksum errLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursutil/nvmutil: don't use errno for program stateLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
4 daysutil/nvmutil: re-use do_rw() from prw()Leah Rowe
using a special leah-only technique Signed-off-by: Leah Rowe <leah@libreboot.org>