• Maxime Ripard's avatar
    fel: Check the U-Boot's CRC instead of its size · e753821e
    Maxime Ripard authored
    
    
    The current code checks that the transferred size is matching the size
    reported in the image header.
    
    Unfortunately, the transferred image might be padded, which doesn't change
    anything at the functional level, but will make that check trigger since
    the actual image will be smaller than the transferred data.
    
    Change that logic to first check that the transferred size isn't less that
    the header image size, which will still be an error, and then check for the
    CRC of the image itself. This will prove to be an more robust integrity
    check than what we have right now anyway.
    
    The CRC used in the image header is the CRC32 algorithm, that is
    implemented in the zlib, which is installed on most devices on the planet,
    so we can just use that implementation instead of rolling our own.
    Tested-by: default avatarFrank Kunz <mailinglists@kunz-im-inter.net>
    Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
    e753821e
fel.c 42 KB