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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 53261C53200 for ; Wed, 29 Jul 2026 04:55:43 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0C395810A3; Wed, 29 Jul 2026 04:55:43 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id RzMl6G8MpYIG; Wed, 29 Jul 2026 04:55:41 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 3116F8100F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org ; s=default; t=1785300941; bh=bQr8HtSOCkcvmJvbux6/d2biRjAYkuPZlT6Y2mFv4tY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=E6xWq21gu/kXUG1iP4PNaHQP8E84JuRzPVf8eRW/7dHRTfNa14VjwMS6s/HcOFTEl bNdJp2gJ898pLM9r+m416aWAi4EvppjI8TLSuf8LQAbAQUUfVeWD1JufKP34LHORtR upDeYJl+zziW/qqML3JRYE1i73bBfqQtbPnyFRbClb95H30WVS560bLylaedy9NSnT PYpZfZz8WaODKoNUUIVLDdbnjoMbGJeAKnq0ryjCdnK4CD2zib54OnbGHHrXabxCOF 2cGxHzg8wZpzWWzmWaJBWy8+dK5pYPLVuvGWC/eAz+0KY0t4fEcb5BcGefkhahDU6s cf1bVel/0pAHg== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 3116F8100F; Wed, 29 Jul 2026 04:55:41 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists1.osuosl.org (Postfix) with ESMTP id B2BAB788 for ; Tue, 28 Jul 2026 17:44:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 99316608A8 for ; Tue, 28 Jul 2026 17:44:04 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PdFM3CINKHHf for ; Tue, 28 Jul 2026 17:44:04 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2607:f8b0:4864:20::333; helo=mail-ot1-x333.google.com; envelope-from=james.hilliard1@gmail.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org D1D41608A9 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D1D41608A9 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by smtp3.osuosl.org (Postfix) with ESMTPS id D1D41608A9 for ; Tue, 28 Jul 2026 17:44:03 +0000 (UTC) Received: by mail-ot1-x333.google.com with SMTP id 46e09a7af769-7eb545db3afso117239a34.0 for ; Tue, 28 Jul 2026 10:44:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785260643; x=1785865443; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=bQr8HtSOCkcvmJvbux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q2V9v6+iLVnmqHkXi/mcn7C61OxCLNCKsbadCoxZt6aFy4SsKwDBUeBOq22lfcQ l5AEjWdbPuCghpQfS1qEp7FExhlWzYKgjZ5waC7nVC7kAzNpTlXQ7hvzuN/tieP1Fc= X-Received: by 2002:a05:6830:6f8d:b0:7d7:e142:2ead with SMTP id 46e09a7af769-7efff25f6e7mr1757624a34.20.1785260642539; Tue, 28 Jul 2026 10:44:02 -0700 (PDT) Received: from [127.0.1.1] (71-218-31-69.hlrn.qwest.net. [71.218.31.69]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7f00d94389dsm271103a34.21.2026.07.28.10.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 10:44:02 -0700 (PDT) From: James Hilliard Date: Tue, 28 Jul 2026 11:41:47 -0600 Subject: [PATCH v6 04/13] boot: image: try all DM hash providers MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260728-submit-ce-series-v2-v6-4-80c1f7daffa5@gmail.com> References: <20260728-submit-ce-series-v2-v6-0-80c1f7daffa5@gmail.com> In-Reply-To: <20260728-submit-ce-series-v2-v6-0-80c1f7daffa5@gmail.com> To: Svyatoslav Ryhel , Ion Agorria , Aspeed BMC SW team , Joel Stanley , u-boot@lists.u-boot-project.org Cc: Chen-Yu Tsai , Samuel Holland , Tom Rini , Simon Glass , James Hilliard , Thierry Reding , Quentin Schulz , Quentin Schulz , Marek Vasut , Marek Vasut , Rasmus Villemoes , Rasmus Villemoes , Aristo Chen , Anton Ivanov , Daniel Golle , Francois Berder , Peng Fan , Neil Armstrong , Randolph Sapp , Jonas Karlman , Wolfgang Wallner , Alexey Charkov , Ilias Apalodimas , Heiko Schocher , "Kory Maincent (TI.com)" , Anshul Dalal , Johan Jonker , Francesco Valla , Heinrich Schuchardt , Michael Walle , Andre Przywara , Lukasz Majewski , Richard Genoud , Michael Trimarchi , E Shattow , Enric Balletbo i Serra , Mattijs Korpershoek , Lucas Dietrich , David Lechner , Julien Stephan , Kuan-Wei Chiu , Bastien Curutchet , Raymond Mao , Ryan Chen , Chia-Wei Wang , "Lucien.Jheng" , Mateusz Furdyna , Dinesh Maniyam , Heiko Stuebner , Vincent Jardin X-Mailer: b4 0.15.2 X-Mailman-Approved-At: Wed, 29 Jul 2026 04:55:22 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785260643; x=1785865443; darn=lists.u-boot-project.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=bQr8HtSOCkcvmJvbux6/d2biRjAYkuPZlT6Y2mFv4tY=; b=RxldA2mVX4QHPT2bOKjkXJbCnF/BYdZKN/Spk8oHRQ+fyRrs1Hsw5RyRDhFTDdRLZ4 OqxQxrGh7UZqOt1NcFtJvuMCniUTcPVYCP4EBguJhThSRJCwqGI79RyI6Z6x2CjKvTMf RsoK0umtmZp5Ht4zbmxYzywGgPp+w+dx1n9uGAbb/lreb1RsIY6R8C++2fZ9cak4NT7a Hw+ijUULdjQyDZS9cfoSyzmj2m0fs6sMRg9kGJQ77XrvKJ27c7DBRitjLaW5Q4q9l1mt gwAHLXxWBayUjGelT6ZvfGoRXLvDpRKy7pd+ur8qBqpsAsW2mV64ZeFKCLAbRtbKSRp/ nlag== X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=gmail.com X-Mailman-Original-Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=RxldA2mV X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org Sender: "U-Boot" FIT hash calculation currently selects UCLASS_HASH device zero directly, so a provider which does not implement the requested algorithm prevents a later capable provider from being used. It also turns every provider error into the same generic FIT hash failure. Use the common hash provider-selection helper. Fall back to the configured software implementation only when no DM provider supports the algorithm, and preserve probe and digest failures from providers which accept it. Reviewed-by: Simon Glass Signed-off-by: James Hilliard --- Changes v3 -> v4: - New patch --- boot/image-fit.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/boot/image-fit.c b/boot/image-fit.c index d7d7c70fe76..9b39696de2d 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -1322,30 +1322,22 @@ int calculate_hash(const void *data, int data_len, const char *name, #ifndef USE_HOSTCC int rc; enum HASH_ALGO hash_algo; - struct udevice *dev; if (CONFIG_IS_ENABLED(DM_HASH)) { - rc = uclass_get_device(UCLASS_HASH, 0, &dev); - if (rc) { - debug("failed to get hash device, rc=%d\n", rc); - return -1; - } - hash_algo = hash_algo_lookup_by_name(name); - if (hash_algo == HASH_ALGO_INVALID) { - debug("Unsupported hash algorithm\n"); - return -1; + if (hash_algo != HASH_ALGO_INVALID) + rc = hash_digest_wd_lookup(hash_algo, data, data_len, + value, CHUNKSZ); + else + rc = -EOPNOTSUPP; + if (!rc) { + *value_len = hash_algo_digest_size(hash_algo); + return 0; } - - rc = hash_digest_wd(dev, hash_algo, data, data_len, value, - CHUNKSZ); - if (rc) { + if (rc != -ENODEV && rc != -EOPNOTSUPP) { debug("failed to get hash value, rc=%d\n", rc); return -1; } - - *value_len = hash_algo_digest_size(hash_algo); - return 0; } #endif -- 2.53.0