From patchwork Fri Apr 13 15:31:21 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: 133397 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp855644ljb; Fri, 13 Apr 2018 08:41:27 -0700 (PDT) X-Google-Smtp-Source: AIpwx483owXIwzgib5aNsxbPOytoREasaazQHQju6HPLg0pAj9dQUHziqoT9DWKca2A0d9LSMe+F X-Received: by 10.80.148.97 with SMTP id q30mr21008338eda.70.1523634087563; Fri, 13 Apr 2018 08:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523634087; cv=none; d=google.com; s=arc-20160816; b=NSp22ZFkaF2ARhgh+Loc6Qa9TUnwsZfoie0PSEhYrzPea11bvbghbwP2MOji92d/AV NfyKQEjqH1AiCS6plVM9hmYMegtox6bIR9v41yT/LVo+9BF3KAUSVKrAxo4v6gHr3Xo1 fxTSmhzw0mEv5+dSLiysMFh8rtd/KpG/kUaFP2fJ4G6KPR3W1uvaW/hoB86cJAKdvtGG 4FhOjSGs6RsUi18ni32XJDcfkcR8v/3f+mqsDc7xNwoVa2/LQvLQ0dILfCDpYyvqMFYe hPP0pojwnW/If6uJASRNq9UNldPxt5WawWbfAvKZASScd4GR0blSLvcLeUXnZE7Ryw5x 2Bjw== 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=hPnF1BMmejJuhaI4ZgMSXMnoee178I6woZV6wkwm368ty9dOCukl+Q3Jq3MyK5z6Wk Vp4/MIPmWEV39/C42DLeNBOKMcIhiAjT2XjumOmP0wcgFvQ83oo4iHJsGMOUuq89NJyy aLSreuoEPYQS96qGFWM6MFeAq8Mp0kiV3uLiy20uSR7huVd2qsfsMmNBBEasm4x7nzI0 KfI4gIvuiAfu4rB7poPveSZfw3Cq6Guue5koaDzil1FpS6aBkV2XVJUlV1j3CxGgkAPw 4+AzA+Qt97JxcBnvJg7RDsyWUutQEFGbBRoDN+uVXvH+y9rQIbNgz+tRwCDv2rj3uu2t JwfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NZndTEwX; 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 m8si5814965edl.214.2018.04.13.08.41.27; Fri, 13 Apr 2018 08:41: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=NZndTEwX; 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 308B8C21E1D; Fri, 13 Apr 2018 15:35:15 +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, 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 E8E34C21E18; Fri, 13 Apr 2018 15:32:10 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6399CC21E36; Fri, 13 Apr 2018 15:31:47 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by lists.denx.de (Postfix) with ESMTPS id E44B9C21D4A for ; Fri, 13 Apr 2018 15:31:42 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id l49so9165890wrl.4 for ; Fri, 13 Apr 2018 08:31:42 -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=NZndTEwXNKPlJabIBaPgdlNr5ovn0iKItG+rQpYK9A8IQYEpaNtICVZEv0Fdc7Er0r VThkRBGv17Htf0GN68eaFIjFuVLMmQ/taNAhzF81dFlrfhgjVnIX5JaF/jQRGRxgfTQz 03shnsY7JU9E2oiJC416mK3SNoldlKrHMwQlU= 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=mXjLTZXVLm+S7fXJw2sW+rRfTiRz+Iq3GEkzNKK2HhjsiT+USv69UWWh7d1l9n6qiR U2rNLQjV+8UaFIAu8zh5CRLplXfZZdpflv6poAofvPoZGIYIATO728C9TRN0nvqGL8Ef GeS+b+hK0csUDwOTNmdJnTl1NrTWiX9dMVG3kp8xlMRYQar3h0+oW6jSrSB1693UQECn 1DAIDXSK8NhikUwz3ihniirepU75w+lYbxW60DR8Faa0VnnFf3ONTuZwoWhrVnbkhQqd 64655IadRveNE0tLeNKCkwfyjQBUorhPd/Ex+OpjL3DeV4jvpP1fO2xG+rkxgug3tXoz dJoA== X-Gm-Message-State: ALQs6tBV6ry+wao97K0BaT5CMry/RUxYo5k9bExcNNiDm19+6wB7021W uq+8KWNJFaE9fqTEOYDzaDUcxRLBLlQ= X-Received: by 10.80.174.177 with SMTP id e46mr21209968edd.61.1523633502370; Fri, 13 Apr 2018 08:31:42 -0700 (PDT) Received: from localhost.localdomain ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id x35sm3516008edx.86.2018.04.13.08.31.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Apr 2018 08:31:41 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, fabio.estevam@nxp.com, sbabic@denx.de Date: Fri, 13 Apr 2018 16:31:21 +0100 Message-Id: <1523633481-20914-18-git-send-email-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523633481-20914-1-git-send-email-bryan.odonoghue@linaro.org> References: <1523633481-20914-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 v3 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 " \