Message ID | 20221106154111.872209-1-bjorn@mork.no |
---|---|
Headers | show |
Series | Prevent alignment issues with "in place" FIT configurations | expand |
So if anyone looked at this, then you've noticed that it fails to consider signing. The design makes it hard to support the combination. Algnment must run last since signing may inject variable sized nodes before the fdt data properties. Signing must run last since it hashes the blob as it is, inluding FDT_NOP tags and property order. But we can trick this int working by signing before aligning to create the signature nodes with their proper size and position, and then sign again as a final step if we had to inject any FDT_NOP tags. The attached fix works for me, creating valid signatures with aligned images no matter how many times I re-sign the FIT with different length signature comments. Downsides is the obvious double signing, which we already accept for resizing, and a build-up of FDT_NOP tags. The latter is only an issue if you re-sign with signature node size changes. And there's at most one tag added per fdt node per signature update, so it's hardly a major problem. Bjørn