From patchwork Mon Apr 2 22:42:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 132688 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3102612ljb; Mon, 2 Apr 2018 15:49:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+GigU/i+z2k0EKEl8y4NnsaFIkE/8RbXu3MMGcQi1fx1f2WSeP8upph8L22kzuP6XWlhmf X-Received: by 10.80.240.5 with SMTP id r5mr14459579edl.91.1522709367173; Mon, 02 Apr 2018 15:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522709367; cv=none; d=google.com; s=arc-20160816; b=hFRCAoW2qXAYJS70UEd00CieFLM87bzs6O/nO38tbvTQdX6n+54m279emsFGvOrnvB hLBLGLx1I0x8VT8V3eks0bOVgrnNjBnrLgLgHCIostkncNsy4f70w47P4OuNA2nqXYVQ eiijvaNgg5GG5HmM5YQ0GtdqnwUhdiWAUqn0Tzylu0w/auexnUq7mLbsIf+YruxtcXXM vmzYS43FHNaMrx9TuYCkge3jCat/yhnoXT1qqjecDYPoMmFqNHOFBuTVS/aP3n96nYxu fjpsjY99OymzQKn4JDIj+NXwN4gGSC8YloPDli6O/H7AqMJC+vk7Ol6MBTiQ7ch8xFQH GsFA== 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=+PEQecFXTQRi6QNoMc/OCk5woixB7kz9PlC7HOEfhro=; b=LaDaSzLIwHLzopKfBi7I9j3MbXpBf1w0fkBmKmDOLeZQmVFbE9XenkAkoNzMwyrZ/m +ZSyoB7OVFEdS8m+5Y9J2GjOQBmTBRMPeeByu0kef7AquWd1+eHBVPeQlU3kAE8IYky6 EKu3nk3eCW639fOMvPooZ7/gtUNk0HndeXAK9kHbofGRheMqJHsEp+4gsFiCcNSDa+1T vH2Jv5DTLAq7ub20+f7lSzzHA4WfJ/vKttJhqwTpCpL9GMRsZJWd3h4eJlGpkmNztxck gp/m3nCRbxPyR/E7OinGajH/mLpH515mAKgPfeo56fuFjyKualWFWxqUknDURZcQTHcm qtRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=f5G3dbPx; 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 j9si1086116edf.548.2018.04.02.15.49.26; Mon, 02 Apr 2018 15:49:27 -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=f5G3dbPx; 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 CA1BFC21EBB; Mon, 2 Apr 2018 22:46:54 +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 BEE6BC21F04; Mon, 2 Apr 2018 22:44:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 87406C21EE7; Mon, 2 Apr 2018 22:42:42 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id E0A0BC21DB5 for ; Mon, 2 Apr 2018 22:42:37 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id h76so29005809wme.4 for ; Mon, 02 Apr 2018 15:42:37 -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=yVd1fav2PFmIPoPApPmBdYX5VkmcZ/lsc1NXAuRRRfY=; b=f5G3dbPxu1Mgeak3B1sgHSiFPHhgZ+AeSkyVuiGzEVv7LkEN9beOLQqZSFM2OCaN+f PsOQL+mwNX/ysH1Zc4WB1SDSN03z4Kz/21M1rYA8sx+PVTMFANn5Be8EHAsy3iLZEIVr OvPJrpnwTboihRUDTij3bPvegeZ5mX/cyu5/A= 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=yVd1fav2PFmIPoPApPmBdYX5VkmcZ/lsc1NXAuRRRfY=; b=IFkbU0bSUVsLumgdr3wIjtfQ8HZx55KtkWTrE3FLDKLPtHyJGO3ZZSrXdYqDXwcd+q Pc0cZGf7c8pAGYigGLaxJtJMFwM3fjNvDzXas6EgDdeBeaeI8BhPrAhnBZjrDC2XjsUE dhIjI14zUCgeXa+Xjjx3IVe9BDQQY/joAPujaQnAtl7mJvh12/Ni5RDk3mDJooJPpVhE hDEprWentykcFZn45l0GIoFSh3GOzLiH70nqufxs0fze3N7z6ykU55d65kLGN1iYbYlH TuFWYd1mALhNUj3NbVyClByk5kN9tDdunzo5LmjdhAucyYXFIZPCh8ef3SlQUxbeBJLq 2Utg== X-Gm-Message-State: AElRT7E2K4/nYvNlXbDAdeKqVvu+N38Q05fliejO7gpKnfy8aOTEUTVs rFDNE6htEg/Xp+7+uex98mXUcelHWO0= X-Received: by 10.80.152.227 with SMTP id j90mr14266005edb.89.1522708956609; Mon, 02 Apr 2018 15:42:36 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id s8sm842086edk.76.2018.04.02.15.42.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 02 Apr 2018 15:42:36 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, fabio.estevam@nxp.com, sbabic@denx.de Date: Mon, 2 Apr 2018 23:42:16 +0100 Message-Id: <1522708936-7603-18-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522708936-7603-1-git-send-email-bryan.odonoghue@linaro.org> References: <1522708936-7603-1-git-send-email-bryan.odonoghue@linaro.org> Cc: breno.lima@nxp.com, rui.silva@linaro.org, paul.liu@linaro.org Subject: [U-Boot] [PATCH v2 17/17] warp7: Add support for automated secure boot.scr verification 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" This patch adds support for verifying a signed boot.scr. With this in place it's possible for run-time Linux to update boot.scr to set different variables such as switching between different boot partitions, pointing to different kernels etc and for u-boot to verify these changes via the HAB prior to executing the commands contained in boot.scr. Signed-off-by: Bryan O'Donoghue --- include/configs/warp7.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/configs/warp7.h b/include/configs/warp7.h index fe9b7d5..f340bff 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -53,6 +53,14 @@ "root=PARTUUID=${uuid} rootwait rw\0" \ "ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\ "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \ + "do_bootscript_hab=" \ + "if test ${hab_enabled} -eq 1; then " \ + "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \ + "setenv script ${script_signed}; " \ + "load mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \ + "run warp7_auth_or_fail; " \ + "run bootscript; "\ + "fi;\0" \ "loadbootscript=" \ "load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ @@ -79,6 +87,7 @@ #define CONFIG_BOOTCOMMAND \ "mmc dev ${mmcdev};" \ "mmc dev ${mmcdev}; if mmc rescan; then " \ + "run do_bootscript_hab;" \ "if run loadbootscript; then " \ "run bootscript; " \ "else " \