From patchwork Mon Jan 11 14:46:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 1424665 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: 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: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=rhVkEXWZ; 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 RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DDxPp37MBz9sWC for ; Tue, 12 Jan 2021 01:47:19 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D4811826CF; Mon, 11 Jan 2021 15:47:07 +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="rhVkEXWZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 166C3826E1; Mon, 11 Jan 2021 15:47:06 +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.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (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 30984826C8 for ; Mon, 11 Jan 2021 15:47:03 +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=mr.nuke.me@gmail.com Received: by mail-oi1-x236.google.com with SMTP id d203so20394098oia.0 for ; Mon, 11 Jan 2021 06:47:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=1AzZLjtBzh4p9I2ji3ueVo1KIEMcLS45C75d58eL7ZU=; b=rhVkEXWZtKJjMxXKHmYTXoRj++1mBEjdTPbJrRsyeK+Xzq8VYzV9zMs7SCksAkFsuc Qqk7uX2SfFxVgUh3AZZJukQ9NE6qQZCbVuXGasz1cmWvhS8hYMki4wT2zZCClVkfNX// gFEj8ljNm6RY2BWu47RNT2psxxPg/1iHslLn2f3yfF334q1H0aICbBiGS1iDNdOhso8Y pN/39YKtjqo+PMbzG5OP2RXSx20+Ixx1B184O8eKOseyHyDLs7BH23vf+IcRniX5fvVp mzKINtD44mw7IkwJZX0xdEcagz+E0MvFFXnNi14yBwz17fgP2I3ZDZbjkj5o5THIj1aT MjFQ== 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=1AzZLjtBzh4p9I2ji3ueVo1KIEMcLS45C75d58eL7ZU=; b=iR7mB0NRc+0BWHFYlHKg10kgt5L/7dzBm0E+KT1T5cFA43rHPT2VmDUbrcNVnrd2/X Z2HytY0Gg2BZTmVVNIQeOsFj9J+9gFQo9G4qft4YoviCWEA23i7ctlNRB7yuoeBcUokE XBV8hSe57DqfXFN6b8A7i15TgGAFaVKHeYDIzW5gvpXX27cnk6cjk3kWEacKCGKkhpcR WXALeGvIbqwACg8CX6E8KEpXDc1Zt4zvrxB4FVHd9hdUMfGmvWvDJbnbnZ2fWmQedVPg 2e3l+1/6FJ4Wj/5fvCNEd5sMpcJnrLSebhOUig5H9jrjt2ihQD1MiLfmbQ8rAxvBmPJo KLBg== X-Gm-Message-State: AOAM532q2IVHXup7Op8UZIXajPWakvMvASkHjPzfERcad5kP6Uq6KKcd ZaTXnPqJqmpY1SKLeKFcceMiTXSOYw/uig== X-Google-Smtp-Source: ABdhPJw3Fs8M2St04H2vKfB7OPTKIuOXjEQHlg1vF+5hxp8vaA/TLLwQu/lOIBwKPoS0tmf8N0qY7w== X-Received: by 2002:a05:6808:7d0:: with SMTP id f16mr10439372oij.109.1610376421260; Mon, 11 Jan 2021 06:47:01 -0800 (PST) Received: from nuclearis2-1.lan (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id w6sm3680640otm.54.2021.01.11.06.47.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jan 2021 06:47:00 -0800 (PST) From: Alexandru Gagniuc To: u-boot@lists.denx.de Cc: Alexandru Gagniuc , trini@konsulko.com, marex@denx.de, sjg@chromium.org Subject: [PATCH] common: fit-sig: Fix error message in fit_config_verify_sig() Date: Mon, 11 Jan 2021 08:46:58 -0600 Message-Id: <20210111144658.620037-1-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean In fit_config_verify_sig(), when no 'signature*' subnode exists in the configuration node, the fdt_for_each_subnode() loop is a no-op. Therefore, no error flags are set, and 'err_,sg' is not populated with an error string. This is incorrect behavior. Populate err_msg to indicate that no 'signature' is found, before entering the loop. The first call to fit_image_verify_sig() will override clear err_msg, or set it to a more specific message. Signed-off-by: Alexandru Gagniuc Reviewed-by: Simon Glass --- common/image-fit-sig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c index 7fcbb47235..f8a68b08dc 100644 --- a/common/image-fit-sig.c +++ b/common/image-fit-sig.c @@ -374,7 +374,7 @@ static int fit_config_verify_sig(const void *fit, int conf_noffset, const void *sig_blob, int sig_offset) { int noffset; - char *err_msg = ""; + char *err_msg = "No 'signature' subnode found"; int verified = 0; int ret;