From patchwork Tue Feb 6 22:31:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895928 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTyfn09zkz23gM for ; Wed, 7 Feb 2024 09:32:17 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BFACD87C93; Tue, 6 Feb 2024 23:32:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id AE009876AE; Tue, 6 Feb 2024 23:32:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 CE3E2876AE for ; Tue, 6 Feb 2024 23:32:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-5114a21176cso1355733e87.1 for ; Tue, 06 Feb 2024 14:32:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258720; x=1707863520; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SNjPCCwE4bQz2Zn/IhDIXv3ByYtXVT9kgvh3YH/mlbQ=; b=GJI/VJUztG01U2sK6jkvTO8IYRa5R/kMcLsJYcxt7rG1a2b/E9Kk8/zKZL38SKy7At GqtOtqvBVSavO0SRoN++wAd1yzlIFqbhR3Q8yVsxS8acK45ySkIyZ165atksA3Rw8KLn JSVXN4604GAKGtrxVLwnYAqGb8IgdCLSzGPqX8szO2N2E8VKj3T/OXi3wxvmju2YEf6g aEDdyLdn3Cz2XOZPlZn5lgP5m+Qbs02q3i2AWe0YwmATUNQmiJ+FdrtCKHOiBrykDS8X EeC5wZX8slcLv2TEg3mZ0ExR6a+6SiznS4PvhYBIskHXpe2FBgKExiGzvjMaqq6LLest YvDg== X-Gm-Message-State: AOJu0YziRw0Oi/UTlCSBQL13iXSBz1yGINV0YL4DtME7iOkKuIvBL+Wf df9cVBrHJhq5cEjQN8sFLDHe2Mss2BcKpO8nkDl7SFzEkJPRAvnDs4buLvYPzznm1A== X-Google-Smtp-Source: AGHT+IH5+dL8B47JiqgOGUKbHayn9BdCsotxcLTXn5sYYzR/u3iAa2VZ9a5a+UjphBalK//aDrSDcg== X-Received: by 2002:a05:6512:511:b0:511:5b35:d119 with SMTP id o17-20020a056512051100b005115b35d119mr2199921lfb.2.1707258719430; Tue, 06 Feb 2024 14:31:59 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVR4qDyfnD//AINFxAwfrALCU802sHmkaiSQ8Geix0XJlED2DFnrBO0ZeH4USdU0bAMfpqCGzpOm+Zbjwcm9BINXGSZU1VDFj7TuCsBY1xoI9PlQ2p4aptMKdRtHMMutvQQzuPb3S8f7Juh0FVdj8rNdlXXapzxVvUfMj2r+IuYZ9AVrYVUVSJCox9IKd+O6mg= Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id v10-20020a05651203aa00b005113abb16fdsm356005lfp.284.2024.02.06.14.31.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:31:58 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Ivan Khoronzhuk , Jens Wiklander , Tom Rini Subject: [PATCH v1 1/7] common: avb_verify: don't call mmc_switch_part for SD Date: Tue, 6 Feb 2024 23:31:47 +0100 Message-Id: <20240206223153.3060433-2-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk mmc_switch_part() is used for switching between hw partitions on eMMC (boot0, boot1, user, rpmb). There is no need to do that for SD card. Signed-off-by: Igor Opaniuk Reviewed-by: Mattijs Korpershoek --- common/avb_verify.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index 48ba8db51e5..59f2c25e0de 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -358,9 +358,11 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition) goto err; } - ret = mmc_switch_part(part->mmc, part_num); - if (ret) - goto err; + if (IS_MMC(part->mmc)) { + ret = mmc_switch_part(part->mmc, part_num); + if (ret) + goto err; + } mmc_blk = mmc_get_blk_desc(part->mmc); if (!mmc_blk) { From patchwork Tue Feb 6 22:31:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895929 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTyg95fKDz23gM for ; Wed, 7 Feb 2024 09:32:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A56E87CAE; Tue, 6 Feb 2024 23:32:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 0469987CAE; Tue, 6 Feb 2024 23:32:05 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 AC9E787C9E for ; Tue, 6 Feb 2024 23:32:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2d0a29b05bdso43821fa.0 for ; Tue, 06 Feb 2024 14:32:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258721; x=1707863521; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9zZwH6BQM59B0gBxxu+whM69P6e5AhJiPuMx0+4kdAk=; b=ZUG8Jlg1fJnC06mGPdOu+9kXnRUnGFB0ELN6+CbXoWTRvaddduruuHcMTiC5HZoYdP HEWPj3cx4tbdXZ9iylZbYURcvtXEcVeFM5CwH1f1TNq9jdFlWkgTb+k50uc1IZzaTnfa qE6Na8H68Rw5lZCXwNNaZbggyhO6b7tAuMVGEJT1Iqs4ttSUSA3u/uXI854xpIR/eEsL 1AmNSe3FDmk3sulzrr926/xzh80LtR6m44tCH6KZrNe/F/EaZ1sFWLr1lSyzYYzqS/Yz mWWF5TBkG0Lmxo9h08S50/+Xm7whd9kU3JxOIbI4iPmLVhD+wNF//jFL8xuqQ6RK3fgR /KNA== X-Gm-Message-State: AOJu0YwyArG3CGD9N6hc9QMTp41T/SQ8NC/WwDMuhlziMHW5mPpZdvJO IBc1Jf8s6XylINt5KLZyV4nv6/mNSe1Ut7BL4SUtMAcxHQgXxIeVhDzszfjw6f7Ilg== X-Google-Smtp-Source: AGHT+IHHNr5CY4UV6du1eTS+yyh3qwp5j8poFaVNjeVYn/mW70tKXhI3VOS2IGabJODOyS5cDymgQQ== X-Received: by 2002:ac2:5059:0:b0:511:4a03:9dc2 with SMTP id a25-20020ac25059000000b005114a039dc2mr2811667lfm.2.1707258721383; Tue, 06 Feb 2024 14:32:01 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUfgNa1F1f0s2loWFkFOpB9D4uFo6hH8J0KFTv/T9FCRU06lsWQsuc4zr/FN3r8ploNkz9al0sdQdwMhf0rtGAsRpxx3nEZvFLKCQkrVTF++Lvu6Kkwej1CqUdZ76KwUnPSy0XTdcBNqqxb5kFL+71SZ5H/yqr4Gw8qhQx6TB7gxgV604B9a8eqdRs4+pBNo0HyCWhQlNK+d6xHEOKjPpzEZi5GLvnawb1Y82xLyGSHcanRojUtmX1/yzu6jhgdb/NE3PRW2+oUwYYjbKnGCARWpNDgRBi5Ke7WHQCiqQ== Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id v6-20020a056512048600b0051140df84fdsm358462lfq.12.2024.02.06.14.32.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:32:00 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Ilias Apalodimas , Ivan Khoronzhuk , Jens Wiklander , Michal Simek , Qu Wenruo , Stefan Roese , Tom Rini Subject: [PATCH v1 2/7] avb: move SPDX license itdentifiers to the first line Date: Tue, 6 Feb 2024 23:31:48 +0100 Message-Id: <20240206223153.3060433-3-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk Move SPDX license identifiers to the first line, so it conforms to license placement rule [1]: Placement: The SPDX license identifier in kernel files shall be added at the first possible line in a file which can contain a comment. For the majority of files this is the first line, except for scripts which require the '#!PATH_TO_INTERPRETER' in the first line. For those scripts the SPDX identifier goes into the second line. [1] https://www.kernel.org/doc/Documentation/process/license-rules.rst Signed-off-by: Igor Opaniuk Reviewed-by: Mattijs Korpershoek --- cmd/avb.c | 4 +--- common/avb_verify.c | 3 +-- include/avb_verify.h | 4 +--- test/py/tests/test_android/test_avb.py | 3 +-- 4 files changed, 4 insertions(+), 10 deletions(-) diff --git a/cmd/avb.c b/cmd/avb.c index 783f51b8169..ce8b63873f2 100644 --- a/cmd/avb.c +++ b/cmd/avb.c @@ -1,8 +1,6 @@ - +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2018, Linaro Limited - * - * SPDX-License-Identifier: GPL-2.0+ */ #include diff --git a/common/avb_verify.c b/common/avb_verify.c index 59f2c25e0de..938a5383b5d 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -1,7 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2018, Linaro Limited - * - * SPDX-License-Identifier: GPL-2.0+ */ #include diff --git a/include/avb_verify.h b/include/avb_verify.h index 1e787ba6668..2fb850044d9 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -1,8 +1,6 @@ - +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2018, Linaro Limited - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _AVB_VERIFY_H diff --git a/test/py/tests/test_android/test_avb.py b/test/py/tests/test_android/test_avb.py index 238b48c90fa..865efbca4de 100644 --- a/test/py/tests/test_android/test_avb.py +++ b/test/py/tests/test_android/test_avb.py @@ -1,6 +1,5 @@ -# Copyright (c) 2018, Linaro Limited -# # SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2018, Linaro Limited # # Android Verified Boot 2.0 Test From patchwork Tue Feb 6 22:31:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895930 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTygC20LNz23gM for ; Wed, 7 Feb 2024 09:32:39 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B3BAB87CBC; Tue, 6 Feb 2024 23:32:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id AFFA187CB8; Tue, 6 Feb 2024 23:32:06 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 BFE3887CA6 for ; Tue, 6 Feb 2024 23:32:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-50e4e36c09cso1969874e87.1 for ; Tue, 06 Feb 2024 14:32:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258724; x=1707863524; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qoSGL2pMz2Mc9B6FrkXwxNRp9HPJjTOxLJGCotd54yM=; b=QNrrNCjpmThkSBvun7NpuJCosiShYXmTJD2GZGEcmUMC2TvQd3vV+qBBVfGuRDgx66 Y84B5jq2rfGsySK959Amot4n8GuPGKDBU3orVIsQudm06K1K9Uu7cjUKmhAI7coHj+rh 7xb2BV12xQ+3Lpt+o52r/LK/ZVq4vkC1cgw1bZg71oDKztT7a37/SgHAPs98xrt6+Hbt 7pss+eXAlzH0KdLsyEsdw+bY5tR0tIOzap0nmk+vL4HPiYskgzeUsIXTFTF8v0viwfTQ ltGnRp/by/x4CfloD3lEpiKrWHvIBRrZCzOJHI6Ljp0NXCJE8qD9l92XyvQqKUW2EEks tGQw== X-Gm-Message-State: AOJu0Yy6uMkZPcah9adxPRQC2tQDw3TSqSPggEfmAeatXZSa6IwZO6xg vTA1qbntfnRTdSAAfn361psd8RMF/xVY6Z87F2fVzvign9/GBTjTT+x4sESdK+5mGg== X-Google-Smtp-Source: AGHT+IFJirdchpjCZdQKaDWCFRt5pnv5IzUnNZtVtFjSV1SUaCyoTUFeLwETPXcCJekA/ziftS6/NQ== X-Received: by 2002:a19:5f12:0:b0:511:4881:1b78 with SMTP id t18-20020a195f12000000b0051148811b78mr2403384lfb.4.1707258723388; Tue, 06 Feb 2024 14:32:03 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCVB8KScDnjlIXAwlEBjt7VskdSEVgPQSvIoC/3kLs8qkZV3y5Xh3/DYIKpSW283arAanbbqmFN93iw54Y5Dn0ag6CV/WnOqwB5j7cbGS3vRsviBjySB5exOCb+m7fDGzagjJYXvJXQ14Wh7ga+LlSHP+Lnpd6eZSW8bCv5bT7REa0ooOnQpl+2GDfnuF65wsqY= Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id m2-20020a056512014200b0051145ebd75asm355331lfo.39.2024.02.06.14.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:32:02 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Ivan Khoronzhuk , Jens Wiklander , Tom Rini Subject: [PATCH v1 3/7] common: avb_verify: rework error/debug prints Date: Tue, 6 Feb 2024 23:31:49 +0100 Message-Id: <20240206223153.3060433-4-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk Make error prints more verbose with additional context. Also s/print/debug/g for prints, which might be relevant only for debugging purposes. Signed-off-by: Igor Opaniuk Reviewed-by: Mattijs Korpershoek --- common/avb_verify.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index 938a5383b5d..ed58239cf8a 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -279,9 +279,9 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part, * Reading fails on unaligned buffers, so we have to * use aligned temporary buffer and then copy to destination */ - if (unaligned) { - printf("Handling unaligned read buffer..\n"); + debug("%s: handling unaligned read buffer, addr = 0x%p\n", + __func__, buffer); tmp_buf = get_sector_buf(); buf_size = get_sector_buf_size(); if (sectors > buf_size / part->info.blksz) @@ -320,7 +320,8 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, if (unaligned) { tmp_buf = get_sector_buf(); buf_size = get_sector_buf_size(); - printf("Handling unaligned wrire buffer..\n"); + debug("%s: handling unaligned read buffer, addr = 0x%p\n", + __func__, buffer); if (sectors > buf_size / part->info.blksz) sectors = buf_size / part->info.blksz; @@ -348,30 +349,35 @@ static struct mmc_part *get_partition(AvbOps *ops, const char *partition) dev_num = get_boot_device(ops); part->mmc = find_mmc_device(dev_num); if (!part->mmc) { - printf("No MMC device at slot %x\n", dev_num); + printf("%s: no MMC device at slot %x\n", __func__, dev_num); goto err; } - if (mmc_init(part->mmc)) { - printf("MMC initialization failed\n"); + ret = mmc_init(part->mmc); + if (ret) { + printf("%s: MMC initialization failed, err = %d\n", + __func__, ret); goto err; } if (IS_MMC(part->mmc)) { ret = mmc_switch_part(part->mmc, part_num); - if (ret) + if (ret) { + printf("%s: MMC part switch failed, err = %d\n", + __func__, ret); goto err; + } } mmc_blk = mmc_get_blk_desc(part->mmc); if (!mmc_blk) { - printf("Error - failed to obtain block descriptor\n"); + printf("%s: failed to obtain block descriptor\n", __func__); goto err; } ret = part_get_info_by_name(mmc_blk, partition, &part->info); if (ret < 0) { - printf("Can't find partition '%s'\n", partition); + printf("%s: can't find partition '%s'\n", __func__, partition); goto err; } @@ -684,7 +690,7 @@ static AvbIOResult read_rollback_index(AvbOps *ops, { #ifndef CONFIG_OPTEE_TA_AVB /* For now we always return 0 as the stored rollback index. */ - printf("%s not supported yet\n", __func__); + debug("%s: rollback protection is not implemented\n", __func__); if (out_rollback_index) *out_rollback_index = 0; @@ -730,7 +736,7 @@ static AvbIOResult write_rollback_index(AvbOps *ops, { #ifndef CONFIG_OPTEE_TA_AVB /* For now this is a no-op. */ - printf("%s not supported yet\n", __func__); + debug("%s: rollback protection is not implemented\n", __func__); return AVB_IO_RESULT_OK; #else @@ -766,8 +772,7 @@ static AvbIOResult read_is_device_unlocked(AvbOps *ops, bool *out_is_unlocked) { #ifndef CONFIG_OPTEE_TA_AVB /* For now we always return that the device is unlocked. */ - - printf("%s not supported yet\n", __func__); + debug("%s: device locking is not implemented\n", __func__); *out_is_unlocked = true; From patchwork Tue Feb 6 22:31:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895931 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTygQ5qhsz23gM for ; Wed, 7 Feb 2024 09:32:50 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2F34A87CA6; Tue, 6 Feb 2024 23:32:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 86AAA87CDB; Tue, 6 Feb 2024 23:32:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 6008087CB8 for ; Tue, 6 Feb 2024 23:32:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d0a29b05bdso44071fa.0 for ; Tue, 06 Feb 2024 14:32:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258726; x=1707863526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WWfkiCLzw8oa+aaSCsiKciREX/zGDRIFXOlH2tDyYfM=; b=I4DrhwWqxC+gN6PTw9puNzqtx/GShM6fXYzSX/zmE6pC4EFVLu4kyB+K7eReKAbPhr JzTHq0mPoiZ5tGMVw8t+58lC7BOtHh73jG1BPzHGq4Y6DiliJRQvi9vZvmH8UOMINXoJ oLJnnkQo6Kijm7JUPZTb3AUta5ns8D6Z84xLNK2emhNTBTG1iw0gfv8FX/xEWMoG2yg/ vrsgEnNmjHbBwMLP7Jp1LhornPjGjdlI2lu1o/fUFl0subZOH0Ykm6TvMKTO9aOs+rtX WK7Bww29Es3gM/73xfJJLALqL4hm7kXGnFc96HIMIjKsId7DgKfv23rQauZJo5bn+n3N YUOg== X-Gm-Message-State: AOJu0Yw3J9/QLsDRSYadzx31X0ulG0bnScpa/wZ5daf6s7Re5Q/Lms4I f5MXEXovkoOQcbs9Z5eSvWAhSahtqOGkmOk1J2JMph6MhzaV739yxuglUv4V8v6FzA== X-Google-Smtp-Source: AGHT+IEQVCdSRdHgxE6jUFDSWdyomG23yv6IeFLjMfcmMGTqqW+Hbub5nwuCn9NiqVeyd03XR2IQ0A== X-Received: by 2002:a2e:91cb:0:b0:2d0:41df:70b7 with SMTP id u11-20020a2e91cb000000b002d041df70b7mr2888640ljg.1.1707258725763; Tue, 06 Feb 2024 14:32:05 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUfirh8GDDwn5Jv7omDlCiJN32qNC4SPkLNfOVbKTd21rtqUUgC/RbxrcHR7D0EkFeQ27ZrNCJ3BGvvy2G5Zie7igq9r3+sv+W8ZhqnSbCQDFXClAR2itRZ6Sk= Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id u27-20020a2eb81b000000b002d0a5ae203fsm398385ljo.10.2024.02.06.14.32.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:32:04 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Tom Rini Subject: [PATCH v1 4/7] cmd: avb: rework prints Date: Tue, 6 Feb 2024 23:31:50 +0100 Message-Id: <20240206223153.3060433-5-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk Introduce AVB_OPS_CHECK macro for checking AvbOps before using it to avoid code duplication. Simplify and add more context for prints where it's needed. Signed-off-by: Igor Opaniuk --- cmd/avb.c | 156 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 80 insertions(+), 76 deletions(-) diff --git a/cmd/avb.c b/cmd/avb.c index ce8b63873f2..ae0012c0e79 100644 --- a/cmd/avb.c +++ b/cmd/avb.c @@ -11,6 +11,14 @@ #include #define AVB_BOOTARGS "avb_bootargs" + +#define AVB_OPS_CHECK(avb_ops) do { \ + if (!(avb_ops)) { \ + printf("AVB is not initialized, please run 'avb init '\n"); \ + return CMD_RET_FAILURE; \ + } \ +} while (false) + static struct AvbOps *avb_ops; int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) @@ -28,8 +36,10 @@ int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) avb_ops = avb_ops_alloc(mmc_dev); if (avb_ops) return CMD_RET_SUCCESS; + else + printf("Can't allocate AvbOps"); - printf("Failed to initialize avb2\n"); + printf("Failed to initialize AVB\n"); return CMD_RET_FAILURE; } @@ -41,11 +51,9 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc, s64 offset; size_t bytes, bytes_read = 0; void *buffer; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, please run 'avb init'\n"); - return CMD_RET_USAGE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 5) return CMD_RET_USAGE; @@ -55,14 +63,15 @@ int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc, bytes = hextoul(argv[3], NULL); buffer = (void *)hextoul(argv[4], NULL); - if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, - buffer, &bytes_read) == - AVB_IO_RESULT_OK) { + ret = avb_ops->read_from_partition(avb_ops, part, offset, + bytes, buffer, &bytes_read); + if (ret == AVB_IO_RESULT_OK) { printf("Read %zu bytes\n", bytes_read); return CMD_RET_SUCCESS; } - printf("Failed to read from partition\n"); + printf("Failed to read from partition '%s', err = %d\n", + part, ret); return CMD_RET_FAILURE; } @@ -74,11 +83,9 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc, s64 offset; size_t bytes, bytes_read = 0; char *buffer; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, please run 'avb init'\n"); - return CMD_RET_USAGE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 4) return CMD_RET_USAGE; @@ -94,8 +101,9 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc, } memset(buffer, 0, bytes); - if (avb_ops->read_from_partition(avb_ops, part, offset, bytes, buffer, - &bytes_read) == AVB_IO_RESULT_OK) { + ret = avb_ops->read_from_partition(avb_ops, part, offset, + bytes, buffer, &bytes_read); + if (ret == AVB_IO_RESULT_OK) { printf("Requested %zu, read %zu bytes\n", bytes, bytes_read); printf("Data: "); for (int i = 0; i < bytes_read; i++) @@ -107,7 +115,8 @@ int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc, return CMD_RET_SUCCESS; } - printf("Failed to read from partition\n"); + printf("Failed to read from partition '%s', err = %d\n", + part, ret); free(buffer); return CMD_RET_FAILURE; @@ -120,11 +129,9 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc, s64 offset; size_t bytes; void *buffer; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 5) return CMD_RET_USAGE; @@ -134,13 +141,15 @@ int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc, bytes = hextoul(argv[3], NULL); buffer = (void *)hextoul(argv[4], NULL); - if (avb_ops->write_to_partition(avb_ops, part, offset, bytes, buffer) == - AVB_IO_RESULT_OK) { + ret = avb_ops->write_to_partition(avb_ops, part, offset, + bytes, buffer); + if (ret == AVB_IO_RESULT_OK) { printf("Wrote %zu bytes\n", bytes); return CMD_RET_SUCCESS; } - printf("Failed to write in partition\n"); + printf("Failed to write in partition '%s', err = %d\n", + part, ret); return CMD_RET_FAILURE; } @@ -150,24 +159,23 @@ int do_avb_read_rb(struct cmd_tbl *cmdtp, int flag, int argc, { size_t index; u64 rb_idx; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 2) return CMD_RET_USAGE; index = (size_t)hextoul(argv[1], NULL); - if (avb_ops->read_rollback_index(avb_ops, index, &rb_idx) == - AVB_IO_RESULT_OK) { + ret = avb_ops->read_rollback_index(avb_ops, index, &rb_idx); + if (ret == AVB_IO_RESULT_OK) { printf("Rollback index: %llx\n", rb_idx); return CMD_RET_SUCCESS; } - printf("Failed to read rollback index\n"); + printf("Failed to read rollback index id = %zu, err = %d\n", + index, ret); return CMD_RET_FAILURE; } @@ -177,11 +185,9 @@ int do_avb_write_rb(struct cmd_tbl *cmdtp, int flag, int argc, { size_t index; u64 rb_idx; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 3) return CMD_RET_USAGE; @@ -189,11 +195,12 @@ int do_avb_write_rb(struct cmd_tbl *cmdtp, int flag, int argc, index = (size_t)hextoul(argv[1], NULL); rb_idx = hextoul(argv[2], NULL); - if (avb_ops->write_rollback_index(avb_ops, index, rb_idx) == - AVB_IO_RESULT_OK) + ret = avb_ops->write_rollback_index(avb_ops, index, rb_idx); + if (ret == AVB_IO_RESULT_OK) return CMD_RET_SUCCESS; - printf("Failed to write rollback index\n"); + printf("Failed to write rollback index id = %zu, err = %d\n", + index, ret); return CMD_RET_FAILURE; } @@ -203,25 +210,25 @@ int do_avb_get_uuid(struct cmd_tbl *cmdtp, int flag, { const char *part; char buffer[UUID_STR_LEN + 1]; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 2) return CMD_RET_USAGE; part = argv[1]; - if (avb_ops->get_unique_guid_for_partition(avb_ops, part, buffer, - UUID_STR_LEN + 1) == - AVB_IO_RESULT_OK) { + ret = avb_ops->get_unique_guid_for_partition(avb_ops, part, + buffer, + UUID_STR_LEN + 1); + if (ret == AVB_IO_RESULT_OK) { printf("'%s' UUID: %s\n", part, buffer); return CMD_RET_SUCCESS; } - printf("Failed to read UUID\n"); + printf("Failed to read partition '%s' UUID, err = %d\n", + part, ret); return CMD_RET_FAILURE; } @@ -235,14 +242,12 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, char *cmdline; char *extra_args; char *slot_suffix = ""; + int ret; bool unlocked = false; int res = CMD_RET_FAILURE; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc < 1 || argc > 2) return CMD_RET_USAGE; @@ -253,9 +258,10 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, printf("## Android Verified Boot 2.0 version %s\n", avb_version_string()); - if (avb_ops->read_is_device_unlocked(avb_ops, &unlocked) != - AVB_IO_RESULT_OK) { - printf("Can't determine device lock state.\n"); + ret = avb_ops->read_is_device_unlocked(avb_ops, &unlocked); + if (ret != AVB_IO_RESULT_OK) { + printf("Can't determine device lock state, err = %d\n", + ret); return CMD_RET_FAILURE; } @@ -302,10 +308,10 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, printf("Corrupted dm-verity metadata detected\n"); break; case AVB_SLOT_VERIFY_RESULT_ERROR_UNSUPPORTED_VERSION: - printf("Unsupported version avbtool was used\n"); + printf("Unsupported version of avbtool was used\n"); break; case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: - printf("Checking rollback index failed\n"); + printf("Rollback index check failed\n"); break; case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: printf("Public key was rejected\n"); @@ -324,24 +330,23 @@ int do_avb_is_unlocked(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { bool unlock; + int ret; - if (!avb_ops) { - printf("AVB not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 1) { printf("--%s(-1)\n", __func__); return CMD_RET_USAGE; } - if (avb_ops->read_is_device_unlocked(avb_ops, &unlock) == - AVB_IO_RESULT_OK) { + ret = avb_ops->read_is_device_unlocked(avb_ops, &unlock); + if (ret == AVB_IO_RESULT_OK) { printf("Unlocked = %d\n", unlock); return CMD_RET_SUCCESS; } - printf("Can't determine device lock state.\n"); + printf("Can't determine device lock state, err = %d\n", + ret); return CMD_RET_FAILURE; } @@ -354,11 +359,9 @@ int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc, size_t bytes_read; void *buffer; char *endp; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 3) return CMD_RET_USAGE; @@ -372,15 +375,16 @@ int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc, if (!buffer) return CMD_RET_FAILURE; - if (avb_ops->read_persistent_value(avb_ops, name, bytes, buffer, - &bytes_read) == AVB_IO_RESULT_OK) { + ret = avb_ops->read_persistent_value(avb_ops, name, bytes, + buffer, &bytes_read); + if (ret == AVB_IO_RESULT_OK) { printf("Read %zu bytes, value = %s\n", bytes_read, (char *)buffer); free(buffer); return CMD_RET_SUCCESS; } - printf("Failed to read persistent value\n"); + printf("Failed to read persistent value, err = %d\n", ret); free(buffer); @@ -392,11 +396,9 @@ int do_avb_write_pvalue(struct cmd_tbl *cmdtp, int flag, int argc, { const char *name; const char *value; + int ret; - if (!avb_ops) { - printf("AVB 2.0 is not initialized, run 'avb init' first\n"); - return CMD_RET_FAILURE; - } + AVB_OPS_CHECK(avb_ops); if (argc != 3) return CMD_RET_USAGE; @@ -404,14 +406,16 @@ int do_avb_write_pvalue(struct cmd_tbl *cmdtp, int flag, int argc, name = argv[1]; value = argv[2]; - if (avb_ops->write_persistent_value(avb_ops, name, strlen(value) + 1, - (const uint8_t *)value) == - AVB_IO_RESULT_OK) { + ret = avb_ops->write_persistent_value(avb_ops, name, + strlen(value) + 1, + (const uint8_t *)value); + if (ret == AVB_IO_RESULT_OK) { printf("Wrote %zu bytes\n", strlen(value) + 1); return CMD_RET_SUCCESS; } - printf("Failed to write persistent value\n"); + printf("Failed to write persistent value `%s` = `%s`, err = %d\n", + name, value, ret); return CMD_RET_FAILURE; } From patchwork Tue Feb 6 22:31:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895932 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTygg0DZ8z23gM for ; Wed, 7 Feb 2024 09:33:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9F00587CB8; Tue, 6 Feb 2024 23:32:12 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 6A7BD87CCE; Tue, 6 Feb 2024 23:32:11 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 752F087CAA for ; Tue, 6 Feb 2024 23:32:09 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-51156cf5766so530827e87.0 for ; Tue, 06 Feb 2024 14:32:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258728; x=1707863528; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1NV0f35Yhv7R/VKc5U1eFIJT6PehCHbCbpaltfL/SAk=; b=lsW7GmsZfpTMpz5kgkwBTCHL10fjJnVwHtps6A2nENr6jhO1Bowp7/WtglK3WZopa+ m4cK8Q/kjLFVnUwzNaCZr7j6BHgTC8pRbsfuHk2cwZgh/a0pHXyVoNn5vhl2A2gpGP+P W4SvWnUpQfEwdHZfxhGvkquXc4FEhUP/+dyiCl+iVDvMlNOo3zxxEufFxCXiceEmSlGD uS06zHQRknXknMmyNfz0EjzRReRxUnzje1jluiBgv1L/6vCzoLbq9QAGfiPG1EtkXqGA +bCPMZoOLUboHLsqGMXhFCn0b4/X30Yvb1zTcErCXudcCOJ1VG6rjpSFHvX+hZ9fC3yL vRTg== X-Gm-Message-State: AOJu0YyyZVoib/kUwLSa6FoTOKpQIGgtS/nBmyd7SWHhC1zhubc4T51B vd8TVqAIoZxi+qWnqGQKPKrBD54BmXdWn0K39c4cjAHsIlk2JgpDqbRrivy/eszE2w== X-Google-Smtp-Source: AGHT+IHUb4jRrjfFYkhX5Pa9IZd2iixZC60uVKRmAXXcYoPoeroDO+3U0HPYh8O9xsQ0/PwW3mpvdA== X-Received: by 2002:a05:6512:511:b0:511:5b35:d118 with SMTP id o17-20020a056512051100b005115b35d118mr2282102lfb.2.1707258727912; Tue, 06 Feb 2024 14:32:07 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCXbJBNY2WryZlP55iHmi9elRp9ICEtyW9D12XM0LH1qUdXqvuN4FaR54L/8boa1lF1NMVXqC/zLac+SjnJHAPsyrsuqjOtE646drW7p1onbyMOpkzRGvDPCxsG6r3y6PRWSA9zY+EgfeF0C9leZn/Qh7UmxvSHX60tFgPjEMNDOXxunNeKulDTCqQnTVacK9W0= Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id u5-20020ac243c5000000b005114ee99515sm354342lfl.220.2024.02.06.14.32.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:32:07 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Ivan Khoronzhuk , Jens Wiklander , Tom Rini Subject: [PATCH v1 5/7] common: avb_verify: add str_avb_io_error/str_avb_slot_error Date: Tue, 6 Feb 2024 23:31:51 +0100 Message-Id: <20240206223153.3060433-6-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk Introduce str_avb_io_error() and str_avb_slot_error() functions, that provide a pointer to AVB runtime error message. Signed-off-by: Igor Opaniuk Reviewed-by: Mattijs Korpershoek --- common/avb_verify.c | 49 ++++++++++++++++++++++++++++++++++++++++++++ include/avb_verify.h | 3 ++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index ed58239cf8a..cff9117d92f 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -119,6 +119,55 @@ static const unsigned char avb_root_pub[1032] = { 0xd8, 0x7e, }; +const char *str_avb_io_error(AvbIOResult res) +{ + switch (res) { + case AVB_IO_RESULT_OK: + return "Requested operation was successful"; + case AVB_IO_RESULT_ERROR_IO: + return "Underlying hardware encountered an I/O error"; + case AVB_IO_RESULT_ERROR_OOM: + return "Unable to allocate memory"; + case AVB_IO_RESULT_ERROR_NO_SUCH_PARTITION: + return "Requested partition does not exist"; + case AVB_IO_RESULT_ERROR_RANGE_OUTSIDE_PARTITION: + return "Bytes requested is outside the range of partition"; + case AVB_IO_RESULT_ERROR_NO_SUCH_VALUE: + return "Named persistent value does not exist"; + case AVB_IO_RESULT_ERROR_INVALID_VALUE_SIZE: + return "Named persistent value size is not supported"; + case AVB_IO_RESULT_ERROR_INSUFFICIENT_SPACE: + return "Buffer is too small for the requested operation"; + default: + return "Unknown AVB error"; + } +} + +const char *str_avb_slot_error(AvbSlotVerifyResult res) +{ + switch (res) { + case AVB_SLOT_VERIFY_RESULT_OK: + return "Verification passed successfully"; + case AVB_SLOT_VERIFY_RESULT_ERROR_OOM: + return "Allocation of memory failed"; + case AVB_SLOT_VERIFY_RESULT_ERROR_IO: + return "I/O error occurred while trying to load data"; + case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: + return "Digest didn't match or signature checks failed"; + case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: + return "Rollback index is less than its stored value"; + case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: + return "Public keys are not accepted"; + case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA: + return "Metadata is invalid or inconsistent"; + case AVB_SLOT_VERIFY_RESULT_ERROR_UNSUPPORTED_VERSION: + return "Metadata requires a newer version of libavb"; + case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT: + return "Invalid arguments are used"; + default: + return "Unknown AVB slot verification error"; + } +} /** * ============================================================================ * Boot states support (GREEN, YELLOW, ORANGE, RED) and dm_verity diff --git a/include/avb_verify.h b/include/avb_verify.h index 2fb850044d9..5d998b5a302 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -52,7 +52,8 @@ char *avb_set_enforce_verity(const char *cmdline); char *avb_set_ignore_corruption(const char *cmdline); char *append_cmd_line(char *cmdline_orig, char *cmdline_new); - +const char *str_avb_io_error(AvbIOResult res); +const char *str_avb_slot_error(AvbSlotVerifyResult res); /** * ============================================================================ * I/O helper inline functions From patchwork Tue Feb 6 22:31:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895933 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTygw5c9Dz23gM for ; Wed, 7 Feb 2024 09:33:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C34C87CCD; Tue, 6 Feb 2024 23:32:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 49C3787CD4; Tue, 6 Feb 2024 23:32:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 5904C87CCD for ; Tue, 6 Feb 2024 23:32:11 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-51149a45fd0so1019589e87.0 for ; Tue, 06 Feb 2024 14:32:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258730; x=1707863530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YFntEKDzB5kuz3X45i7pZauKhqnIlEs0alL5p3zKAvw=; b=aNXRP5d03MlwK9Ej1N7xxFefIbAKNIKSfaxCVGsmTgUfBm5nW4VTqUSBns9wjSEDoW +8POn8uoFbeoJV5FRyfLD/YcSS8OHymDi2x4TyI3r6IXihNV7ATHXbAgmF63YmXb6vWJ 0B4D7L+vwMfKKApQn4bg1zfutbltVaimY/kP00oN8ZI+X+pTOrph3JlFBMWYCEU8Xis4 OZtcLYwQgfPufIBO9dn3U66cXW1pkYBFzOVTcEuhYgPJWW+0ENIcUOfjIGWsnf1zfPUR FFlPptcgvQLWQu83PkHZYSRo6VeoZH6gsso+hoNpnzH1e2yFzO2BB0E5KtzS9r3l8ft2 4M9A== X-Gm-Message-State: AOJu0Yxw7Pzpu5R2pgVsIkTB8rSBChdgpedJt/RcQNjqZhxSUb2pwOb2 CIgh1+tjjHtThK/NqvvVlc9WK+R9yTCxXTmb8B8CD1R+3WdjkOISDCKN74vedeOAvQ== X-Google-Smtp-Source: AGHT+IENxV28LEF6MXP4gaDO7289h8bO+vn+BvwdOfpxnJLYc9axC1NRoaGs8Aq49+HAR4AR4lS1Mw== X-Received: by 2002:a19:5f12:0:b0:511:4881:1b78 with SMTP id t18-20020a195f12000000b0051148811b78mr2403431lfb.4.1707258730166; Tue, 06 Feb 2024 14:32:10 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCUeDip/Atju+gqVDyHuawdFhlkDXJv3oHWK++Cc2HgOVEo7C838/3zCP3rhAsr8yUMHfMNgLLqj0lUGVbrcqNz3V/Vb0L0QB7gt7VmtKZEHuAyyHhLoXt6VaPo= Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id z4-20020ac24184000000b0050eebe0b7d2sm355084lfh.183.2024.02.06.14.32.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:32:09 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Tom Rini Subject: [PATCH v1 6/7] cmd: avb: rework do_avb_verify_part Date: Tue, 6 Feb 2024 23:31:52 +0100 Message-Id: <20240206223153.3060433-7-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk Use existing str_avb_slot_error() function for obtaining verification fail reason details. Take into account device lock state for setting correct androidboot.verifiedbootstate kernel cmdline parameter. Signed-off-by: Igor Opaniuk Reviewed-by: Mattijs Korpershoek --- cmd/avb.c | 50 +++++++++++++++++--------------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/cmd/avb.c b/cmd/avb.c index ae0012c0e79..e5fc202121f 100644 --- a/cmd/avb.c +++ b/cmd/avb.c @@ -239,6 +239,7 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, const char * const requested_partitions[] = {"boot", NULL}; AvbSlotVerifyResult slot_result; AvbSlotVerifyData *out_data; + enum avb_boot_state boot_state; char *cmdline; char *extra_args; char *slot_suffix = ""; @@ -273,18 +274,23 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE, &out_data); - switch (slot_result) { - case AVB_SLOT_VERIFY_RESULT_OK: - /* Until we don't have support of changing unlock states, we - * assume that we are by default in locked state. - * So in this case we can boot only when verification is - * successful; we also supply in cmdline GREEN boot state - */ + /* + * LOCKED devices with custom root of trust setup is not supported (YELLOW) + */ + if (slot_result == AVB_SLOT_VERIFY_RESULT_OK) { printf("Verification passed successfully\n"); - /* export additional bootargs to AVB_BOOTARGS env var */ + /* + * ORANGE state indicates that device may be freely modified. + * Device integrity is left to the user to verify out-of-band. + */ + if (unlocked) + boot_state = AVB_ORANGE; + else + boot_state = AVB_GREEN; - extra_args = avb_set_state(avb_ops, AVB_GREEN); + /* export boot state to AVB_BOOTARGS env var */ + extra_args = avb_set_state(avb_ops, boot_state); if (extra_args) cmdline = append_cmd_line(out_data->cmdline, extra_args); @@ -294,30 +300,8 @@ int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag, env_set(AVB_BOOTARGS, cmdline); res = CMD_RET_SUCCESS; - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION: - printf("Verification failed\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_IO: - printf("I/O error occurred during verification\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_OOM: - printf("OOM error occurred during verification\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_METADATA: - printf("Corrupted dm-verity metadata detected\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_UNSUPPORTED_VERSION: - printf("Unsupported version of avbtool was used\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX: - printf("Rollback index check failed\n"); - break; - case AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED: - printf("Public key was rejected\n"); - break; - default: - printf("Unknown error occurred\n"); + } else { + printf("Verification failed, reason: %s\n", str_avb_slot_error(slot_result)); } if (out_data) From patchwork Tue Feb 6 22:31:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 1895934 X-Patchwork-Delegate: mkorpershoek@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TTyh84Dvsz23gM for ; Wed, 7 Feb 2024 09:33:28 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 851A087C9E; Tue, 6 Feb 2024 23:32:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id CDABB87CE0; Tue, 6 Feb 2024 23:32:15 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 E7D2A876AE for ; Tue, 6 Feb 2024 23:32:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@gmail.com Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-51149a45fd0so1019599e87.0 for ; Tue, 06 Feb 2024 14:32:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707258732; x=1707863532; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+onfv2HKZG+Gf6Kndb8262dDz/qceLw8kOaa7MpYu7Y=; b=VpwOMzsUsKqgXSQ2tlTsYp/STNNI+iXugSMpKitixXqh813AurAkdHoG9GYkx081Zy Nnohpp91P+uGS+T6ZzY9Tm1c8vHLo0tg5dJJOxrkQm1GQVG6tPDl0TaTPZHV6pGzDMhf RuYIHZM813NZewR80684Ka++LiY5O6dXuey9Ja4tJM0M0CZ6Ny4xklouOCEjonWqfHYz 7+eqFsobMf8zT8i3osXd9IrWV7Wo4mbXojuXj3YZf/hERnrz5T/rn5med2XAEe45mgrz ///z0XRccSNgRpQu6Nz1+gBXGCneRilUBIAWAfMbcNlaVvFwQSmci1AgYEOPNF0SsjOS j3ng== X-Gm-Message-State: AOJu0Yw2TzfttIdZsSrfd/eg+KFR8EcWo81Ez/u5hwWJokLWORYKjT5f 6p/Cdex55uZGUCYkUa4MxXrjamsM1l/boPNlGAh79eR1XSjhdp0mZs2pq7/iTmzrZQ== X-Google-Smtp-Source: AGHT+IFHCePmOYAESXwoBmxZ904TXtG16dSrKunBP0h4dGZPOJ9fwjOrvKpA6rwK+khrRDTUpL9ZUA== X-Received: by 2002:a19:650e:0:b0:511:643a:f6f8 with SMTP id z14-20020a19650e000000b00511643af6f8mr372211lfb.0.1707258732428; Tue, 06 Feb 2024 14:32:12 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCW35bFfMpMVO870w8BCy847JmSErl5ZRHZ5f/k29MzmQ0/Rk8tjUu+ey0xGx3kLQ3WpPe8aWMcB/XxyiFNhknXIDWWKzYnud/Ndn/UKv+QCDdKhjSQCiCxNLZU= Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id b12-20020a056512070c00b00511609fb46bsm211416lfs.163.2024.02.06.14.32.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:32:11 -0800 (PST) From: Igor Opaniuk To: u-boot@lists.denx.de Cc: Mattijs Korpershoek , Igor Opaniuk , Tom Rini Subject: [PATCH v1 7/7] doc: android: avb: add slot_suffix param details Date: Tue, 6 Feb 2024 23:31:53 +0100 Message-Id: <20240206223153.3060433-8-igor.opaniuk@foundries.io> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240206223153.3060433-1-igor.opaniuk@foundries.io> References: <20240206223153.3060433-1-igor.opaniuk@foundries.io> MIME-Version: 1.0 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 From: Igor Opaniuk Add info about slot_suffix param for avb verify. Signed-off-by: Igor Opaniuk --- doc/android/avb2.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/android/avb2.rst b/doc/android/avb2.rst index a072119574f..c0b2bedb831 100644 --- a/doc/android/avb2.rst +++ b/doc/android/avb2.rst @@ -39,15 +39,17 @@ Provides CLI interface to invoke AVB 2.0 verification + misc. commands for different testing purposes:: avb init - initialize avb 2.0 for - avb verify - run verification process using hash data from vbmeta structure + avb verify [slot_suffix] - run verification process using hash data + from vbmeta structure. Provide [slot_suffix] if vbmeta partition + is slotted avb read_rb - read rollback index at location avb write_rb - write rollback index to avb is_unlocked - returns unlock status of the device avb get_uuid - read and print uuid of partition avb read_part - read bytes from - partition to buffer + partition to buffer avb write_part - write bytes to - by using data from + by using data from Partitions tampering (example) ------------------------------