From patchwork Fri Mar 30 14:18:46 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: 132624 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp3108761ljb; Fri, 30 Mar 2018 07:30:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+bS7Mb6hdUhsyjaYuzFPH+xrzVZw+bIFEtIzDoNMrG141kd5WM4EQn7ZTw5131tO2jDlS4 X-Received: by 10.80.174.142 with SMTP id e14mr3067827edd.201.1522420242498; Fri, 30 Mar 2018 07:30:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522420242; cv=none; d=google.com; s=arc-20160816; b=uFHYB/g/TCkqZ1H/RS/oWUe3btXJnRJU4zg6QCfAj7X/IdWuSnhW846dWAO65PU5C0 Z/4DRVFTMiSmlKZL2u3KbfNVT2sFTa2rqn98U68ULhpkDlNPSmOajQWxboJS1J9B+cW6 LGZLS2y4BpKgiWKAnNmLsfL4TlfHr2RYvNSvPQ1+cCKJmdd2TlBL6KRHL6cdxzO3z6V7 A9gSMrvIeb43q1iMlglmbMiz644xPrcIs5LlT4VgRRJpx7qAfBNpBwIuLi169by/JclS YahLggksIsYJuNopFhIIJFvKvcX64pnhb7Qf1fRQxhGvRiXHHyqa2AABiWnrR+uUi3Y5 jJLQ== 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=yq8LevhByx6YL3EOaDSV41khlVAN1w0Egcou+fPW66A=; b=zDZadPiKuHL0Vh/YlSQyHx3Oo0zw7zJkA4ieEgfZyZcEei0FJf0CLhat5TllTRrxLp MWVxBy7Bzi0XoWoq5FdUDmhD0+NDbRa0/miVWGdF4+v2Hk1vREQjZc1EdffYyHag1wik lckwXzBHcLdiDDwWAy2/0n/evq8JmH/dX5I2LM8D1LCDx9oHx8oyCvFrEEvrmClIrdK8 tOxjKZBZpxk4OLMowvLegveHO0vnFSM30v4Le/NdHHAm2CdwVCwK+hdd1Nllqbz+KLSI Cvsv2I0uKqmskFNTeIkcUthLWEebhcjLC1Iqqz/UW8b8WAtBb5NyjtqTf73VUHupDmLS +jEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ezAjqBOn; 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 b6si481116edq.6.2018.03.30.07.30.42; Fri, 30 Mar 2018 07:30:42 -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=ezAjqBOn; 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 182EBC22248; Fri, 30 Mar 2018 14:23:37 +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_DNSWL_BLOCKED, 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 BF0D7C22238; Fri, 30 Mar 2018 14:20:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B1470C221BF; Fri, 30 Mar 2018 14:19:11 +0000 (UTC) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by lists.denx.de (Postfix) with ESMTPS id 3B0FCC22246 for ; Fri, 30 Mar 2018 14:19:07 +0000 (UTC) Received: by mail-wm0-f68.google.com with SMTP id x82so16985373wmg.1 for ; Fri, 30 Mar 2018 07:19:07 -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=OcYpZhWBL+tryaHLwBELFdeYvYsloMue1CwgtV6HeNo=; b=ezAjqBOnuTCVs6w0H5CxomJYXC6j4lNHVS+RNKoWN2/juz27W3HEE8L2w+MC90C1JE QrlTQ30LeXjAWozY8YlKkaQ4loBuGQX489iIgrukwoQrOHf90rANH4SRlt8gdof9K1Gq WGgQBRiDSn/dsnVkS6agwGQpKfalB3eTccKeo= 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=OcYpZhWBL+tryaHLwBELFdeYvYsloMue1CwgtV6HeNo=; b=jnR1DUq5QgIVl32oXEO/uKQSxR4hI40bwOh6WwFPVPwYFmdiWUfgFXcoSlL7ZmANh9 g+3gsPsS/ynl4Ou31A1O+RqAWPtG+Z7h9PLP5OBg2ZS9c9FbTFnBAkb5LBaosDKhV0Nj 8SvunG1oX6RRUJbem4pVAfkvR/3v5QZ8u8Jli1lpBfKBbAXaaBne4AO1SC5mXrj33Thc xF1aC1IOz91q4wpTqO9Jt3821XdE1T7lXxJtzpEUKf6O6ht13KhfwJX+Dgbhkddn2xTX Xxe4d9UeOHJZoR5w8LR2SOBHViGuiVYMmaqTQ9mUdGQ9tbt/69SoTdpwWc9nDGu8Z101 PSDQ== X-Gm-Message-State: AElRT7EP6OkxVSih4+2c3leIpWJxjQb3BbsZUFDwj272E8Z5PxvTCKJJ So2CIAwhOmmnDvMTPuJFfenlYsQdXx0= X-Received: by 10.80.164.182 with SMTP id w51mr3137965edb.152.1522419546747; Fri, 30 Mar 2018 07:19:06 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id d22sm5831758eda.31.2018.03.30.07.19.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Mar 2018 07:19:06 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, fabio.estevam@nxp.com Date: Fri, 30 Mar 2018 15:18:46 +0100 Message-Id: <1522419526-29494-19-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522419526-29494-1-git-send-email-bryan.odonoghue@linaro.org> References: <1522419526-29494-1-git-send-email-bryan.odonoghue@linaro.org> Cc: rui.silva@linaro.org, paul.liu@linaro.org Subject: [U-Boot] [PATCH 18/18] 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 adf25ac..2a2d431 100644 --- a/include/configs/warp7.h +++ b/include/configs/warp7.h @@ -54,6 +54,14 @@ "ivt_offset=" __stringify(BOOTROM_IVT_HDR_OFFSET)"\0"\ "warp7_auth_or_fail=hab_auth_img_or_fail ${hab_ivt_addr} ${filesize} 0;\0" \ "loadcmd=fatload\0" \ + "do_bootscript_hab=" \ + "if test ${hab_enabled} -eq 1; then " \ + "setexpr hab_ivt_addr ${loadaddr} - ${ivt_offset}; " \ + "setenv script ${script_signed}; " \ + "${loadcmd} mmc ${mmcdev}:${mmcpart} ${hab_ivt_addr} ${script}; " \ + "run warp7_auth_or_fail; " \ + "run bootscript; "\ + "fi;\0" \ "loadbootscript=" \ "${loadcmd} mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \ "bootscript=echo Running bootscript from mmc ...; " \ @@ -80,6 +88,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 " \