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 60735C7EE2E for ; Wed, 31 May 2023 13:37:55 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1267E8471B; Wed, 31 May 2023 15:37:53 +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="sT3Z0Opp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8AFC38471C; Wed, 31 May 2023 15:37:51 +0200 (CEST) Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) (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 3632884702 for ; Wed, 31 May 2023 15:37:48 +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-x1135.google.com with SMTP id 00721157ae682-565ba53f434so67954957b3.3 for ; Wed, 31 May 2023 06:37:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1685540267; x=1688132267; 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=2JmZKLW8f/IGgV7oEX52tehRlWLRGP8JtR2ifT86yhg=; b=sT3Z0OppSf28lOjm4V/ilkXYyPeDFXLQwU4V8bLeb0H8a9TvvK3WxUW9VD51GMH1BK p2bn4ukyFJ/hdPOQd74NYeAVrfdsEdmXZ7KMo3quMvWTmEnLKXYt74PX6mVh0A8fjZC0 Y+HNsu08G9xcFwvRrRPfR5TwfhoCSIF9DnDQY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685540267; x=1688132267; 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=2JmZKLW8f/IGgV7oEX52tehRlWLRGP8JtR2ifT86yhg=; b=BtFh/Q0hyiwXlaj76rb0hAZhNwuCxa82881BD3GFeoSgoGXih8zykUgQiz99b1fpcS dEMyAQniFYPT6KhOBgBC/dIXm5gOJEuadSSrJT2uZ90CE7PBFGxwdAHPUDixrjMusuAE C8Wu1JN5e58fSJ5DAAdfXp3ZAy2FEDgfu6+xY8du5cH3OtKnRy9W37KM4/8TEIOe8C3Y 7MYJhvIWqq9lzHwaR2Q7cWhOQSDaMVg4b4uu3GYkcY4puiu6ZYDPb3saE293XUu48D5d l42Vf00eOyp/VvfULPU4bVkkcLIXttP5uOJLDTwh1eOeY9UyNUh3wpRLoAeeLLQfBBgn aUCA== X-Gm-Message-State: AC+VfDzK5ok/pa5KfPz/EjtPLF87B6gUhp0i5NfrUf91w+SScU5QNPuT rAIkDv8QLibJm5USkIE8gmLCmg== X-Google-Smtp-Source: ACHHUZ6OaYoYhCcOX7HLCpSIrhyeXS86Qst1+z5ZMEys4p+TU55aN3yhp9IX5D3xLTyl2B/INIEz9A== X-Received: by 2002:a0d:d741:0:b0:565:dff1:d1e2 with SMTP id z62-20020a0dd741000000b00565dff1d1e2mr6630432ywd.18.1685540266848; Wed, 31 May 2023 06:37:46 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-8b9c-1483-01ee-fc93.res6.spectrum.com. [2603:6081:7b00:6400:8b9c:1483:1ee:fc93]) by smtp.gmail.com with ESMTPSA id f4-20020a0ddc04000000b0054f9e7fed7asm1738020ywe.137.2023.05.31.06.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 06:37:46 -0700 (PDT) Date: Wed, 31 May 2023 09:37:44 -0400 From: Tom Rini To: Manorit Chawdhry Cc: Pegorer Massimo , "u-boot@lists.denx.de" , Praneeth Bajjuri , Andrew Davis , Vignesh Raghavendra , Udit Kumar , Simon Glass , Kamlesh Gurudasani Subject: Re: R: Fit Signature booting without public key Message-ID: <20230531133744.GX3755309@bill-the-cat> References: <20230516064124.n2qd4dununi2bymx@ula0497581> <20230516153006.GG2398826@bill-the-cat> <20230525055144.5p7fpqmckhmzwtjm@ula0497581> <20230525140528.GL3218766@bill-the-cat> <20230526085238.cm3ew67d7awqheiq@ula0497581> <20230526125958.GB3755309@bill-the-cat> <20230531043034.wrz74qytu7gmg4fo@ula0497581> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="VBTNM53YMY+6WOxW" Content-Disposition: inline In-Reply-To: <20230531043034.wrz74qytu7gmg4fo@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 --VBTNM53YMY+6WOxW Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 31, 2023 at 10:00:34AM +0530, Manorit Chawdhry wrote: > Hi, >=20 > On 16:51-20230530, Pegorer Massimo wrote: > > Hi, > >=20 > > > Inviato: venerd=EC 26 maggio 2023 15:00 > > > Oggetto: Re: Fit Signature booting without public key > > >=20 > > > On Fri, May 26, 2023 at 02:22:38PM +0530, Manorit Chawdhry wrote: > > > > Hi Tom, > > > > > > > > On 10:05-20230525, Tom Rini wrote: > > > > > On Thu, May 25, 2023 at 11:21:44AM +0530, Manorit Chawdhry wrote: > > > > > > Hi Tom, > > > > > > > > > > > > On 11:30-20230516, Tom Rini wrote: > > > > > > > On Tue, May 16, 2023 at 12:11:24PM +0530, Manorit Chawdhry wr= ote: > > > > > > > > > > > > > > > Hi All, > > > > > > > > > > > > > > > > I recently came upon a discussion that had happened a while= back > > > [0]. > > > > > > > > I want to continue the discussion as I believe the issue st= ill > > > > > > > > persists and the checks around fit signature booting are st= ill > > > > > > > > the same, that allows booting the fit without changing the = uboot > > > dtb. > > > > > > > > > > > > > > > > Allowing the signed fit image without this seems to be a > > > > > > > > bypass that is available and should not be allowed without = any > > > > > > > > gate to it for people 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 belie= ve this > > > should be fixed as soon as possible. > > > > > > > > > > > > > > > > [0]: > > > > > > > > https://u-boot.denx.narkive.com/dEClg9dW/signed-fit-image-b= oot > > > > > > > > s-without-public-key > > > > > > > > > > > > > > Yes, can you please reproduce the issue in question on the > > > > > > > current tree, with a supported platform and provide the > > > > > > > defconfig and steps you used for this issue? Thanks. > > > > > > > > > > > > > > -- > > > > > > > > > > > > I've created a branch with some custom patches to make the > > > > > > fitimage booting currently, please try with the branch and the > > > > > > fitimage that are also committed [0]. > > > > > > > > > > > > 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 > > > > > > changes but for reference the SDK documentation can help if req= uired > > > [1]. > > > > > > > > > > > > Attached the logs for reference with the signed fitimage and an > > > > > > unsigned uboot without any modifications[2]. > > > > > > > > > > > > [0]: https://github.com/manorit2001/u-boot/tree/fit-image-poc > > > > > > [1]: > > > > > > https://software-dl.ti.com/jacinto7/esd/processor-sdk-linux-jac= int > > > > > > o7/08_06_00_11/exports/docs/linux/Foundational_Components/U- > > > Boot/U > > > > > > G-General-Info.html > > > > > > [2]: > > > > > > https://gist.github.com/manorit2001/3c49cfc19bf937783efb75fd4cd= dc5 > > > > > > 8f > > > > > > > > > > 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 sign= ed > > > > > FIT configurations and unsigned ones should not boot. > > > > > > > > > > > > > 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 > > Which uboot behaviour would you expect? If uboot is missing of the publ= ic key, it has no way to check signatures. Therefore either it boots everyt= hing (signed and unsigned) or it boots nothing (signed and unsigned). The s= econd means it would be totally useless. So the first seems the only reason= able behaviour, IMO. > >=20 >=20 > I would actually expect it to through some errors telling about all this > instead of silently booting it, if the configurations of the dtb and the > signing ain't proper I don't believe there is any way to know about any > of this as it just boots up without any hint about it whatsoever, I > believe if this is enabled then there should atleast be an optional > config that allows people to get their environment right for validating > all this. Right. With the correct set of options you should be able to enforce only booting signed images. I thought that test/py/tests/test_vboot.py covered this combination as well, but if it's not it should be updated to. --=20 Tom --VBTNM53YMY+6WOxW Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmR3TaUACgkQFHw5/5Y0 tyxDFwv/ZlY6IdKTwA+EgKVHgI2JJ7ndIrCShBHmWL3iPc+Or2zcjJV0cYZa8fqe fR82FvkPQ1cCu4v0ivHi2Me0r3CDXIQNAabvkA7M320jn12tkgeXdAaoSz1nFhTy 0+8FVyQBGiVJt3VyVXnrk0NCfkl3DsMOcHvIHk52ToTWzsTy4Aelwm8Nla6LM5++ PzN8LHkU1M2heGYNMuHBXRl8Pq0WJz1X49SMoMQ+LTlefeJrkVvR7VQpFOTB5eKL uKq6L9E2CDZ8rt1WgMHTe1xvw+QGRztWdc+MmUov11NFwj6Agg/0UUg4YI/hOt7L QpiZDqQQp4u3YYJU0x40HXwYgiyQciw8/yDLxydc80FkM7FjJ4ejh0p5BJNqi272 BMET2rjUmef3k/ogogl8/87gTaj55zoP5U1IGtIs/uxTG8qC9T938VLpv7LpNn7o 0WYseEoNnkduDn3NeLho5RgHHJFXVA5z5i1Xx1eWym7psu7hhFTsrbM/MPe3aaPq PYZ+gQ7+ =x59J -----END PGP SIGNATURE----- --VBTNM53YMY+6WOxW--