[LinuxBIOS] [PATCH] LAR checksums

Stefan Reinauer stepan at coresystems.de
Wed Oct 17 13:16:43 CEST 2007

* Alex Beregszaszi <alex at 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?

coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866

More information about the coreboot mailing list