From patchwork Fri Jan 18 17:17:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 156023 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3497746jaa; Fri, 18 Jan 2019 09:18:02 -0800 (PST) X-Google-Smtp-Source: ALg8bN7ZMWltwEjwFY8ZFuF0VgkpkM7WlyuwIvSy0N5DRlbLO+QcwRmP+tGU34vyfwZubWo0/Tw1 X-Received: by 2002:a17:906:2615:: with SMTP id h21-v6mr15404252ejc.21.1547831882624; Fri, 18 Jan 2019 09:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547831882; cv=none; d=google.com; s=arc-20160816; b=Q8rPQmirdKprRmp9MXFgQUN1a8iA88yAh6OX0P4st/U//e33laZaZ+wUzuJrxA6xw8 XJL4VmMQiKzSkgNKI7Z3RYEV8SLQ3xy5s6Pr4GZg1+i+IAf3gDM6GWH9ciacKF97JOlR kT+iYGqk0eiDsFOVeRUTfrz44E0HYx91/SWCcKrKcBMtYpB4Bc0GY8kFjYe05J8kjYkJ GBLpjs38sJ3EDx6ZWqRQOCV86GQS0eVMb6DazIcf8MclX4C8UD+Ldv4CzSkz4n2TQZLk 37J10M2aBLiQa8xdvfN654RHmGLFZw5kqtgE28JPfj6io+yLjGxhGeEmPbIsbK8DNcqO b97g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature; bh=0jt2+sYkipQuXkovqSGVCghuzUPdn3WIxx7OhscecU4=; b=DPH5SQNKNf7vG2M85GgimwDLGEgxhXXWQIP4rwDFfAedp3WuqREc8oJ+ehIZzew1PA oLRNEgGVFV2z2bOJ+QN7UK/mprJ+VkhlAlGaTk7hITqhb2MUECreGEvbqvjRfG6Z9aL/ Nmr07x+MLuOKZLamGXIQrvU3wUCXDAX7WFLCvY0jtpQIKaswOvjgB+md4p2n0T7+FaSt YX1LXRx7eYDLuDRAUwrdwNlTMYFuxQrAnjNa1yCzqdDkUmSgRqA+x2ZNEogBp9k/coma h0jzDSe3H4bhxxv500zgJwCD29Yv7J2eCJpc2kcJlBZe6cPDNnRBl0IgGbSoNo4ln1By FmXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Zig46ggn; 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 h11si1904748edn.140.2019.01.18.09.18.02; Fri, 18 Jan 2019 09:18:02 -0800 (PST) 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=Zig46ggn; 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 1C485C2212E; Fri, 18 Jan 2019 17:17:59 +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 50263C21D9A; Fri, 18 Jan 2019 17:17:57 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AC9FAC21C6A; Fri, 18 Jan 2019 17:17:55 +0000 (UTC) Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by lists.denx.de (Postfix) with ESMTPS id 2D665C21DFF for ; Fri, 18 Jan 2019 17:17:54 +0000 (UTC) Received: by mail-ed1-f66.google.com with SMTP id y56so11671894edd.11 for ; Fri, 18 Jan 2019 09:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=z5E+2YGtH1atjOR8+VLE3xBEkRUx7ovdYClmtlfn0cI=; b=Zig46ggnRfztkZR5txX6Of9yFLC5KRpGgxYGKx268zLFWgkwkee2defReHEPQZYBLn UKnlRSai6Jwv7hCoRfH2cG3+bdRtne1+TAoX+H5d4Lf9fUncyR95JvDBm+ReBqsmFs36 iNFkSEjsQ5s04Zv2huvK8Td1plPB3tS64YRJ8= 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:mime-version :content-transfer-encoding; bh=z5E+2YGtH1atjOR8+VLE3xBEkRUx7ovdYClmtlfn0cI=; b=mSIRM4ZVOj1/U4Hkjj9cAjweH4mw1rsa+oY4WxZktTD6Im5l1aDm9XUMEFrlrMMzt5 sWsOG+1sUSWtcWpTfgcujHMc+0PRUsJS2WiIaYpOCACOaf85vawl+JwN2FVzFXzD9Z69 Mksl2uAXveKxh9Oiwyhaom2K7ZiuM91sZBAAwZw/Umfzz7FK/6EL506w10Ltm5Bkzc22 XQHuEDURpzQbiYG1xaF2fWgr6Xo6k96hfzx4XPqSmwYXUxboxwjUig+UuR8RzmV2MbjR YcnbrpCvKBqxuk8OW09nolDAWz/vp0PTT3fSC06Z4FxdnzyaFe2dKVtX5+cvUB/CJKfU 5suw== X-Gm-Message-State: AJcUukenC7qJhjS6gO1vghNr+PDXUgB822n1s4FzqHciv66DiXxdz14g o1E7XcwJ9wzCxR/gg3PQROEK0+Tdt34= X-Received: by 2002:a17:906:3b4b:: with SMTP id h11-v6mr15054594ejf.183.1547831873344; Fri, 18 Jan 2019 09:17:53 -0800 (PST) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id p21sm6929626edr.67.2019.01.18.09.17.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:17:52 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de, trini@konsulko.com Date: Fri, 18 Jan 2019 17:17:35 +0000 Message-Id: <20190118171735.17343-1-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [U-Boot] [PATCH] cmd: image_info: Add checking of default FIT config 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This patch adds a check for the default FIT config to iminfo. Once applied any signing of the config will show a pass fail similar to rsa+/rsa-. Output looks like this: Hash(es) for Image 0 (kernel@1): sha1+ Hash(es) for Image 1 (fdt@imx7s-warp.dtb): sha1+ Hash(es) for Image 2 (ramdisk@1): sha1+ Hash(es) for Image 3 (bootscr): sha1+ Hash for default configuration: sha1,rsa2048:mbl-fit-rot-key+ Signed-off-by: Bryan O'Donoghue Cc: Jun Nie Cc: Simon Glass Cc: Tom Rini Reviewed-by: Simon Glass --- cmd/bootm.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cmd/bootm.c b/cmd/bootm.c index c3a063474a..b3bd236165 100644 --- a/cmd/bootm.c +++ b/cmd/bootm.c @@ -244,6 +244,9 @@ static int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) static int image_info(ulong addr) { +#if defined(CONFIG_FIT) + int cfg_noffset; +#endif void *hdr = (void *)addr; printf("\n## Checking Image at %08lx ...\n", addr); @@ -294,6 +297,20 @@ static int image_info(ulong addr) return 1; } + cfg_noffset = fit_conf_get_node(hdr, NULL); + if (!cfg_noffset) { + printf("Could not find configuration node: %s\n", + fdt_strerror(cfg_noffset)); + return 1; + } + + puts(" Hash for default configuration: "); + if (fit_config_verify(hdr, cfg_noffset)) { + puts("Unable to verify default fit config\n"); + return 1; + } + puts("\n"); + return 0; #endif default: