From patchwork Fri Jul 13 16:03:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 141914 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp978666ljj; Fri, 13 Jul 2018 09:05:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfqw1lrTjeYENmxAsKardnB0EqtZjZq+g9kr6JOwiISavfHxyWHVvpJkFWDDn0aFu+n2pbF X-Received: by 2002:a50:b807:: with SMTP id j7-v6mr7692251ede.206.1531497905571; Fri, 13 Jul 2018 09:05:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531497905; cv=none; d=google.com; s=arc-20160816; b=XE51BoUK3384gXRxb2Sxbm9auvSzx2sk1SuodY1wumsX9sKE6Lz6B+wVeAGgXy/PH3 JuewQ6ZhYzGczCBGwNVAi1aGUo/l+JN4Uv5viExBY5+6CC78/16kXqZk4xfSB3wsex26 NbqqECpQLVFTt0VscJKDjFnCcEpDiTEdeRp6w4eT5qGKS4DpWCzUvu35MFgK7VswTkFR cLi+4Z98sMMVubQ7psUoJRBMr0te9na60d59DN6QZqUrL+a3D0JYx+5hQ+okXG06x5Fq rNUqHR7fGKVZdjQBpiK77OVkIO9SRtpPCgZ01gHst8uz0aqDiSwoo+uD/ufYuWMfTEHo 6/LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=rbGkcdCgt6UCWGa2nfFpY3pfEL2mRcA2ZsfZm+N/qDI=; b=OcmgAH4PmclZouj2iBZjYpyu17r8oNOB6mUiKIB1oi7Xhr5J32ZaSv5IIpYrdgITrJ gTrHhyyToGgIBARL7BpcAyd7l4lh8CA+b/Q6j9Lm4E6fgVfKRIGVTwgqp7yLP2JvYog3 1Vix+tPgeHWANRpSEThpXv1NXekgt/oRaOCHJX6Lv3JOnPcSw1130jA90hk6sJ7/Aon/ wpUWVlblSGibJdzCIMOBhhfhfucxIspihK7V3AqAW1hJ5GSLhaVDhbKusCynzeadk7OH AddP2r5K8cS8+9kVPUriLxPU+wikvh6qCgth8bKNrJ0d2jSFGpsvzDfR7l/qFvrVF22S stpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="EtVmhO/d"; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id d4-v6si1109749edq.426.2018.07.13.09.05.05; Fri, 13 Jul 2018 09:05:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="EtVmhO/d"; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id 35470C2209D; Fri, 13 Jul 2018 16:04:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 26835C220A1; Fri, 13 Jul 2018 16:03:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DA411C22095; Fri, 13 Jul 2018 16:03:36 +0000 (UTC) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by lists.denx.de (Postfix) with ESMTPS id EB736C22050 for ; Fri, 13 Jul 2018 16:03:32 +0000 (UTC) Received: by mail-lf0-f67.google.com with SMTP id b22-v6so15178774lfa.3 for ; Fri, 13 Jul 2018 09:03:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PVyxnwB05J/X86kb5vpWJyeS5oAn73pgqToQ1xParrM=; b=EtVmhO/dw635u9XW934n1srRXhvNA+hhfU82nMTzCTTJ+h13tTvu1HkHqEPb1JCr0l XGiIG3p+hdEOODXFvYWHsdVBWjCj8nE3A1UMccjTC8ZIePPiBW2KgmJ15JkTTydeL0QD EViWel+nONJ/LdhDkMr2U1JhoB+FRRak+NTgo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PVyxnwB05J/X86kb5vpWJyeS5oAn73pgqToQ1xParrM=; b=WJOuaUv3Zinb1chn27ljvntkD6B0ricLGyDPArbbA86P5K4ljYvmqOLxHtw3h+fiZS wpFWQwfUoHJt8ROzrBh+IuJ6kgjSNfUxyXaXcS1VOGD+cn4IHi61mht/RJhRNkOztyGj VSI0defNyn2AaFSq6q6oDBpyae4tcWj757PgDS4j8RM25zYmMLbNoOmRydig+o8L+Oji zvJ0PIRPEsTsKnaIun070nTFQcGdUxAVniI9gNa1XwkZQ7Q7qMSB1/YtYrqXQFBsB7U1 H9IhKAbVKK/W2KGmajFUyRjXFfzEm4C7pvH3EqrQGzmTfGV/m5aeMfRrwHZ61GRPcJlV ScoQ== X-Gm-Message-State: AOUpUlHpoOSemD9Gq1p6J8rylyqE+HOpldYBDOMzSPMicFQSPvombm9Q gu4h5hyh4PoNgwbcZpZbeBScfdAlLK2Dmw== X-Received: by 2002:a19:e803:: with SMTP id f3-v6mr5861969lfh.84.1531497812044; Fri, 13 Jul 2018 09:03:32 -0700 (PDT) Received: from localhost ([46.211.143.111]) by smtp.gmail.com with ESMTPSA id 14-v6sm2021072ljc.74.2018.07.13.09.03.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 09:03:31 -0700 (PDT) From: Igor Opaniuk To: u-boot@lists.denx.de Date: Fri, 13 Jul 2018 19:03:26 +0300 Message-Id: <1531497807-4292-2-git-send-email-igor.opaniuk@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531497807-4292-1-git-send-email-igor.opaniuk@linaro.org> References: <1531497807-4292-1-git-send-email-igor.opaniuk@linaro.org> Cc: trini@konsulko.com, praneeth@ti.com, misael.lopez@ti.com, erosca@de.adit-jv.com, joakim.bech@linaro.org Subject: [U-Boot] [PATCH 1/2] avb2.0: add proper dependencies X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" 1. Since libavb library alone is highly portable, introduce dedicated Kconfig symbol for AVB compiler-dependent operations, so it's possible to build libavb separately. 2. Add CONFIG_FASTBOOT dependency, as fastboot buffer is re-used in partition verification operations. Reported-by: Eugeniu Rosca Signed-off-by: Igor Opaniuk --- cmd/Kconfig | 2 +- common/Kconfig | 7 +++++++ doc/README.avb2 | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index aec2090..b3e030c 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -1771,7 +1771,7 @@ config CMD_TRACE config CMD_AVB bool "avb - Android Verified Boot 2.0 operations" - depends on LIBAVB + depends on AVB_VERIFY default n help Enables a "avb" command to perform verification of partitions using diff --git a/common/Kconfig b/common/Kconfig index 4c7a1a9..1d31f9b 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -631,6 +631,13 @@ config HASH and the algorithms it supports are defined in common/hash.c. See also CMD_HASH for command-line access. +config AVB_VERIFY + bool "Build Android Verified Boot operations" + depends on LIBAVB && FASTBOOT + help + This option enables compilation of bootloader-dependent operations, + used by Android Verified Boot 2.0 library (libavb). + endmenu menu "Update support" diff --git a/doc/README.avb2 b/doc/README.avb2 index 67784b5..120279f 100644 --- a/doc/README.avb2 +++ b/doc/README.avb2 @@ -58,6 +58,7 @@ Slot verification result: ERROR_IO ----------------------------------- The following options must be enabled: CONFIG_LIBAVB=y +CONFIG_AVB_VERIFY=y CONFIG_CMD_AVB=y From patchwork Fri Jul 13 16:03:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Igor Opaniuk X-Patchwork-Id: 141913 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp978087ljj; Fri, 13 Jul 2018 09:04:33 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcZnd7kVFaEvIQjSV/sJD36kgZdAOCqQ1GA2SlPhlqqK6MGM+fjCaH3Zdh4GNQR964GLv5u X-Received: by 2002:a50:a624:: with SMTP id d33-v6mr7512948edc.8.1531497873413; Fri, 13 Jul 2018 09:04:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531497873; cv=none; d=google.com; s=arc-20160816; b=hUtwmMtZIH0au2Aw7GdZ77ezeoFMbpZMy/v31bY/nyFTNMmJ7wIjmgYJi1CxFnOa6P I3Xv4UpS1fe7gnVCHTsst8xUm/+y84BVAe0KhKTBDebzGX5+XVaaG1vXnFsM7BCSWppi oVwRBtF70fdtlElaCRQx2asVBaCtqU3zqcP33oFY+qGqMT7Jr9B1b4IDRRJISWBGXxMJ +FpsE/j9TBXEQFdklDdc8txYRsdj6agRP8n+uDRhT9bBpVJoDuwUxKf36mz6lzrOiTwR c2UXR0CNTONd1/1nn6+ecwyAynfOCKPPTEKkIVtpK6r1O0jAJcPUW+hkE/kBxOfDaueo ZrIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:arc-authentication-results; bh=lvWkGWkuUy9PcVk+7KRPqNLjTuAdkWWpZEa9PeoNoxs=; b=TsWV3i6374nf+DL52Ha3xdbjatmVlGPtg4f/NFlqlK5Nl3X0Aj0V5nCirREzLBajWk OU/e3e2HHV9UdWZ5tiPK38MEnn0X84EESRF+YU+umXEzIYPv3gPgzIzju92bQO447Mmu bm7jPz60SMe8Dm6C8HVEKLuA30nX2bmIA4KPyKlO1U8IOkflyoHkaCjIEiaiXqXQp9RJ SPxBhsD8R+EjS8wB6bkFRrYstiXDClSwhF1MrJACwV4CkWY4DWtR7Zv0yxAjf1J29QwG TOZgZ5qlSd2xNKd+TPZ3WnROn4UlGHvYMkmUDnNljf/4iQNYDaIonkEHWQ9FzMl9fzdI Kg4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="fjcx1/Su"; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id p21-v6si4424820edm.136.2018.07.13.09.04.33; Fri, 13 Jul 2018 09:04:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b="fjcx1/Su"; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id E47DBC22091; Fri, 13 Jul 2018 16:03:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 14022C2205F; Fri, 13 Jul 2018 16:03:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9AC49C21F7E; Fri, 13 Jul 2018 16:03:38 +0000 (UTC) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by lists.denx.de (Postfix) with ESMTPS id D6B50C22074 for ; Fri, 13 Jul 2018 16:03:34 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id p6-v6so24917121ljc.5 for ; Fri, 13 Jul 2018 09:03:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NgHwrTVUDm8haJH5Ty6p7PRhgkF/U3+JmB+mxVVxS54=; b=fjcx1/SuvcSJXKg/zskk3hGxtoSiTabLJiwwPtUytHbYN/KYS73bfKKIodkd7FpQ0m bMu28gVKTosyIprCHtOSXr3cypEpqFM/rVdpC5abEjP+Gy1Pyy/PxjBszx3fUgV/THI+ xlDBQpqtYBUE5fPoDqNbeAC3eeVobVDTt4gpQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NgHwrTVUDm8haJH5Ty6p7PRhgkF/U3+JmB+mxVVxS54=; b=MIo8eWOYVaxs5LC+8bMTRGkJcnzaLNTSBZZGaN3brYK4r4dunhTsWU6/F3GF0pBsF/ bC3EtNcGQOtr276x1DPLK9XuHVhyKknVMKjxm7xb8diu0kkY9ZRWYaCtgjDpx5zpsC+7 0zL1Go+HjIudww924PHi/Ny1IJ9ZuJxXELT9f2XnLtVA/U5FJv1cw5a/ASOgNG4X6+53 Eg1cU0Wil42GJ0jurcWlZHMHUgwDWec8RzUHW/mUHu2bJXT+wrz/MqfWfdqV/q9qWFB6 FozMO/7fgi93paceny+btrBhUt/xdCCAcqomwFws68K1x7LDHxijxJaiw1UT2pPV7TzT Yr8Q== X-Gm-Message-State: AOUpUlHB6DL+pxVWHOV2fF6VN4PJfzaJokaYxcElSKOEa7KLKGa55fdi AUAnOAxqVVVf03cUMntBrlQQtXBBVbqjPQ== X-Received: by 2002:a2e:5243:: with SMTP id g64-v6mr3673812ljb.144.1531497814051; Fri, 13 Jul 2018 09:03:34 -0700 (PDT) Received: from localhost ([46.211.143.111]) by smtp.gmail.com with ESMTPSA id i15-v6sm4395021lfb.94.2018.07.13.09.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 09:03:33 -0700 (PDT) From: Igor Opaniuk To: u-boot@lists.denx.de Date: Fri, 13 Jul 2018 19:03:27 +0300 Message-Id: <1531497807-4292-3-git-send-email-igor.opaniuk@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531497807-4292-1-git-send-email-igor.opaniuk@linaro.org> References: <1531497807-4292-1-git-send-email-igor.opaniuk@linaro.org> Cc: trini@konsulko.com, praneeth@ti.com, misael.lopez@ti.com, erosca@de.adit-jv.com, joakim.bech@linaro.org Subject: [U-Boot] [PATCH 2/2] avb2.0: use block API in AVB ops X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Use blk_dread()/blk_dwrite() in mmc_read()/mmc_write() AVB operation implementations. This fixes compilation issues when CONFIG_BLK is enabled. Signed-off-by: Igor Opaniuk --- common/avb_verify.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/avb_verify.c b/common/avb_verify.c index f9a00f8..20e35ad 100644 --- a/common/avb_verify.c +++ b/common/avb_verify.c @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -288,8 +289,8 @@ static unsigned long mmc_read_and_flush(struct mmc_part *part, tmp_buf = buffer; } - blks = part->mmc->block_dev.block_read(part->mmc_blk, - start, sectors, tmp_buf); + blks = blk_dread(part->mmc_blk, + start, sectors, tmp_buf); /* flush cache after read */ flush_cache((ulong)tmp_buf, sectors * part->info.blksz); @@ -327,8 +328,8 @@ static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, tmp_buf = buffer; } - return part->mmc->block_dev.block_write(part->mmc_blk, - start, sectors, tmp_buf); + return blk_dwrite(part->mmc_blk, + start, sectors, tmp_buf); } static struct mmc_part *get_partition(AvbOps *ops, const char *partition)