From mboxrd@z Thu Jan 1 00:00:00 1970 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 67B24C433F5 for ; Tue, 14 Sep 2021 13:07:26 +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 46B4061056 for ; Tue, 14 Sep 2021 13:07:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 46B4061056 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 70AFB81468; Tue, 14 Sep 2021 15:07:21 +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="FK3ZCilL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D67381E14; Tue, 14 Sep 2021 15:07:19 +0200 (CEST) Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) (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 34551812B6 for ; Tue, 14 Sep 2021 15:07:15 +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-qv1-xf2b.google.com with SMTP id w9so8339541qvs.12 for ; Tue, 14 Sep 2021 06:07:15 -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=xKjzNVHRb26jF6bC/y0u65yUg3Z0Kk32hlxfN2+TAqw=; b=FK3ZCilLqlEcF71jqAot2Q2tFLnhsDVQjRFcBV/QLCgt+Hdg7g1GzSE9DV/lEh5rea HUQR9zng5V9OWlF/wBV/O0V6mK6Lu7supQA01n9loKOVFqnROC0pE3b+0BTqLhJTNRCB S5jJXTli4KUJoP3uBgLKAzLpoW115bu/+zInc= 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=xKjzNVHRb26jF6bC/y0u65yUg3Z0Kk32hlxfN2+TAqw=; b=Ccp4DbIEQ7snrwKv8eME9U3zHWSeJPe08AJXPRPyOfjy15AqnkS0JCaMGlk10Yxv2J vHrdFuNuzlkIDzG4/sLEpiBQdTfizCdSaGCl2eMZghIcL5oPKnOITzd1l5NY7EJgohD+ ea4sEj9Aijb2z0Z+LXEictmTR0dSfWLeSZ4IwKgttf7wJl9JkWVwCGUMI/wVDBeX0+fA YU9CTr1hj8WNDDOaNd2pYXRCJ6E+KG0Uko6LJ/8u+ZORzXNkPUCcp2ixs/DPCx26Tiji f0COf5hMBDKeHGJPw0TLhDCfNd7u0Sgl9VWV4C5Q1w1WkYAlDlrygfGvuEAq4yJSYuhK Eqvw== X-Gm-Message-State: AOAM533dmj6mNY3V7ZcosUfv2IfOISFEEmGMLVCvxZ1PMPSV1/u/68PZ Wk41W4n8EyJgtwcjDfo416FzHQ== X-Google-Smtp-Source: ABdhPJxPkCyeGacW88185Gcva7dIzp4sYSf02ykpgNHr0wx2xzzncRa49z2g/J0Y1QWX6HKiIcZrcg== X-Received: by 2002:ad4:456c:: with SMTP id o12mr5242712qvu.12.1631624833755; Tue, 14 Sep 2021 06:07:13 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-bdd8-2e2f-c73c-581f.res6.spectrum.com. [2603:6081:7b01:cbda:bdd8:2e2f:c73c:581f]) by smtp.gmail.com with ESMTPSA id p187sm7636385qkd.101.2021.09.14.06.07.12 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Sep 2021 06:07:13 -0700 (PDT) Date: Tue, 14 Sep 2021 09:07:11 -0400 From: Tom Rini To: Mathew McBride Cc: u-boot@lists.denx.de, Alexandru Gagniuc , Simon Glass Subject: Re: [PATCH] image: fit: fix byte order for crc32 hash check Message-ID: <20210914130711.GF12964@bill-the-cat> References: <20210914063141.28737-1-matt@traverse.com.au> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="aBeuU+MSqwKaVp2q" Content-Disposition: inline In-Reply-To: <20210914063141.28737-1-matt@traverse.com.au> 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 --aBeuU+MSqwKaVp2q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 14, 2021 at 06:31:41AM +0000, Mathew McBride wrote: > In 92055e138f ("image: Drop if/elseif hash selection in calculate_hash()") > the FIT image hash verification code was simplified to use the hash API. >=20 > This broke verification of CRC32 hash FIT images (e.g NXP MC firmware) > as the hash API crc32 calculates in big endian (refer commit > 74a18ee8a563, "crc32: Correct endianness of crc32 result"), whereas > the previous call directly to crc32_wd does not do a byteswap. >=20 > Example: > dumpimage -l qoriq-mc-binary/ls1088a/mc_ls1088a_10.29.1.itb > FIT description: MC Firmware > Created: Fri Aug 27 14:14:32 2021 > ... > Hash algo: crc32 > Hash value: c09d959c > Was returning FB9D3710 to fit_image_check_hash instead of C09D959C >=20 > Correct the byte order in the crc32_uimage_fixup so the little endian > values are returned. >=20 > Fixes: 92055e138f "image: Drop if/elseif hash selection in calculate_hash= ()" > Signed-off-by: Mathew McBride Good catch. However: sandbox: w+ sandbox +(sandbox) *((uint32_t *)value) =3D ntohl(*((uint32_t *)value)); +(sandbox) ^~~~~ +(sandbox) atoll w+(sandbox) tools/../common/image-fit.c: In function =E2=80=98crc32_uimage_= fixup=E2=80=99: w+(sandbox) tools/../common/image-fit.c:1201:25: warning: implicit declarat= ion of function =E2=80=98ntohl=E2=80=99; did you mean =E2=80=98atoll=E2=80= =99? [-Wimplicit-function-declaration] --=20 Tom --aBeuU+MSqwKaVp2q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFAnnsACgkQFHw5/5Y0 tyzdHwwApkCkp0bkIWl4L98AMDFsggtxccVR6PHr69LY2D+WCwvJr9hvTk21JcwI q8fdWHscQZlvCPWC6TNNdSBDAM1X0iL3814SAA0cCcR2VVAC//Ctey051/IT3qcw 75Gnf6tC+314a5AobO8nCVg46SXcnyNoTDmdi37fDnxP1dlp5IgdnxJYBNviE3PS 8kDL/Riw+FQKFQM7kuV0nj+Wj1g6wNhGlAozVLUAr+aaFr5cMJ38lJ2vmNnIOUrE rk0wmQvyAxT9aq+86+TEYIIb0a6Ts4y5Bz5HKVm9L/SQyeSknbPTo/4xyvyJasXG W6ASBJ1jS9k0u/Y5gBS6WdeBQnrHk5P5ozXUt7SvgjVeIGSnn4YS8SpyiVNuVkrG dpwillMyXITSNlMAONam8wxlNu8NDuoldlan8TEJOJEyAhyePI2oP2KOdjoPo4Gx OYdyguUBAmJ8WaMnEKcHPc5qER+BXY4VsZcKMCrZ8s9Wgr4zUD2ljibGoJvSvHdc sdsmdTdV =RTRW -----END PGP SIGNATURE----- --aBeuU+MSqwKaVp2q--