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: 894396 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="f5G3dbPx"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40FS951lzdz9s1r for ; Tue, 3 Apr 2018 08:50:01 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E7BD3C21EBB; 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-Google-Smtp-Source: AIpwx49iHcxXNEEmPGUJS3TBI6RuOBAFq1RFnxK+RIL7YMcWjM0CaMB1M3y204ThCtwIx3rH//rr3w== 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 " \