Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4E0A4C77B7A for ; Fri, 26 May 2023 13:00:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8409E86144; Fri, 26 May 2023 15:00:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (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="iOHr9tBs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5AB2A86153; Fri, 26 May 2023 15:00:26 +0200 (CEST) Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) (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 D6D7C846F5 for ; Fri, 26 May 2023 15:00:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-561c1ae21e7so12021947b3.0 for ; Fri, 26 May 2023 06:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1685106001; x=1687698001; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9QXljVqzp2ZHWkctJ9hrAq7/QcYuHDGSXQJtHpjBp0A=; b=iOHr9tBsItHbfNnefLFg2CqBOeoFl8gNhL4m1HsJ8KvVJFnNhr2wLJywtsCg5SFgjQ z1+Qx9gJSibgxOWc/PKRciMUWOzocCo+IJ7nys+YxYqS8CHcQU8a9HJuujDHGmIWa+Oo IA2krVgt8YVPFSrCi1GNExylGKN/Z4CAs6LoE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685106001; x=1687698001; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9QXljVqzp2ZHWkctJ9hrAq7/QcYuHDGSXQJtHpjBp0A=; b=ZrLBymnAgp+GGbaQfGsr6rHtwhfyvJD4I9hC6mYsNEsiR3uCMyk0x2errLiwjc1Aiq syYtatPJ+/KoU9AyCiGNhzSh+uUgvshOV7nID3RVFDinkPtCakkyhUPewJl7mS/HtxLn kSa/mjkp+YigoJakM0o9xV4t34Sb6bKjbjfbeqeYnAApFidoPLIwr8uwS4NjvNaAhzqX 3VXKljcDwwso+iUmfKhf3l3fUDN9XgfZRYyOiK/aznkuYQ6g40fIM5FdDxYWZ6Hi1Lt+ zBddJHp2/82UYnYLfYnnviKFl+KPrlKTPDJD9fae3ydSj3JqAqz0NzkMI4fcUcJXSy68 diFg== X-Gm-Message-State: AC+VfDxGbbmEuwVsMn9Yl32E3f43NNQN4wVjk7fcPTzUYJA4QQ5a2yXU 4P9SWGlHHb13D+T62mDM+PfIjQ== X-Google-Smtp-Source: ACHHUZ5oEjoqmqRYIK0UhdXU3PswkE2bCibSstPGnuFBjKzu9pedCPf3FbeCM4mvlHQhJhoKfLTyMA== X-Received: by 2002:a81:48d0:0:b0:559:ea89:7c2c with SMTP id v199-20020a8148d0000000b00559ea897c2cmr1830430ywa.33.1685106001004; Fri, 26 May 2023 06:00:01 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-4152-7489-2ff8-2fb9.res6.spectrum.com. [2603:6081:7b00:6400:4152:7489:2ff8:2fb9]) by smtp.gmail.com with ESMTPSA id j191-20020a8192c8000000b00561e67c9d7csm1165924ywg.38.2023.05.26.06.00.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 May 2023 06:00:00 -0700 (PDT) Date: Fri, 26 May 2023 08:59:58 -0400 From: Tom Rini To: Manorit Chawdhry Cc: u-boot@lists.denx.de, Praneeth Bajjuri , Andrew Davis , Vignesh Raghavendra , Udit Kumar , Simon Glass , Kamlesh Gurudasani Subject: Re: Fit Signature booting without public key Message-ID: <20230526125958.GB3755309@bill-the-cat> References: <20230516064124.n2qd4dununi2bymx@ula0497581> <20230516153006.GG2398826@bill-the-cat> <20230525055144.5p7fpqmckhmzwtjm@ula0497581> <20230525140528.GL3218766@bill-the-cat> <20230526085238.cm3ew67d7awqheiq@ula0497581> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Nk/MM/+fOiOOdmRP" Content-Disposition: inline In-Reply-To: <20230526085238.cm3ew67d7awqheiq@ula0497581> X-Clacks-Overhead: GNU Terry Pratchett X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean --Nk/MM/+fOiOOdmRP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, May 26, 2023 at 02:22:38PM +0530, Manorit Chawdhry wrote: > Hi Tom, >=20 > On 10:05-20230525, Tom Rini wrote: > > On Thu, May 25, 2023 at 11:21:44AM +0530, Manorit Chawdhry wrote: > > > Hi Tom, > > >=20 > > > On 11:30-20230516, Tom Rini wrote: > > > > On Tue, May 16, 2023 at 12:11:24PM +0530, Manorit Chawdhry wrote: > > > >=20 > > > > > Hi All, > > > > >=20 > > > > > I recently came upon a discussion that had happened a while back = [0]. > > > > > I want to continue the discussion as I believe the issue still pe= rsists > > > > > and the checks around fit signature booting are still the same, t= hat > > > > > allows booting the fit without changing the uboot dtb. > > > > >=20 > > > > > Allowing the signed fit image without this seems to be a bypass t= hat is > > > > > available and should not be allowed without any gate to it for pe= ople > > > > > who'd like to enforce these signing checks. Let me know if there = is a > > > > > config already available for it and if not, are there any plans to > > > > > enable such a config in future. Would like to hear your opinions = on > > > > > this as I believe this should be fixed as soon as possible. > > > > >=20 > > > > > [0]: https://u-boot.denx.narkive.com/dEClg9dW/signed-fit-image-bo= ots-without-public-key > > > >=20 > > > > Yes, can you please reproduce the issue in question on the current = tree, > > > > with a supported platform and provide the defconfig and steps you u= sed > > > > for this issue? Thanks. > > > >=20 > > > > --=20 > > >=20 > > > I've created a branch with some custom patches to make the fitimage > > > booting currently, please try with the branch and the fitimage that a= re > > > also committed [0]. > > >=20 > > > The devices that I've tested this with is j721e-hs-evm, the defconfig= to > > > use for the builds are j721e_evm_r5_defconfig and > > > j721e_evm_a72_defconfig. Although not synced up with the latest chang= es > > > but for reference the SDK documentation can help if required [1]. > > >=20 > > > Attached the logs for reference with the signed fitimage and an unsig= ned > > > uboot without any modifications[2]. > > >=20 > > > [0]: https://github.com/manorit2001/u-boot/tree/fit-image-poc > > > [1]: https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-jaci= nto7/08_06_00_11/exports/docs/linux/Foundational_Components/U-Boot/UG-Gener= al-Info.html > > > [2]: https://gist.github.com/manorit2001/3c49cfc19bf937783efb75fd4cdd= c58f > >=20 > > I don't see the problem there, but please go and investigate what > > problem you're seeing. The intention is that yes, with the appropriate > > CONFIG settings, you can set U-Boot to only boot signed FIT > > configurations and unsigned ones should not boot. > >=20 >=20 > It boots with an unsigned fit too btw for reference [0]. The whole > logic behind the authentication is that uboot stores the public key that > is used for verification of the signed fit but apparantely if I haven't > kept the public key in uboot dtb the fit images still boot whether > signed or unsigned as that check is not guarded by anything if you see > in the codebase[1]. >=20 > [0]: https://gist.github.com/manorit2001/80c9242641141ac5bce0e335ea8a9f1a > [1]: https://github.com/u-boot/u-boot/blob/6dcee70692601bd3296c86ac07d031= 7bf06d2b7b/boot/image-fit-sig.c#L491-L496 Alright, please let us know what you find as indeed if you've set all the right options it's not supposed to boot unsigned images. --=20 Tom --Nk/MM/+fOiOOdmRP Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmRwrUoACgkQFHw5/5Y0 tyz90AwAnqHfN9uAuiLu6Rq8YB8HQR+oVdExu20ikKmw4d3Mpho4/TcY+KF/yqMM LBcQkrLwHlr77GSiUYcZbT5QmKvmJOjjmw4t75Dmpyoaj7rPxTUUHy5Bmjr8tlrM 6spWtwLiu5STNnswQvvLXNwHS9X8pjDzL6Z5HMAm5PtF40PNilPjw9HdBQd8OpS0 F3yIYLUM56UGz/32heKoxJLetLnWe0tRVkZTSjfcnAElc/WOEQ1kgPJLGBjxEnUv RI4PxoST99bNUnJwZpNWHacSB/aLl8wACmL8h7b66NnfJupAeVWW3eNAL+75C3jt C2BKN0El9y7x0ihg926LBUlXVYgu1AqUGNJ+De/d3eqEoAQQX2veY8V0XRJZdxfx 3reskY00t3GZZEiU4oZiZainx+Xkvk3y5I3EJv5G1hLsp2edO4sOHjT8l87SCOgM vLuJ/gBCK5EG8sVdvoJkm+lpJR3qib8OEsyIxCVJdi2K6CeaJHcCwuUd9M5cM2W5 svQzek4Z =9Hk9 -----END PGP SIGNATURE----- --Nk/MM/+fOiOOdmRP--