diff mbox

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

Message ID 82cc95f6ad0d43e2b9567fa1c2441fef5c9f9c3f.1430828841.git.marcel@ziswiler.com
State Rejected
Delegated to: Joe Hershberger
Headers show

Commit Message

Marcel Ziswiler May 5, 2015, 12:36 p.m. UTC
From: Marcel Ziswiler <marceli@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@toradex.com>
---
 common/hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Joe Hershberger May 5, 2015, 5:25 p.m. UTC | #1
Hi Marcel,

On Tue, May 5, 2015 at 7:36 AM, Marcel Ziswiler <marcel@ziswiler.com> wrote:
> From: Marcel Ziswiler <marceli@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@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
Marcel Ziswiler May 6, 2015, 6:30 a.m. UTC | #2
On 5 May 2015 19:25:26 CEST, Joe Hershberger <joe.hershberger@gmail.com> wrote:
>This is clearly the wrong way to fix this issue since it breaks pretty
>much every other aspect of hashing. Proper fix forthcoming.

I admit that I don't know nothing about any of that hashing stuff off late but it is crystal clear that Nikolay's patch simply broke the crc32 verify we were using for years.
diff mbox

Patch

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) {
 		ulong addr;
 		void *buf;