summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
10 hoursutil/nvmutil: fix an err stringLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hoursutil/nvmutil: tidy up conv_argv_part_numLeah Rowe
no need for strlen here (1-character string). Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hoursutil/nvmutil: Shorten a commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
10 hoursutil/nvmutil: fix a bad commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: make gbe_st local, not static/globalLeah Rowe
forgot to remove static when making it local Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: rename rfd to urandom_fdLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: remove reset_global_stateLeah Rowe
it was put there for another change i haven't done yet, and probably won't. the program currently just runs once with one operation, on a given file. the current defaults are initialised just fine without this function, so let's remove this bloat for now. Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: rename arc4random defineLeah Rowe
specifically refer to the actual function i use. Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: reset errno on /dev/random fallbackLeah Rowe
i didn't catch this before. stale error state would have passed through, even on ultimate success. Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: remove rval from conv_argv_part_numLeah Rowe
relic from an earlier uncommitted version Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: set part_modified to a uint8_tLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: make invert a uint8_tLeah Rowe
cleaner intention, and shorter Signed-off-by: Leah Rowe <leah@libreboot.org>
11 hoursutil/nvmutil: safer argv part number parsingLeah Rowe
we now handle signedness properly, which is implementation defined, on char integers where signed/unsigned is not specified. Signed-off-by: Leah Rowe <leah@libreboot.org>
12 hoursutil/nvmutil: rename check_bound check_nvm_boundLeah Rowe
this makes the intent clearer, because we only want to access the 128-byte nvm area here. Signed-off-by: Leah Rowe <leah@libreboot.org>
12 hoursutil/nvmutil: be clearer about GbE file sizesLeah Rowe
the partsize variable is also misleading, because it refers to the full half of a file, which might be bigger than 4KB. this variable name is a hangover from when nvmutil only supported 8KB files. Signed-off-by: Leah Rowe <leah@libreboot.org>
12 hoursutil/nvmutil: rename fd to fd_ptr in xopen()Leah Rowe
clearer intent Signed-off-by: Leah Rowe <leah@libreboot.org>
12 hoursutil/nvmutil: cleaned up a few prototypesLeah Rowe
make them match how they're declared Signed-off-by: Leah Rowe <leah@libreboot.org>
12 hoursutil/nvmutil: more readable xopenLeah Rowe
match the argument names of openbsd open(2) Signed-off-by: Leah Rowe <leah@libreboot.org>
12 hoursutil/nvmutil: use unsigned char in hextonumLeah Rowe
char can be signed or unsigned, and this is often implementation-defined. this could result in bad comparisons, so we should specifically cast it. Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: remove redundant breakLeah Rowe
err takes care of it Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: rename write_gbe to write_gbe_fileLeah Rowe
for clarity Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: rename read_gbe to read_gbe_fileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: unified partnum validationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: rename global st variableLeah Rowe
rename it to gbe_st, for clarity Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: full prototypesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: tidy up read_gbeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
13 hoursutil/nvmutil: tidy up set_mac_nibLeah Rowe
simplify it again Signed-off-by: Leah Rowe <leah@libreboot.org>
14 hoursutil/nvmutil: remove unnecessary checckLeah Rowe
the for loop exits when setting cmd checking for NULL is pointless Signed-off-by: Leah Rowe <leah@libreboot.org>
14 hoursRevert "util/nvmutil: make invert an unsigned char"Leah Rowe
This reverts commit 5b120d71e713ea490bab7e90e21207cb16587779. the others are unsigned char. other variables like this one. better be consistent. Signed-off-by: Leah Rowe <leah@libreboot.org>
14 hoursutil/nvmutil: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
14 hoursutil/nvmutil: cleaner mac address variable namesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
14 hoursutil/nvmutil: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: make invert an unsigned charLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: make mac_updated unsignedLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: use size_t in setmac functionsLeah Rowe
not int Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: extra part check in set_checksumLeah Rowe
it calls word() anyway, but we should still check it here, since this is quite a critical function. the other bound checks are done by word(), which this function uses to add everything up. Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: don't set part in write_mac_partLeah Rowe
make a helper for cmd_setchecksum with size_t arg, and use it in write_mac_part. Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: fix duplicated word in commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: make part_modified an unsigned charLeah Rowe
better reflects intent Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: fix bad string in gbe_read_part()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: calculate off AFTER part validationLeah Rowe
because we check the part first, so we need to know it's valid before proceeding. Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: made a comment a bit clearerLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: fix another printf specifierLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: remove unnecessary castsLeah Rowe
now that part numbers are size_t, i don't need them. Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: fix more bad printf statementsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
15 hoursutil/nvmutil: fix a few bad printf statementsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
16 hoursutil/nvmutil: warn about partial gbe file writesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
16 hoursutil/nvmutil: use size_t for part numbersLeah Rowe
not int Signed-off-by: Leah Rowe <leah@libreboot.org>
16 hoursutil/nvmutil: clean up file handlingLeah Rowe
inline check_read_or_die Signed-off-by: Leah Rowe <leah@libreboot.org>
16 hoursutil/nvmutil: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>