From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62C3FC433EF for ; Mon, 10 Jan 2022 17:59:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 71A3D83201; Mon, 10 Jan 2022 18:59:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com 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=gmail.com header.i=@gmail.com header.b="ex9br6vF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1D92781432; Mon, 10 Jan 2022 18:48:39 +0100 (CET) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 15C3A831CD for ; Mon, 10 Jan 2022 18:48:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eichest@gmail.com Received: by mail-wm1-x32b.google.com with SMTP id l4so9315877wmq.3 for ; Mon, 10 Jan 2022 09:48:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/XffjcswEnNay1kbPQoJiv2Pp/zs2md98RuShVq30BU=; b=ex9br6vF8PyXIw8XieumyG8d7LWCmHxULsoj1G20YTuqbJjT+d/+aiNV7+86mrNECA ADDlKzz1xQY/Bt0Y3pD5AdH3Pduwaw8CJ4PXRTSbmfIL0yA1p/OFvovTLWpe/Xh0JF7s yAmtl3kP8GVH/2KXyQQG7O99f1BtXaTSUbdZjLbhWB4866tsBG4xrXsRQrQkPKvxMFaj KXDp+naZZf28ig8JSEWNcQfyxUAOJmG66CqRI2tIOcB4N7MCLJFGI1z1zbO15GqP8fwg qzBCzqbABoBi1YK5KN2elkkOm/SzFFVENsrFdUva3YTvg2uxdgvpN72/unQ50An8k5rz DnwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/XffjcswEnNay1kbPQoJiv2Pp/zs2md98RuShVq30BU=; b=iLCJicUN/e5C8YqmtGVrX1u/jO90syqaUoetaH3CtXAEF3iAm4ry5p8qS4pPjaMVw5 5WZdPBHk0iRtF7HB82Y9Rlf9P4vsSfUHwQmXVsCq89qaqWyklAwmThoC0WlZDhSmpsD0 uNSLEw2znYhb+uN8EQlkI69IJhF1pAePD8pUNVoDsLgI1CxCX2fjONcE5DCqO4lUtzP4 9uYvHwGkgyiEba0VF1UTTvSanH5heA9XCD5lm/0riRTnBv/PRo9dlG7jt9MKBwr+xbnM 9KSP/YKAOUxOoDAz+9TxsZnlNI971lDf0gWbDMdHBwlTME3vv+d/+u+rUEfnJah7myc4 RD4w== X-Gm-Message-State: AOAM530rgfF2qHQNxf4IO5KUJYY2nJi+i9cYKSdFOFlbQfAKKaXH7w2G gu3SCv/I10dqiapqfUJDv50= X-Google-Smtp-Source: ABdhPJx/S0vN9jUvnL3O/NSRXLrF0IPISNgUAO69EfxdjIogW9JjNqARF1iLQdfVJncsSxuMbSrQxg== X-Received: by 2002:a05:600c:384f:: with SMTP id s15mr23667115wmr.179.1641836914658; Mon, 10 Jan 2022 09:48:34 -0800 (PST) Received: from eichest-laptop.lan (77-58-180-85.dclient.hispeed.ch. [77.58.180.85]) by smtp.gmail.com with ESMTPSA id u14sm6994482wrf.39.2022.01.10.09.48.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jan 2022 09:48:34 -0800 (PST) From: Stefan Eichenberger To: devel-sven@geroedel.de, mr.nuke.me@gmail.com, sjg@chromium.org Cc: u-boot@lists.denx.de Subject: [PATCH 2/2] tools/fitimage: make sure dumpimage still works when "@" are detected Date: Mon, 10 Jan 2022 18:48:32 +0100 Message-Id: <20220110174832.257300-3-eichest@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220110174832.257300-1-eichest@gmail.com> References: <20220110174832.257300-1-eichest@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 10 Jan 2022 18:58:59 +0100 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.2 at phobos.denx.de X-Virus-Status: Clean fit_verify_header fails if it detects unit addresses "@". However, this will break tools like dumpimage on fit images which worked with previous versions of the tool (e.g. 2020.04 vs 2021.07). As an example the output of: dumpimage -l is: FIT description: U-Boot fitImage for Linux Distribution Created: Thu Jan 1 01:00:00 1970 Image 0 (kernel@1) Description: Linux kernel Created: Thu Jan 1 01:00:00 1970 Type: Kernel Image Compression: gzip compressed Data Size: 6442456 Bytes = 6291.46 KiB = 6.14 MiB Architecture: AArch64 OS: Linux Load Address: 0x80080000 Entry Point: 0x80080000 Hash algo: sha256 Hash value: ... Image 1 (fdt@freescale_fsl-s32g274a-evb.dtb) Description: Flattened Device Tree blob Created: Thu Jan 1 01:00:00 1970 Type: Flat Device Tree Compression: uncompressed Data Size: 39661 Bytes = 38.73 KiB = 0.04 MiB Architecture: AArch64 Hash algo: sha256 Hash value: ... Default Configuration: 'conf@freescale_fsl-s32g274a-evb.dtb' Configuration 0 (conf@freescale_fsl-s32g274a-evb.dtb) Description: 1 Linux kernel, FDT blob Kernel: kernel@1 FDT: fdt@freescale_fsl-s32g274a-evb.dtb Hash algo: sha256 Hash value: unavailable But with newer version it shows: dumpimage -l GP Header: Size d00dfeed LoadAddr 62f0a4 This commit will output a warning that unit addresses were detected but will not fail: dumpimage -l Image contains unit addresses @, this will break signing ... Signed-off-by: Stefan Eichenberger --- tools/fit_common.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/fit_common.c b/tools/fit_common.c index 52b63296f8..5c8920de54 100644 --- a/tools/fit_common.c +++ b/tools/fit_common.c @@ -26,10 +26,18 @@ int fit_verify_header(unsigned char *ptr, int image_size, struct image_tool_params *params) { - if (fdt_check_header(ptr) != EXIT_SUCCESS || - fit_check_format(ptr, IMAGE_SIZE_INVAL)) + int ret; + + if (fdt_check_header(ptr) != EXIT_SUCCESS) return EXIT_FAILURE; + ret = fit_check_format(ptr, IMAGE_SIZE_INVAL); + if (ret) { + if (ret != -EADDRNOTAVAIL) + return EXIT_FAILURE; + fprintf(stderr, "Image contains unit addresses @, this will break signing\n"); + } + return EXIT_SUCCESS; } -- 2.32.0