Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5111C433EF for ; Tue, 14 Sep 2021 22:45:57 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 19F0861155 for ; Tue, 14 Sep 2021 22:45:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 19F0861155 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 678F48200B; Wed, 15 Sep 2021 00:45:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="FF9ks0ts"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7EAA280EC5; Wed, 15 Sep 2021 00:45:00 +0200 (CEST) Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 230728200B for ; Wed, 15 Sep 2021 00:44:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72a.google.com with SMTP id m21so1273361qkm.13 for ; Tue, 14 Sep 2021 15:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=3h5iG2YcwkoAXvzf3kjxS1DYFtckwK2hfSlFQw2JdAg=; b=FF9ks0ts3VTUWWgQY21BEbF7B8+RCK3r2aH4E4i/hmKnzdPLqUM8Pj0AXtTUezusQC lw/vsYaD8gOz0WOL5xfQKwTcYTg0d/QaMPlomixiAQo4IOvOSbzwd4YucbeLc8IlbOk/ PziDk7RrCTpNTEVtuMuYaefY+2SwwuTTbUV4Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3h5iG2YcwkoAXvzf3kjxS1DYFtckwK2hfSlFQw2JdAg=; b=07iou9kEdLvdq1Q4hhTZiH5QRrM9KVSOSvzWIgjqRq5rEMZeHEtGUBvqXUrIG0ie2K u1Dk0oHobx6Aoerfa46ABM9vTXy3sP0FvQYGZeOuKKPiH7COnNOhAnhDV852wQOf2HMS tSOsiAvPR24uXlEHow/Nzf3QyjHqD3u15MVYobKaeqFaoLvI+N5H6d1XGvYcYPjUmU9A c4TfZB2/RHhFVQDFmOsG4f8yot+LDtfYyl00y/DhprU/0+eQaAjXjGSD5hTdcrR5JlIo 6O4/cxNdjDjQPkJhaDi7YlH14qOgC1ifFnt41JEw6HfcujyC2QqPKGc4eWsIesemvMC7 Xs5A== X-Gm-Message-State: AOAM531rsqCI22m89gXzZi9rZosdL9hcuGal8AVN6RxcfKMPbJxIUa7G MoI+IxjnIpZapA6QtDXfjo7loA== X-Google-Smtp-Source: ABdhPJxAhbReEroVdRX85aZI1Pp+3/MLsGDYyTLXIjK4vhzh8m3Z1gxZaz6edSaKsduEe9bgSAkNNg== X-Received: by 2002:a05:620a:1210:: with SMTP id u16mr7302836qkj.390.1631659484736; Tue, 14 Sep 2021 15:44:44 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-682c-a086-e3f8-65b4.res6.spectrum.com. [2603:6081:7b01:cbda:682c:a086:e3f8:65b4]) by smtp.gmail.com with ESMTPSA id u13sm8530670qki.38.2021.09.14.15.44.43 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Sep 2021 15:44:44 -0700 (PDT) Date: Tue, 14 Sep 2021 18:44:42 -0400 From: Tom Rini To: Alexandru Gagniuc Cc: u-boot@lists.denx.de, marex@denx.de Subject: Re: [PATCH] image: Avoid erroneous double byte-swap in CRC value Message-ID: <20210914224442.GQ12964@bill-the-cat> References: <20210914205333.3519115-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qtRU5Vj7VSlupYLV" Content-Disposition: inline In-Reply-To: <20210914205333.3519115-1-mr.nuke.me@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean --qtRU5Vj7VSlupYLV Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 14, 2021 at 03:53:33PM -0500, Alexandru Gagniuc wrote: > The hash algorithm selection was streamlined in commit 92055e138f28 > ("image: Drop if/elseif hash selection in calculate_hash()"). Said > commit kept the call to cpu_to_uimage() to convert the CRC to big > endian format. >=20 > This would have been correct when calling crc32_wd(). However, the > ->hash_func_ws member of crc32 points to crc32_wd_buf(), which already > converts the CRC to big endian. On a little endian host, doing both > conversions results in a little-endian CRC. This is incorrect. >=20 > To remedy this, simply drop the call to cpu_to_uimage(), thus only > doing the byte-order conversion once. >=20 > Fixes: 92055e138f28 ("image: Drop if/elseif hash selection in > calculate_hash()") > Tested-by: Tom Rini > Signed-off-by: Alexandru Gagniuc Applied to u-boot/master, thanks! --=20 Tom --qtRU5Vj7VSlupYLV Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFBJdoACgkQFHw5/5Y0 tywgzwv/TO+h71M0u4JTBO5mTpZRkIlI2/coa8rb3qhR9MHVSJu4H1SnaDALfWDm zpNNwjOX+l4Ky4pp6jiYhvokGE9M5vUmtFaZdlKG7sBGFebDIhOE4k6VoKwj5+ZS r2EBHgNWJkUyQA00xlbrt/PQ1C/8bgkChRd+Vmm7uNChjf5GFbD7wYHa9wSI5NJX 4gbMxmigISeQdTS/+CdDiK6esQOGiLg7gcqVpcvCL3F4ysNgsIUr+BeMiHqE3boV nSRLAzCdsjmbTkr7ieR/aF5UXJgHkoraaNutyrQNuoLaxHU28ywcwSe+kyZb+XqD 89yHc2bXoJV69cWm9VTwyEBMZIWL3ZfAZz84Pc4qlhfBZpjZ9TjvEBmhGiIr5Y6x 4GCB3faklsGqszSg0V9GXFV3HXUmfL/ARXEp4qOUoneuTnOEwgUWQEkg/MNPoZFY AiU3AgDb6JgMQ7bMMx81ST4OGzlhA7Ok4/qkoDZpYQUArUZNmfBMQa6Yj/mq/dWm 37sCZDQ3 =U+vi -----END PGP SIGNATURE----- --qtRU5Vj7VSlupYLV--