From patchwork Tue Dec 18 14:45:55 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: 154144 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3796039ljp; Tue, 18 Dec 2018 06:46:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/XdwKVmFFZJcIvyjKH9Gi56D6NaL2exqhaf8fM0VK7yxKpsz6s5urBAlck0C9fREvkSa4Bs X-Received: by 2002:a50:e610:: with SMTP id y16mr295745edm.163.1545144365760; Tue, 18 Dec 2018 06:46:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545144365; cv=none; d=google.com; s=arc-20160816; b=VofsgdiwljGh75r7aDlgBfVBmIjWyneWaBx6S1/fYurtm+YCB3jnQoXhqLwzxIiyPq q2raFGqmoHvdJo2zfU8IfMEEhdZv7n0r2LFXtkHzHQx+E+6ZjNyozgqPmLnxFa/MWMV/ HnO1kukV9Inn2SUJdUunJeM8juZ5HxasYH7YDt1sEps7oWCCskcXRNxadrBRlQIRbkxk 1+rQC/85RCbNHxWoIwfgF2nUyP9VHDC9mEPNE/SlkqI7DwNln6MsxNetzrI8j++y1Ye5 O84XJ//dY91icT8hXQAPdJbHSrnZ9WeDVJjM4CBYcHh6wF2hyOOBC8R0WNIGkEub5luR MwJQ== 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 :cc:mime-version:message-id:date:to:from:dkim-signature; bh=ZCix5E3uUVUfKT3EEca2HJaCD8mhrZVUk1Bm3J9Pgzc=; b=ndcf+4b48scgS9/t10kHS59+8emtmC2HpRXRKpfrnaJd+9Rr0VkyJ/QqGiwNnV+i/j 2J5U4l8XAKjul4X6pMrL1GV3Lrb7wQF4xAIHd9fyM8ZTpcQrCgKv5Zpv8sR/Pd2fLQcs tdqXXgImYp2Qb2Mf4S2UsM9MlnZP2oeD/YaszQCtINY4zQsTMI9MqIubpnEdFdcigBep Lcba04BiGFC7JXhxDZoHHonACXh1t8n9VMb1ZN0vZ9adE2GyKC2Ak7nulysFRhOkE/My x3QQZIWuherVlkujE9Um8n3b341qdYDanN4MebNcgChOWqYwYjhMQ6jXQmoLzNN64nx1 EXug== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bKyOxorH; 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 k54si994809edb.369.2018.12.18.06.46.05; Tue, 18 Dec 2018 06:46:05 -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=bKyOxorH; 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 0C061C21F1B; Tue, 18 Dec 2018 14:46:03 +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_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 9AF2BC21DDC; Tue, 18 Dec 2018 14:46:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D4CC0C21E30; Tue, 18 Dec 2018 14:45:59 +0000 (UTC) Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by lists.denx.de (Postfix) with ESMTPS id 7A6F3C21DDC for ; Tue, 18 Dec 2018 14:45:59 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id b14so14077017edt.6 for ; Tue, 18 Dec 2018 06:45:59 -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=G6DiYP3e9iR6O1gqu9ilDqbnKOQBSPG5GMqdyIIXNhw=; b=bKyOxorHULaDSgYaBaankngHlUumQxrfZaDvpEwyBc5TFFOkJamVtPrzU25D5fs+69 eD2xftfrpoWjegSUS+5wHkA2asQL/ZlT0QUl6eXUaR707ZoiB3/+hwU9xabN3kWeJTnk lvon0o89p2Y35fo0HmI5zpJ1KqCd/sjYUEDyw= 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=G6DiYP3e9iR6O1gqu9ilDqbnKOQBSPG5GMqdyIIXNhw=; b=nwgyioK+U3r4arC1K/c4RyMaAe1A6qUS4Zy3wVyYchevHC6I7HG7au+9XNj2oEImKL orCm2dNHDUZOXwmCllOKdajTAGVIrrsIOw0KnPrC7ADxcT6M7lmjRYbvLh9yNiybOdjs O2TDNIV1JYGYDh+29Xt0ZRg+LZ/Y0pcoVzaBUMQEHSDFY1m9nB11mUXhy1/i9/hK2WmP /WNiLkWAezeKkRvQqfqnNfxMz5KmRR4IyQYuqTZhGPuBoPY4FyBOrjmc0sMZ2sTufCAb ycbpKeTp1cZ7eXgqLztm3hosIr767HDHK17E5lDqtRZpYbfl0IXW3AMz9rUkKuWyyScm RXCA== X-Gm-Message-State: AA+aEWYa7Iqo5loKuAUXUKyI0t2M2zizAT+so1ZtCSv3etlPBnr3SJk5 oMwbovvZpqJkm9NmjtN4qqRXSwg3lt4= X-Received: by 2002:a17:906:3712:: with SMTP id d18-v6mr13308047ejc.126.1545144358678; Tue, 18 Dec 2018 06:45:58 -0800 (PST) Received: from event-horizon.net ([80.111.179.123]) by smtp.gmail.com with ESMTPSA id z40sm4421124edz.86.2018.12.18.06.45.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Dec 2018 06:45:57 -0800 (PST) From: Bryan O'Donoghue To: u-boot@lists.denx.de Date: Tue, 18 Dec 2018 14:45:55 +0000 Message-Id: <20181218144555.16992-1-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Cc: Tom Rini 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: