From patchwork Sun Jan 29 16:45:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1733611 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=WuLL2xrS; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P4cfB1FK4z23hg for ; Mon, 30 Jan 2023 03:46:42 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1A8F48574C; Sun, 29 Jan 2023 17:46:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="WuLL2xrS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C16785518; Sun, 29 Jan 2023 17:46:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 041EF85608 for ; Sun, 29 Jan 2023 17:46:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC14260C6E; Sun, 29 Jan 2023 16:46:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0857FC433D2; Sun, 29 Jan 2023 16:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675010784; bh=8ZFTLhmDtiAl5vqCdZTe2JSGSUlZSqyQ/tgOHb3MdxA=; h=From:To:Cc:Subject:Date:From; b=WuLL2xrSNV0wAFANJ04orpanr5UT5jqiS0tV6AvLLlwB+gfluFqt0MOPp2jPZmMwm dX0Udl3nKguCd+jqeSCnqx2vLT9TvGskkhc99kAMZINxu+nmwuOjbpK1emhZXYM0tm DhwKumHVdnDk7/XA1zlIl2x+78fvPsxUijKBB2krxUWEsooqSrE3nWQi9/LFdOn02O Dx/YUK0IK6Xc3bNrDe51/nZJ6mw1cMWWK0TY1/k/kfBdjzyzS+cpyNwyVuco6kiNPs Q1aki4tqnKzqcXIWc92/0kg9CLeWMkF9rYRfaI2uSm+/cRiIgUcGoYOcDNgfWB0M/I zfqWuUgAyVtWg== Received: by pali.im (Postfix) id 284FF976; Sun, 29 Jan 2023 17:46:21 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH u-boot 1/3] tools: imagetool: Fix error message when verify_header is undefined Date: Sun, 29 Jan 2023 17:45:53 +0100 Message-Id: <20230129164555.9940-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Signed-off-by: Pali Rohár --- tools/imagetool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/imagetool.c b/tools/imagetool.c index f14ca2fb979f..688169b3a813 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -105,7 +105,7 @@ static int imagetool_verify_print_header_by_type( } } else { - fprintf(stderr, "%s: print_header undefined for %s\n", + fprintf(stderr, "%s: verify_header undefined for %s\n", params->cmdname, tparams->name); } From patchwork Sun Jan 29 16:45:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1733610 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=U04N7Q8o; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P4cf14XN8z23hg for ; Mon, 30 Jan 2023 03:46:33 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 50496855A1; Sun, 29 Jan 2023 17:46:30 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="U04N7Q8o"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 95ABF8573B; Sun, 29 Jan 2023 17:46:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6FCBC85518 for ; Sun, 29 Jan 2023 17:46:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1BC06B808CD; Sun, 29 Jan 2023 16:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C839C433EF; Sun, 29 Jan 2023 16:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675010784; bh=OTnFNHz6EjqXvoDiErFeo0llDNNj7PcY/YMv9Bu9x+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U04N7Q8oWB6PC6h12tFzmsq0cmp/J7eO2i9tuV/2Pkso2onFgX+RsoSjMPFhfbr0F AOjpyJcea5DustxS2vdKf4Agt6LJojcYRV+MQQvaKN/g3ovFvhJbBAR9D7qrj0bqPo Z+iYoxFIUE/DLcWvN2X3iCgkEZKrEMbbyMxXmYhb1+9bQE7EuLdwYraS6vA01esCZ4 jJIwMXjNvAixq2N+K32gL/W166jNAelkAleO1uehYr6UqJHw9wUA1LOtrWrphG5Zm3 dubGjjr85qJXbn5gFrHSAJX2hPSEC0L4mKM55VMVvjWpm6xOQSst4ffcG7Ze6bFugD dKrgzKfeQpqFA== Received: by pali.im (Postfix) id 1F69BB73; Sun, 29 Jan 2023 17:46:22 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH u-boot 2/3] tools: imagetool: Show error message when detecting image type failed Date: Sun, 29 Jan 2023 17:45:54 +0100 Message-Id: <20230129164555.9940-2-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230129164555.9940-1-pali@kernel.org> References: <20230129164555.9940-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Signed-off-by: Pali Rohár --- tools/imagetool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/imagetool.c b/tools/imagetool.c index 688169b3a813..e1021f44f5ad 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -71,6 +71,11 @@ int imagetool_verify_print_header( } } + if (retval != 0) { + fprintf(stderr, "%s: cannot detect image type\n", + params->cmdname); + } + return retval; } From patchwork Sun Jan 29 16:45:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1733612 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=g7+hks3H; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P4cfN2B9fz23hg for ; Mon, 30 Jan 2023 03:46:52 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D44A48573B; Sun, 29 Jan 2023 17:46:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="g7+hks3H"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 24635856DD; Sun, 29 Jan 2023 17:46:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B21C185720 for ; Sun, 29 Jan 2023 17:46:27 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A57B60DDF; Sun, 29 Jan 2023 16:46:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87355C4339B; Sun, 29 Jan 2023 16:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675010785; bh=gD5Oe9nknAyhghE5bttG5MmATHtmrQVDYxVHThV+/F4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g7+hks3HZzO4kJ2dEQdg+6YsXJy3K7ZwdKsO6EVVdUs1KgiOINSPLvTDh9GWw4Zza La3c5vcMO8gZkG/G9ZCMe2q0YqjlDFizIMwU0SiCtP2WJ2scNC1wngmh/CsYk0zbIH FfCxbjON4R4D6CmCjDg+fVs/zj4JXcxgfrbISRWZUZopyPfca3tjFGG3QTbt63oObW GGu+0LGG046XfXNp8uIcakW54o7h8+X5dkIrQe9cgT8whbAlMQMqlMGjHMzHMSnpC5 Xkm8ErHqBrhevk+6gSJSUnUgeA+mdFV1Zg9S2fKtY7UKJRge89CM+KTlOYGpu3Adn1 aZl9D904+kBlA== Received: by pali.im (Postfix) id 1EED8EFE; Sun, 29 Jan 2023 17:46:23 +0100 (CET) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH u-boot 3/3] tools: imagetool: Skip autodetection of gpimage type Date: Sun, 29 Jan 2023 17:45:55 +0100 Message-Id: <20230129164555.9940-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230129164555.9940-1-pali@kernel.org> References: <20230129164555.9940-1-pali@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean gpimage type requires only that two first 32-bit words of data file are non-zero. So basically every random data file can be guessed and verified as gpimage. So completely skip gpimage type from image autodetection code to prevent lot of false positive results. Data file with gpimage type can be still verified and parsed by explicitly specifying -T gpimage. Signed-off-by: Pali Rohár Reviewed-by: Simon Glass --- tools/imagetool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/imagetool.c b/tools/imagetool.c index e1021f44f5ad..87eee4ad04ed 100644 --- a/tools/imagetool.c +++ b/tools/imagetool.c @@ -49,6 +49,12 @@ int imagetool_verify_print_header( return imagetool_verify_print_header_by_type(ptr, sbuf, tparams, params); for (curr = start; curr != end; curr++) { + /* + * Basically every data file can be guessed / verified as gpimage, + * so skip autodetection of data file as gpimage as it does not work. + */ + if ((*curr)->check_image_type && (*curr)->check_image_type(IH_TYPE_GPIMAGE) == 0) + continue; if ((*curr)->verify_header) { retval = (*curr)->verify_header((unsigned char *)ptr, sbuf->st_size, params);