From patchwork Thu May 16 21:11:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1936236 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=GX+VEroP; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VgN8N3hP5z1ydW for ; Fri, 17 May 2024 07:12:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B660488479; Thu, 16 May 2024 23:12:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="GX+VEroP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 50FC18841A; Thu, 16 May 2024 23:12:14 +0200 (CEST) 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,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 mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 5746488485 for ; Thu, 16 May 2024 23:12:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raymond.mao@linaro.org Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-34db9a38755so8142998f8f.1 for ; Thu, 16 May 2024 14:12:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715893931; x=1716498731; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fH6wOjlXus9XRxcoUmvggSCArd/WRtoojfpukFv8ieo=; b=GX+VEroPcJhPbA1DIxhnOZ4eSPvtbVV+ZZvyi0VoOSVdhhL2/TgSwtJm5Yi7mm9RE/ bwZi2lqL+9DBQm3WNONWiVVrnqj22RqesHG8KDZHD8amnS/MoB+mBy9uRWmDEqL78k5y XQtNSMhJKLkvzy1Nx3CA9GVwOkSyQoJb57um9GbShBCfm0AnsxbQLOxSNelpaEB3RVXq MY2PFdBMR89eTBW/0m3kTQS0rKvd64vaxvuQoUZTJmAe6EsbW5uSg6L7Vx0ImJ03BxhD siFiGAsJneRoXr3GAaCOw35CbWjaX8ufrJipbbccFmd6SA34Lf8g/TszQBy4+qVFEyyy qJxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715893931; x=1716498731; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fH6wOjlXus9XRxcoUmvggSCArd/WRtoojfpukFv8ieo=; b=ZMMkZ68fXto5baK3tAuBCZaBfWmNlmwSP0ZgX2x62sOKYtSc9xBiQoDgAoQamiB2Wl CA3j8NOJvoed6v3fGw2gNr1VpzXnXDMlmYJ+DTTFr5gTdo714pUpRSwyqND1veSKA5V8 mA1ZpM6KBBmtWbK5Hj+djBHzZ9X2MN6m+b3beTiASEjjORm2k8j9f07akq8g6DtOAlho hBu2dkq25cTgBk6OF2w4lDmJfOaUFCFwDwk3UWRNA7zrM+sQv4iwGYLGI74/02uY0bxv fzasFFt5TLnbb3VdEC1oaCsk2xhNSAW8cgcAMba6SzSChbLlC0O7DtWRw0gDg6H4F3jT 9PXw== X-Gm-Message-State: AOJu0Ywxs1nBUlgkiizJyuajEVITarWLTkQih4dnzzYP+lTMo4swds0p 4muCk9i926QYS+KlddsCJ/RcI3YE7y5dXdJ6kA+PWkUJc65Izj0yONUYLCb3utQ9XE3u55Q69fj l X-Google-Smtp-Source: AGHT+IFJpoCldjyavUpBGvFjzx1EAXYga69vDk6QR4WHMTpYQ21ZTIzWYghEdrXkzgeJVNsMYbUdIg== X-Received: by 2002:a05:6000:1042:b0:34c:54c8:3f2d with SMTP id ffacd0b85a97d-3504aa63858mr15432492f8f.69.1715893931094; Thu, 16 May 2024 14:12:11 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7d09sm1021582266b.107.2024.05.16.14.12.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 14:12:10 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Tom Rini , Igor Opaniuk , Ilias Apalodimas , Alexey Brodkin , Eugeniy Paltsev , Phil Sutter , Tony Dinh , Walter Schweizer , Mario Six , Heinrich Schuchardt , Simon Glass , Nishanth Menon , Roger Quadros , Jonathan Humphreys , Marek Vasut , Bin Meng , Caleb Connolly , Eddie James , Masahisa Kojima , Jassi Brar , Masami Hiramatsu , Michal Simek , AKASHI Takahiro , Etienne Carriere , uboot-snps-arc@synopsys.com Subject: [PATCH v3 1/4] image: remove redundant hash includes Date: Thu, 16 May 2024 14:11:49 -0700 Message-Id: <20240516211156.1819939-2-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240516211156.1819939-1-raymond.mao@linaro.org> References: <20240516211156.1819939-1-raymond.mao@linaro.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.8 at phobos.denx.de X-Virus-Status: Clean Remove the redundant includes of u-boot/md5.h, u-boot/sha1.h, u-boot/sha256.h and u-boot/sha512.h Signed-off-by: Raymond Mao Reviewed-by: Tom Rini Reviewed-by: Igor Opaniuk Reviewed-by: Ilias Apalodimas --- Changes in v2 - None. Changes in v3 - None. boot/image-fit.c | 4 ---- boot/image.c | 2 -- 2 files changed, 6 deletions(-) diff --git a/boot/image-fit.c b/boot/image-fit.c index fb03cab831b..f6464bcf620 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -37,10 +37,6 @@ DECLARE_GLOBAL_DATA_PTR; #include #include #include -#include -#include -#include -#include /*****************************************************************************/ /* New uImage format routines */ diff --git a/boot/image.c b/boot/image.c index eb12e4be04a..bacf5146e13 100644 --- a/boot/image.c +++ b/boot/image.c @@ -25,8 +25,6 @@ #endif #include -#include -#include #include #include From patchwork Thu May 16 21:11:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1936237 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=nuDmAqX8; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VgN8Y5jffz1ydW for ; Fri, 17 May 2024 07:12:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 359C188488; Thu, 16 May 2024 23:12:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="nuDmAqX8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DEC9288490; Thu, 16 May 2024 23:12:22 +0200 (CEST) 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,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 mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (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 012C188486 for ; Thu, 16 May 2024 23:12:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raymond.mao@linaro.org Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a59b81d087aso343904066b.3 for ; Thu, 16 May 2024 14:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715893939; x=1716498739; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4M9/M4NQ4sJT2Ey+CGPaC9WJfX7bubF8lZzmPc0HNXg=; b=nuDmAqX80y7N2J9dO5z5NPwcM+P/mLC1XPpVOMIHMXb0K4aqIvh7/lTAERwrVlo0B0 CCqUwU1f5cTjbeJ7swZO4zqhV/hPT7OGwYM44gWcODHrD1NNiEoMEqGyDgPykLXAgFIq OJjwTxXd/sMvvU4dnPYgYKagCeVRagZsaRySU3J9o1Ctwqeq2ohBNExsc4wdsf9detuu 5Pn7KhrDl6d/sq0EOKpzRAZQVBO+Rr+ZdlgrTrkcUVr2tXu1Rxmtl7ts4aYksqxVtz+o FKwE6bFOS8QUWqsKhnYsV3A6RAX+T3Pt7sMIf7sDWp9QvlsN3gANZ3tpVZ4ZpJ3FR0WI RnmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715893939; x=1716498739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4M9/M4NQ4sJT2Ey+CGPaC9WJfX7bubF8lZzmPc0HNXg=; b=izUnCbT0zXzSwF7Ekwh6y3JW6Ie0zPHv1sA2XdHKG2yaNXVIWsDNghzPWScKVeQVcF Zqjl8YOV9kblMZj76PQhiNlU4n4/NbyDRixcj6fCnROgF2A6FJGlfab/Zf5R8BdJzaEF lNrsYT7Br9nWwf/Haee1hUmSUERDTA3KCyunpd+8VC/TDU0GAACZtuv877nIQd5tYDsg 0Qayvg0LYWzqzlZFM4hOR9CovDqRDrN2TWlXcfqv4xamQHJPQAqO4fLEC2TuyhkFEbem u1lZh5p57qtghfXcwhgAE9w7NgbXKpqIsEWEwzCx21Qpzba3H81/x4JFjs15rAO815Bx 3Elw== X-Gm-Message-State: AOJu0YyZ0IG1PLcRCxK+eaQ6pQBzGP6Wf8gEvZ/6wpujCkOFy1BvyOY3 vvj8S5kJIU8kZuG58fhTec90xEEecdpejWQuIuSdUXktYCwdK5PP9cUzuQ/NcDB1vl8aqE29mpV 1 X-Google-Smtp-Source: AGHT+IGqT73hIvx0bC0xXBD90/216X4Fh/wcOOACUgxw9oeAnENdLqgg26uAF1PxQU1hftlBzAWmZA== X-Received: by 2002:a17:906:4a95:b0:a5a:1562:5184 with SMTP id a640c23a62f3a-a5a2d53af6amr2015883666b.3.1715893938880; Thu, 16 May 2024 14:12:18 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7d09sm1021582266b.107.2024.05.16.14.12.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 14:12:18 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Tom Rini , Ilias Apalodimas , Alexey Brodkin , Eugeniy Paltsev , Walter Schweizer , Phil Sutter , Tony Dinh , Mario Six , Heinrich Schuchardt , Simon Glass , Roger Quadros , Nishanth Menon , Jonathan Humphreys , Igor Opaniuk , Marek Vasut , Bin Meng , Caleb Connolly , Masahisa Kojima , Eddie James , Jassi Brar , Masami Hiramatsu , Michal Simek , AKASHI Takahiro , Etienne Carriere , uboot-snps-arc@synopsys.com Subject: [PATCH v3 2/4] efi_loader: remove redundant hash includes Date: Thu, 16 May 2024 14:11:50 -0700 Message-Id: <20240516211156.1819939-3-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240516211156.1819939-1-raymond.mao@linaro.org> References: <20240516211156.1819939-1-raymond.mao@linaro.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.8 at phobos.denx.de X-Virus-Status: Clean Remove the redundant includes of u-boot/sha1.h, u-boot/sha256.h and u-boot/sha512.h Signed-off-by: Raymond Mao Reviewed-by: Tom Rini Reviewed-by: Ilias Apalodimas --- Changes in v2 - None. Changes in v3 - None. lib/efi_loader/efi_signature.c | 1 - lib/efi_loader/efi_tcg2.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/lib/efi_loader/efi_signature.c b/lib/efi_loader/efi_signature.c index f338e732759..184eac8cddb 100644 --- a/lib/efi_loader/efi_signature.c +++ b/lib/efi_loader/efi_signature.c @@ -17,7 +17,6 @@ #include #include #include -#include const efi_guid_t efi_guid_sha256 = EFI_CERT_SHA256_GUID; const efi_guid_t efi_guid_cert_rsa2048 = EFI_CERT_RSA2048_GUID; diff --git a/lib/efi_loader/efi_tcg2.c b/lib/efi_loader/efi_tcg2.c index b07e0099c27..ac056dcfc55 100644 --- a/lib/efi_loader/efi_tcg2.c +++ b/lib/efi_loader/efi_tcg2.c @@ -19,9 +19,6 @@ #include #include #include -#include -#include -#include #include #include #include From patchwork Thu May 16 21:11:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1936238 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=uybExKRi; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VgN8l5TGNz1ydW for ; Fri, 17 May 2024 07:12:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9454288486; Thu, 16 May 2024 23:12:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="uybExKRi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 47A9288485; Thu, 16 May 2024 23:12:30 +0200 (CEST) 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,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 mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) (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 F1BC888480 for ; Thu, 16 May 2024 23:12:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raymond.mao@linaro.org Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-572a93890d1so4327467a12.3 for ; Thu, 16 May 2024 14:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715893947; x=1716498747; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cVXcWaR/AYumEqnfsZykQKPepzLnsVM3Se8YLjNvPS0=; b=uybExKRiLdsGSRsPe6QlMhljgogBArLsX9fJ7lo6qX+uzkDUWlkHfBjm/iOc68Y0f5 6YpLf3H9LoZ2nXx48e8x/EkIzsXfdEQDeIvagdD0AkgzXDOki3G6Dp0/BIGOMK3rqXkV 6xkfyns7moVFXeNMeGOWnbn2JbO127nLlLFTYW/Sqcalv1aD9wx67CLxIfaOnBdof1eK Z2o+51uxK0uhgCd//stRQsXgWNOW84VLLR+iy5ip6qN7I6q9LMTPorUO6d8edwKAwwTU mejNGPaCYczaAPnAD+Tq7FSSdcAxO51qVceIV29B/tevl+pwaLcTikCZeHjafddQBEcQ m8Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715893947; x=1716498747; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cVXcWaR/AYumEqnfsZykQKPepzLnsVM3Se8YLjNvPS0=; b=UB5Z5nKs3jCBMixyHbYmzbcDyFTdKfpbMhhEqN/PaD2iKXSkvHty8vumvVg/hnZICw Wupvwwz0TdKDw6lIrMyMOiWoaYflt7zbwx7hPplrnSsufOz5gWJ69LIxr28EVBxZHCgK xfpPLkiTrjT+xcolQi0s/FVti8kXBphGMjnmQQnfOnt9QdV1wYyNKwScWRDGqWq71CNV uwMg6JiCqP9qe7rEtg/XLQ4zkvD1A6nRc/W2xASc7igw5UMp/AiAlMeDd+qTkghTwbTe 39u7x3R8B7cUaIhbgVopZWUFkYTzOCHLSEQmYO1I2g0fUAXpM+7OsAcHAQAxGqgi4k64 IIZw== X-Gm-Message-State: AOJu0YwWROqN5sVvpRRhOlOQmNI4Zq4HcnvdJg22q5AU4MM03boCQQ0v 6FDK7Mn8dYd1/N8U6PXqHq/T5Lmn000i2DyFW0FIMMubRP/Wa8UjMoVMa78tHn6r7ui1UFHyXd4 Z X-Google-Smtp-Source: AGHT+IFaD151tRnu5iYdT8TW1279YjdqGa98q7X2fn6EQSATb8efDO2wTN8WbnPYPqu8u31rqXRaMQ== X-Received: by 2002:a17:906:3c10:b0:a59:cc9b:d6f8 with SMTP id a640c23a62f3a-a5a2d5cca1cmr1833828666b.39.1715893947000; Thu, 16 May 2024 14:12:27 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7d09sm1021582266b.107.2024.05.16.14.12.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 14:12:26 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Tom Rini , Ilias Apalodimas , Alexey Brodkin , Eugeniy Paltsev , Walter Schweizer , Tony Dinh , Phil Sutter , Mario Six , Heinrich Schuchardt , Simon Glass , Nishanth Menon , Roger Quadros , Jonathan Humphreys , Igor Opaniuk , Marek Vasut , Bin Meng , Caleb Connolly , Masahisa Kojima , Eddie James , Jassi Brar , Masami Hiramatsu , Michal Simek , AKASHI Takahiro , Etienne Carriere , uboot-snps-arc@synopsys.com Subject: [PATCH v3 3/4] md5: Use typedef for MD5 context Date: Thu, 16 May 2024 14:11:51 -0700 Message-Id: <20240516211156.1819939-4-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240516211156.1819939-1-raymond.mao@linaro.org> References: <20240516211156.1819939-1-raymond.mao@linaro.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.8 at phobos.denx.de X-Virus-Status: Clean Use of typedef is beneficial for porting with other crypto libs without changing the API callers. Secondly, it is for the code consistency with other digest libs. SHA1, SHA256 and SHA512 are all using typedef for their context. Signed-off-by: Raymond Mao Reviewed-by: Tom Rini Reviewed-by: Ilias Apalodimas --- Changes in v2 - None. Changes in v3 - None. drivers/crypto/hash/hash_sw.c | 8 ++++---- include/u-boot/md5.h | 10 +++++----- lib/md5.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/hash/hash_sw.c b/drivers/crypto/hash/hash_sw.c index ffd4ab149ff..4590e225481 100644 --- a/drivers/crypto/hash/hash_sw.c +++ b/drivers/crypto/hash/hash_sw.c @@ -50,17 +50,17 @@ static void hash_finish_crc32(void *ctx, void *obuf) /* MD5 */ static void hash_init_md5(void *ctx) { - MD5Init((struct MD5Context *)ctx); + MD5Init((MD5Context *)ctx); } static void hash_update_md5(void *ctx, const void *ibuf, uint32_t ilen) { - MD5Update((struct MD5Context *)ctx, ibuf, ilen); + MD5Update((MD5Context *)ctx, ibuf, ilen); } static void hash_finish_md5(void *ctx, void *obuf) { - MD5Final(obuf, (struct MD5Context *)ctx); + MD5Final(obuf, (MD5Context *)ctx); } /* SHA1 */ @@ -158,7 +158,7 @@ static struct sw_hash_impl sw_hash_impl[HASH_ALGO_NUM] = { .init = hash_init_md5, .update = hash_update_md5, .finish = hash_finish_md5, - .ctx_alloc_sz = sizeof(struct MD5Context), + .ctx_alloc_sz = sizeof(MD5Context), }, [HASH_ALGO_SHA1] = { diff --git a/include/u-boot/md5.h b/include/u-boot/md5.h index d61364c0ae3..c465925ea8d 100644 --- a/include/u-boot/md5.h +++ b/include/u-boot/md5.h @@ -10,18 +10,18 @@ #define MD5_SUM_LEN 16 -struct MD5Context { +typedef struct MD5Context { __u32 buf[4]; __u32 bits[2]; union { unsigned char in[64]; __u32 in32[16]; }; -}; +} MD5Context; -void MD5Init(struct MD5Context *ctx); -void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len); -void MD5Final(unsigned char digest[16], struct MD5Context *ctx); +void MD5Init(MD5Context *ctx); +void MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len); +void MD5Final(unsigned char digest[16], MD5Context *ctx); /* * Calculate and store in 'output' the MD5 digest of 'len' bytes at diff --git a/lib/md5.c b/lib/md5.c index faf3f78ab1e..34343cf8e23 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -55,7 +55,7 @@ byteReverse(unsigned char *buf, unsigned longs) * initialization constants. */ void -MD5Init(struct MD5Context *ctx) +MD5Init(MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; @@ -71,7 +71,7 @@ MD5Init(struct MD5Context *ctx) * of bytes. */ void -MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) +MD5Update(MD5Context *ctx, unsigned char const *buf, unsigned int len) { register __u32 t; @@ -120,7 +120,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) * 1 0* (64-bit count of bits processed, MSB-first) */ void -MD5Final(unsigned char digest[16], struct MD5Context *ctx) +MD5Final(unsigned char digest[16], MD5Context *ctx) { unsigned int count; unsigned char *p; @@ -269,7 +269,7 @@ MD5Transform(__u32 buf[4], __u32 const in[16]) void md5 (unsigned char *input, int len, unsigned char output[16]) { - struct MD5Context context; + MD5Context context; MD5Init(&context); MD5Update(&context, input, len); @@ -286,7 +286,7 @@ void md5_wd(const unsigned char *input, unsigned int len, unsigned char output[16], unsigned int chunk_sz) { - struct MD5Context context; + MD5Context context; #if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG) const unsigned char *end, *curr; int chunk; From patchwork Thu May 16 21:11:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1936239 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; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=iMTTFsIX; dkim-atps=neutral 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=patchwork.ozlabs.org) 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 (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VgN8v6w8Kz1ydW for ; Fri, 17 May 2024 07:12:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 01B2688485; Thu, 16 May 2024 23:12:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.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=linaro.org header.i=@linaro.org header.b="iMTTFsIX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 921B388481; Thu, 16 May 2024 23:12:42 +0200 (CEST) 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,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 mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) (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 605DB88483 for ; Thu, 16 May 2024 23:12:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=raymond.mao@linaro.org Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-5231efd80f2so1390889e87.2 for ; Thu, 16 May 2024 14:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715893959; x=1716498759; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BMLf5bzg1N4Kj7IW38T7Dw42nwEJ/O5BQjE5lMoLsZA=; b=iMTTFsIXA3ZqTsjlI/e/qo3NICgR2fobAyravUR+MCdn5joza3KHO2vunIG4uMw9GH f1f8m6tyUfiwTnxoERugUmX/T7N0eFVGWIUktxyw4r+Kx2WlySp7mIV9wkiwzVDy3zWx FFjGo2N8lO+xTqZZAoELs5vRQ0KkVqzuFAq02Tl9SdD5X1kaLTqxUfi3lN/xtl2y45CT EXcaowcmyLympi37ljLFdlx9gbr+S7cfdxyZyR/K5Zp2MEcnuoDBwpZf8RhxKhbk/Hdo bPT7p7T0Zhf9kdf/vfiIxFNY29VL1gOGDebUXs6y4XfxJQ5AQTfBDQAhImwESxLXvddv CbLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715893959; x=1716498759; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BMLf5bzg1N4Kj7IW38T7Dw42nwEJ/O5BQjE5lMoLsZA=; b=buk46PgVWbcEEiXP8/0xMBKrezc0XnpZtsRFH80fnJDOiUBV/kPKpTILLDDeuYRFRs fRMdABvDZnALF/4vevKSiIyzLuxfuXWzq2hW4XtcDwoezSv2eYIsY9uHJ0UxhFymV08X lvFBr8Ct8LB75O4BVEVxMdDTs5DbnD2R7frdPOn+4RhYrBPfP5DHH54OAD/IRQfFQM+e f1SkD5VLMzlTUiLEiOPvK1uYyuxICniRWv7vab0SoojRNxeApce1hezK2vKYnJ3g1i4X o8oFdc0P1iXiHrJsKATRTv5I4aMOYaKN3v6KWsYEyhf6shAIOQLVGwndzPyzDJL2df3d HL3A== X-Gm-Message-State: AOJu0YyxwljKd2r7CCFiLTGf6h5g+ulD1j+ClAu3gBeAmrEZTW4U0avY ejyb7wyHvZuuuifS0msyw6kqueqb9DsSQL4nR6DcSTkcMSLD7M8iehKj5tYGp+JqIAazQp+pR/J U X-Google-Smtp-Source: AGHT+IGkFGCjYIdTiPKVv/kVQJOvMuRk3aGra7JDR1cZe0CQppmLZGi0612V7xcAe5D5fqFPpnmTjg== X-Received: by 2002:a05:6512:3605:b0:51f:b781:729d with SMTP id 2adb3069b0e04-5220fd7acf5mr10817034e87.38.1715893959254; Thu, 16 May 2024 14:12:39 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a179c7d09sm1021582266b.107.2024.05.16.14.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 14:12:38 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Alexey Brodkin , Eugeniy Paltsev , Tom Rini , Phil Sutter , Walter Schweizer , Tony Dinh , Mario Six , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Jonathan Humphreys , Nishanth Menon , Roger Quadros , Igor Opaniuk , Marek Vasut , Bin Meng , Caleb Connolly , Masahisa Kojima , Eddie James , Jassi Brar , Michal Simek , Masami Hiramatsu , AKASHI Takahiro , Etienne Carriere , uboot-snps-arc@synopsys.com Subject: [PATCH v3 4/4] include: Move snprintf to stdio.h Date: Thu, 16 May 2024 14:11:52 -0700 Message-Id: <20240516211156.1819939-5-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240516211156.1819939-1-raymond.mao@linaro.org> References: <20240516211156.1819939-1-raymond.mao@linaro.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.8 at phobos.denx.de X-Virus-Status: Clean Move snprintf to stdio.h since it is needed by exteranl libraries. Signed-off-by: Raymond Mao Reviewed-by: Tom Rini Reviewed-by: Ilias Apalodimas --- Changes in v2 - New patch. Changes in v3 - Move comments and attributes of snprintf. arch/arc/lib/cpu.c | 2 +- board/Synology/common/legacy.c | 1 + board/ti/common/fdt_ops.c | 2 +- cmd/part.c | 1 + common/button_cmd.c | 2 +- drivers/cpu/mpc83xx_cpu.c | 2 +- include/stdio.h | 17 +++++++++++++++++ include/vsprintf.h | 17 ----------------- lib/display_options.c | 1 + lib/fwu_updates/fwu_mtd.c | 2 +- lib/hexdump.c | 2 +- lib/vsprintf.c | 1 + test/dm/scmi.c | 2 +- test/print_ut.c | 1 + 14 files changed, 29 insertions(+), 24 deletions(-) diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c index 593950449f2..269b4dbdd15 100644 --- a/arch/arc/lib/cpu.c +++ b/arch/arc/lib/cpu.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/board/Synology/common/legacy.c b/board/Synology/common/legacy.c index a0bace7b46c..2e3aa660eaa 100644 --- a/board/Synology/common/legacy.c +++ b/board/Synology/common/legacy.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include diff --git a/board/ti/common/fdt_ops.c b/board/ti/common/fdt_ops.c index eb917be9e0d..8a3300993ed 100644 --- a/board/ti/common/fdt_ops.c +++ b/board/ti/common/fdt_ops.c @@ -6,7 +6,7 @@ */ #include -#include +#include #include "fdt_ops.h" void ti_set_fdt_env(const char *board_name, struct ti_fdt_map *fdt_map) diff --git a/cmd/part.c b/cmd/part.c index d140a1eddb9..db7bc5819c0 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -19,6 +19,7 @@ #include #include #include +#include #include enum cmd_part_info { diff --git a/common/button_cmd.c b/common/button_cmd.c index 8642c26735c..72dac1f9ef6 100644 --- a/common/button_cmd.c +++ b/common/button_cmd.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include /* Some sane limit "just in case" */ #define MAX_BTN_CMDS 32 diff --git a/drivers/cpu/mpc83xx_cpu.c b/drivers/cpu/mpc83xx_cpu.c index 9a7b5fd7c42..127d3c3af08 100644 --- a/drivers/cpu/mpc83xx_cpu.c +++ b/drivers/cpu/mpc83xx_cpu.c @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include "mpc83xx_cpu.h" diff --git a/include/stdio.h b/include/stdio.h index 3241e2d493f..7b999a519ba 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -46,6 +46,23 @@ static inline int vprintf(const char *fmt, va_list args) } #endif +/** + * Format a string and place it in a buffer + * + * @buf: The buffer to place the result into + * @size: The size of the buffer, including the trailing null space + * @fmt: The format string to use + * @...: Arguments for the format string + * Return: the number of characters which would be + * generated for the given input, excluding the trailing null, + * as per ISO C99. If the return is greater than or equal to + * @size, the resulting string is truncated. + * + * See the vsprintf() documentation for format string extensions over C99. + */ +int snprintf(char *buf, size_t size, const char *fmt, ...) + __attribute__ ((format (__printf__, 3, 4))); + /* * FILE based functions (can only be used AFTER relocation!) */ diff --git a/include/vsprintf.h b/include/vsprintf.h index ed8a060ee17..fe951471426 100644 --- a/include/vsprintf.h +++ b/include/vsprintf.h @@ -218,23 +218,6 @@ char *simple_itoa(ulong val); */ char *simple_xtoa(ulong num); -/** - * Format a string and place it in a buffer - * - * @buf: The buffer to place the result into - * @size: The size of the buffer, including the trailing null space - * @fmt: The format string to use - * @...: Arguments for the format string - * Return: the number of characters which would be - * generated for the given input, excluding the trailing null, - * as per ISO C99. If the return is greater than or equal to - * @size, the resulting string is truncated. - * - * See the vsprintf() documentation for format string extensions over C99. - */ -int snprintf(char *buf, size_t size, const char *fmt, ...) - __attribute__ ((format (__printf__, 3, 4))); - /** * Format a string and place it in a buffer * diff --git a/lib/display_options.c b/lib/display_options.c index d6b93553dcb..d5df53ab15f 100644 --- a/lib/display_options.c +++ b/lib/display_options.c @@ -12,6 +12,7 @@ #include #include #include +#include #include char *display_options_get_banner_priv(bool newlines, const char *build_tag, diff --git a/lib/fwu_updates/fwu_mtd.c b/lib/fwu_updates/fwu_mtd.c index 69cd3d7001f..4a52834b61a 100644 --- a/lib/fwu_updates/fwu_mtd.c +++ b/lib/fwu_updates/fwu_mtd.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include diff --git a/lib/hexdump.c b/lib/hexdump.c index 33e3e6e5182..2bc508ff504 100644 --- a/lib/hexdump.c +++ b/lib/hexdump.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 27ea9c907a3..cfd1f1914ed 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/test/dm/scmi.c b/test/dm/scmi.c index 69fc900e342..c9a03523184 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/print_ut.c b/test/print_ut.c index bded2b6ebe5..53d3354ea69 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include