[U-Boot] [PATCH] common: hash: fix crc32 verify

Joe Hershberger joe.hershberger at gmail.com
Tue May 5 19:25:26 CEST 2015


Hi Marcel,

On Tue, May 5, 2015 at 7:36 AM, Marcel Ziswiler <marcel at ziswiler.com> wrote:
> From: Marcel Ziswiler <marceli at ziswiler.com>
>
> did not work:
>
> Colibri T30 # crc32 0x80000000 0x100
> crc32 for 80000000 ... 800000ff ==> 9eb4f5ca
> Colibri T30 # crc32 -v 0x80000000 0x100 c9a057b3
> crc32 for 80000000 ... 800000ff ==> 9eb4f5ca != ffffffff ** ERROR **
> Colibri T30 # crc32 -v 0x80000000 0x100 9eb4f5ca
> crc32 for 80000000 ... 800000ff ==> 9eb4f5ca != 301eeead ** ERROR **
>
> now works again:
>
> Colibri T30 # crc32 0x80000000 0x100
> crc32 for 80000000 ... 800000ff ==> 9eb4f5ca
> Colibri T30 # crc32 -v 0x80000000 0x100 c9a057b3
> crc32 for 80000000 ... 800000ff ==> 9eb4f5ca != c9a057b3 ** ERROR **
> Colibri T30 # crc32 -v 0x80000000 0x100 9eb4f5ca
>
> Signed-off-by: Marcel Ziswiler <marcel.ziswiler at toradex.com>
> ---
>  common/hash.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/hash.c b/common/hash.c
> index c94c98b..7ae7c2f 100644
> --- a/common/hash.c
> +++ b/common/hash.c
> @@ -307,7 +307,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
>                         env_var = 1;
>         }
>
> -       if (!env_var) {
> +       if (env_var) {

This is clearly the wrong way to fix this issue since it breaks pretty
much every other aspect of hashing. Proper fix forthcoming.

>                 ulong addr;
>                 void *buf;
>
> --

-Joe


More information about the U-Boot mailing list