From patchwork Tue Apr 24 17:46:47 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: 134187 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2535680lji; Tue, 24 Apr 2018 11:01:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx491lUYwUxFGeM0sQ/CRTzXI0fFJD/8d6NC1T+gWJJyc1JLk+X6ynojHPvBoKkCEaC2EWWji X-Received: by 10.80.226.193 with SMTP id q1mr34468668edl.253.1524592891829; Tue, 24 Apr 2018 11:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524592891; cv=none; d=google.com; s=arc-20160816; b=l9Cf5qPZzJV6NjrmXst2ebx/4+Fm8lx8mStHJ7FBcEsWhbQY79ehEryYeq3gdAAK3Z ZWMk6S1rDwG8qfe8kTHwW9W5ZIhDaCiEmAZwg/RVYxds1R/VP/AWJSzDdNaZ8isXowi+ BSstLRZtSBlSz1sjBPXpSLyK7dH8QLWDiy8mp6+OhmHYosCNBFuaViQhNWYZNIq5q/tE UyF0FYwxFB93QCbeKhbqndA3H3XAvyonH+g2hvo6nXnCTBkVTYu1l/q7atHuwscAQAq5 EpzNm8n3KaV3MSXaNi54Iipq8BGhXLOky+3/ylY0xEqdEHuhvzl2SRorvoIutIfkYM/m EXUQ== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:arc-authentication-results; bh=/HZSKkKZ4rY1CdkDII281APLGTWH26En28DtsqGxGN0=; b=uq7+quAeqP6jdj4eRQM8r9qXiyp5KIEuuH/tZmdJCYmyg0Xosi/Z7mzI8CSOuWqQy3 036F+ZQFZho06eZ40Uo/wdVE2Ss4F3Sg8ckjQLKKl4tc4BedM2UmDXTG0jrflm4rvTAV 2f4kF7TypFUdIik53vej4j6iyCkbIZikUQk/lDnMuRXh6DS8TCj3mxmBmH8ewk2ZS3K9 +ktLn3G+xTPeeQ8lsvVaozJkvEHea5HlfOEDcj12Q887OX4ByVOrLb2T7NdRImefHXwA HLD9iTSS/f1BdWF4SlzlSLLuyMOflPuCN4+z2H9C9PWZAnizGlk1N5saXLLpN0tcDwlp /X1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OxHGJlHf; 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 s10si409118edc.383.2018.04.24.11.01.31; Tue, 24 Apr 2018 11:01:31 -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=OxHGJlHf; 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 083BCC21F9A; Tue, 24 Apr 2018 17:56:09 +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 09486C21F17; Tue, 24 Apr 2018 17:48:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5B49BC21F84; Tue, 24 Apr 2018 17:47:11 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id B3891C21F62 for ; Tue, 24 Apr 2018 17:47:10 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id w2so1490734wmw.1 for ; Tue, 24 Apr 2018 10:47:10 -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=DMf/oA73RNxqj0+uoeZ2gY6oTI3nNq2R5BQmzqtkL5Q=; b=OxHGJlHfRz6e3d/lusSaigiFQxNX8Yn/zqvmHPhhiFGVjLyLxcpzLv1f+atD3yz1Co ySAVhFUrAnS1Xhg+nvhGrtqmCGvIuyB00hxLTO2Oo4zM75xX8xlrmOuGPPjOfwlDxOGY O52wsczbUJNLURoxID5m99QPzFwBpCvxVLZJU= 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=DMf/oA73RNxqj0+uoeZ2gY6oTI3nNq2R5BQmzqtkL5Q=; b=W0r6SrqpaV/3+gDuh4F5257dLxGSJr0hGjcG4ChIlm6/7ia5hFEWI6bDyX9VXczASC yF94yY2vV7r84WXyXve76kpACMQvlXCLKD7C5CmfQ/4UsfZ2SbGG/f03HjAgGDZkxB9F mpEHDzbZUqNunRjHmqV5NC3jA7oTowumJxKnEX2niFIJqGg/3LBaGf++89YgKcb0oBGq pk1CxU4jhn1BgybFOLir6y8wfUylrdnPkZpPt0LxWg0ztmLmrh9HvM2FezoVZrFc0Hcb agK5lk+98J8E4nG2zM4wkC2LUabPIrQhHQQsPYq4bvs4MASBDukqOpMUIkJsQBGGjtDt 53Yg== X-Gm-Message-State: ALQs6tDJbNony/a8Ufjag0PbIyboTzF4JhP42QQEccck13+54fgvJWv1 pYKhMVmL9AVtJ7Qzcd4pHXMZGI3krzg= X-Received: by 10.80.135.14 with SMTP id i14mr31410626edb.86.1524592030171; Tue, 24 Apr 2018 10:47:10 -0700 (PDT) Received: from event-horizon.net ([109.255.42.2]) by smtp.gmail.com with ESMTPSA id e6sm6443087eds.20.2018.04.24.10.47.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Apr 2018 10:47:09 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, sbabic@denx.de, fabio.estevam@nxp.com, breno.lima@nxp.com Date: Tue, 24 Apr 2018 18:46:47 +0100 Message-Id: <20180424174647.11840-19-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180424174647.11840-1-bryan.odonoghue@linaro.org> References: <20180424174647.11840-1-bryan.odonoghue@linaro.org> Subject: [U-Boot] [PATCH v4 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 Tested-by: Breno Lima Reviewed-by: Fabio Estevam --- include/configs/warp7.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/configs/warp7.h b/include/configs/warp7.h index 3b1e7c7e88..c9be70ca2a 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=" \ "fatload 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 " \