summaryrefslogtreecommitdiff
path: root/util/nvmutil
AgeCommit message (Collapse)Author
18 hoursutil/nvmutil: remove redundant breakLeah Rowe
err takes care of it Signed-off-by: Leah Rowe <leah@libreboot.org>
18 hoursutil/nvmutil: rename write_gbe to write_gbe_fileLeah Rowe
for clarity Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: rename read_gbe to read_gbe_fileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: unified partnum validationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: rename global st variableLeah Rowe
rename it to gbe_st, for clarity Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: full prototypesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: tidy up read_gbeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
19 hoursutil/nvmutil: tidy up set_mac_nibLeah Rowe
simplify it again Signed-off-by: Leah Rowe <leah@libreboot.org>
19 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>
19 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>
19 hoursutil/nvmutil: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hoursutil/nvmutil: cleaner mac address variable namesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hoursutil/nvmutil: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hoursutil/nvmutil: make invert an unsigned charLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hoursutil/nvmutil: make mac_updated unsignedLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
20 hoursutil/nvmutil: use size_t in setmac functionsLeah Rowe
not int Signed-off-by: Leah Rowe <leah@libreboot.org>
20 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>
21 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>
21 hoursutil/nvmutil: fix duplicated word in commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: make part_modified an unsigned charLeah Rowe
better reflects intent Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: fix bad string in gbe_read_part()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 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>
21 hoursutil/nvmutil: made a comment a bit clearerLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: fix another printf specifierLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 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>
21 hoursutil/nvmutil: fix more bad printf statementsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: fix a few bad printf statementsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: warn about partial gbe file writesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
21 hoursutil/nvmutil: use size_t for part numbersLeah Rowe
not int Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: clean up file handlingLeah Rowe
inline check_read_or_die Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: mem bound check on file read/writeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: rename gbe_bound for clarityLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
22 hoursutil/nvmutil: make defines easier to understandLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: tidy up set_mac_nibLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: use portable printf on hexdumpLeah Rowe
lx means unsigned long, and row is size_t which often is, but this is not guaranteed. Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: make the MAC shifting easier to readLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: optimise hextonumLeah Rowe
there is 0x20 of different between a and A so we can just or 0x20 and compare only lowercase. we can also cast char (which may me signed on some systems) to unsigned, and then only check whether it's lower than 10. this code results in far less branching (in C), but a good optimising compiler probably wouldn't have cared about the old version anyway. it's just nicer C code. this also means we no longer need to check for X, only x. Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: fix parenthesis warning in GCCLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: tidy up set_mac_nibLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: clearer intent on struct dataLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: more readable NVM definesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: more readable SIZE_nKB definesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: use arc4random on DragonFly BSDLeah Rowe
it has arc4random, so we will use it there. Signed-off-by: Leah Rowe <leah@libreboot.org>
23 hoursutil/nvmutil: use strlen instead of strnlenLeah Rowe
strnlen isn't available on some older unices. we already know the string will be null-terminated, because it comes from argv, so runaway reads are extremely unlikely (read: impossible). Signed-off-by: Leah Rowe <leah@libreboot.org>
24 hoursutil/nvmutil: add bound checks for gbe read/writeLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
24 hoursutil/nvmutil: minor code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
24 hoursutil/nvmutil: clearer macbuff init in set_mac_nibLeah Rowe
and 1 does the same thing as mod 2, but it's cleaner. i also now bitshift 3 times instead of times by 8, which again is clearer in purpose. i line breaked after h, to make it clear that all of the next part is being shifted in Signed-off-by: Leah Rowe <leah@libreboot.org>
25 hoursutil/nvmutil: don't reset rfd on openbsdLeah Rowe
it isn't defined there Signed-off-by: Leah Rowe <leah@libreboot.org>
25 hoursutil/nvmutil: tidy up rhex()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>