* Alex Beregszaszi alex@rtfs.hu [070906 03:23]:
Hi,
checksum-fix.diff fixes a checksum calculation bug in the lar utility, where it would checksum less bytes then desired.
lar-check-sum.diff implements checksum checking in the runtime lar code.
I implemented the check inside the filename check, thus it wont be executed on unneeded entries. As my assumption was that I cant modify the memory, the code is skipping bytes between 20-24 of the header (checksum field) to generate a correct sum.
What about writing 0-(summed u32s) instead of (summed u32s) as checksum.. this way we could just sum up and should get a result of 0, when adding the checksum. The good thing would be, we don't have to care where the checksum sits, as long as its at a 32bit aligned offset. (Which should be rather simple to enforce)
Also, this should maybe not be done every time we look at a lar entry. Otherwise we have to calculate checksums for all files when accessing the last file in the archive. This can have a noticable impact.
Maybe we should use 2 checksums, one for the header and one for the rest. When walking the archive, only check the header sums. When loading a lar entry or XIPing it, check the data/code itself.
What do you think?