summaryrefslogtreecommitdiff
path: root/util/nvmutil
AgeCommit message (Collapse)Author
17 hoursutil/nvmutil: allow ushort to be 32-bitLeah Rowe
no need to limit it here rename ux to uint. no number specified. Signed-off-by: Leah Rowe <leah@libreboot.org>
17 hoursutil/nvmutil: fix int assertLeah Rowe
it can be higher than 32-bit, it's fine the current check breaks some newer systems accordingly, u32 becomes ux, x meaning x bits Signed-off-by: Leah Rowe <leah@libreboot.org>
17 hoursutil/nvmutil: more assertsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
17 hoursutil/nvmutil: nicer typedefsLeah Rowe
now that i'm not using stdint, i can use sane typedef names Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursutil/nvmutil: remove stdint feature macroLeah Rowe
and remove stdint i don't need it. i typedef these ints myself and i assert their size Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: safer offset check (use subtraction)Leah Rowe
don't allow overflows Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: check null pointer in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: check overflow in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: fix offset validationLeah Rowe
i didn't take into account partial writes, in io_args this fixes it unfortunately, this means i have to loosen the offset check a bit, but it's fine Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hoursutil/nvmutil: restrict pointers in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: check gbe file type before writeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: check gbe file size before writeLeah Rowe
re-check. very unlikely since the program doesn't run for very long, but we have to check if the file has changed. this is a basic check of file size. we could probably check the contents too, but that would be overkill. Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: lock gbe fileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: don't allow symlinksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursnvmutil: fix bound check in last commitLeah Rowe
i was fixing the size, but it should be calculated properly. Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutul: remove unused arg in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: block bad offset in io_argsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: stricter i/o arg checksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: stricter i/o length checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: rename len to nrw in i/oLeah Rowe
consistent with prw() i prefer nrw (number of rw operations) Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: tidy up prw()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 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>
23 hoursutil/nvmutil: stricter i/o errorsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 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>
23 hoursnvmutil: cast integer in printfLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: check defines/enum via assertLeah Rowe
not at runtime Signed-off-by: Leah Rowe <leah@libreboot.org>
24 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>
31 hoursutil/nvmutil: remove pointless checkLeah Rowe
already checked below, then err() Signed-off-by: Leah Rowe <leah@libreboot.org>
31 hoursutil/nvmutil: add missing castLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
31 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>
31 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>
31 hoursutil/nvmutil: further tidy up prw()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
32 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>
33 hoursutil/nvmutil: further tidy up rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
34 hoursutil/nvmutil: minor cleanup: rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
34 hoursutil/nvmutil: remove dead codeLeah Rowe
useless check. will never be true. Signed-off-by: Leah Rowe <leah@libreboot.org>
34 hoursutil/nvmutil: remove pointless commentLeah Rowe
itt's totally obvious Signed-off-by: Leah Rowe <leah@libreboot.org>
34 hoursutil/nvmutil: reduced indentation in rw_file_onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursanother correctionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 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>
43 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
43 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
44 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/nvmutil: mitigate buggy libc i/oLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/nvmutil: implement zero-byte r/w timeoutLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursTODOLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/nvmutil: add some useful commentsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
45 hoursutil/nvmutil: split up rw_file_exactLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
46 hoursfix indentationLeah Rowe
i was editting this in another editor Signed-off-by: Leah Rowe <leah@libreboot.org>