From patchwork Wed May 15 12:31:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1935577 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=M1De29GL; 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 4VfXgf0fh8z1ymw for ; Wed, 15 May 2024 22:33:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 625EA88253; Wed, 15 May 2024 14:32:55 +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="M1De29GL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F21E988261; Wed, 15 May 2024 14:32:53 +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-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 0559588250 for ; Wed, 15 May 2024 14:32:52 +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-x42a.google.com with SMTP id ffacd0b85a97d-34d7b0dac54so3923511f8f.0 for ; Wed, 15 May 2024 05:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715776371; x=1716381171; 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=8tYY9vXgd/6FndAyjqhdV08iRoiUAwStXpih6zevSzo=; b=M1De29GLHlZUxBtpcHNIG1IIkpD1YJIxVb4chii4jVhFEWRnODFYNXdUaZuV1N11yI a64/zlzqIavnr4eVlaE7I/i06Up9wYxCBR/ixFDRiM15Wlfup6YUsPI+dAw3qzHsTu/W k6rAkL12HDuaNYdSA3jGH7sHQrM3gNzihw1/n0oevuxSYFA9ZwkfBDY0cfepA511ALY5 FOxMndqVtxKw5S55BC99cpd/1vn32py/8e5/l7VeLLcTtntHUGRteAsFnONOfRoyTYBi TUezLrKBB1IAmemCP1NH6Q+xfch29xcoEatNrWEpy0LwYSvpLspKA+8KoglobxkiREgL HhSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715776371; x=1716381171; 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=8tYY9vXgd/6FndAyjqhdV08iRoiUAwStXpih6zevSzo=; b=AmOncpnK156YBqzkxuuAPTkvjOzvn/BUuzjWBwIrscLhdIMbtAKsDLAz89zfnxdcrB mujpwEKlhawOVuZE9gPekEIRUNvRCHMWNa3MZFaJ7gLaKEtqa5AP+DWEJrnSBIcBTU+H QaWqLQ6+BeXPhCmXPXnUMHF+DR0ugc9Xe68DTi93vfndZhU6cQG8lroTEbM/E/cGuBme hFQsuTk+co7a/XPkf5MC6qyWPMMLxgk0ZZtbbd1jFCZ7Rt5Z+8Nf0b/VjaDBDQpPm6wj sHMP9UlsnPN0TAtYuP+XDNnJccPI1RWy8lBKSsgS24M1oQbML4o+p5tAagtGus4p5dCP vBSQ== X-Gm-Message-State: AOJu0YzDJPALas+GEg+iOlvKU9RVMUG5GqywLMlyBT3RHt9OcvWVVC67 bfhxb75O7n8jrMw5UkNaduM9BwTB7Qqf+i0F9LwdWukkhIcFb0IqUGYw5P4lQZPYFY0TBQIV5AC K X-Google-Smtp-Source: AGHT+IFzsyQJyodOZO75btRuCXEkDoqOQHLgtFgXHzfU5sFXVxnn2tDPXdE4vQrbrxNyn4QRxsm20w== X-Received: by 2002:a5d:6952:0:b0:34d:8d11:f8c0 with SMTP id ffacd0b85a97d-350498a4abfmr12929332f8f.18.1715776371325; Wed, 15 May 2024 05:32:51 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad042sm16406896f8f.80.2024.05.15.05.32.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:32:50 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Tom Rini , Igor Opaniuk , Ilias Apalodimas , Alexey Brodkin , Eugeniy Paltsev , Tony Dinh , Walter Schweizer , Phil Sutter , Mario Six , Heinrich Schuchardt , Simon Glass , Nishanth Menon , Jonathan Humphreys , Roger Quadros , 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 v2 1/4] image: remove redundant hash includes Date: Wed, 15 May 2024 05:31:56 -0700 Message-Id: <20240515123213.1701691-2-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240515123213.1701691-1-raymond.mao@linaro.org> References: <20240515123213.1701691-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. 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 89e377563ce..1efc39f4408 100644 --- a/boot/image-fit.c +++ b/boot/image-fit.c @@ -38,10 +38,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 073931cd7a3..e57d6eae52d 100644 --- a/boot/image.c +++ b/boot/image.c @@ -26,8 +26,6 @@ #endif #include -#include -#include #include #include From patchwork Wed May 15 12:31:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1935578 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=SJPBY8VL; 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 4VfXgz1QpRz1ymw for ; Wed, 15 May 2024 22:33:19 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C478F88266; Wed, 15 May 2024 14:33:16 +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="SJPBY8VL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 13D0F8826D; Wed, 15 May 2024 14:33:15 +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-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 2458088250 for ; Wed, 15 May 2024 14:33:13 +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-x42c.google.com with SMTP id ffacd0b85a97d-34db6a29a1eso5372414f8f.1 for ; Wed, 15 May 2024 05:33:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715776392; x=1716381192; 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=5XjdVTV/76FcCAKo/nqu5PCdfs4U07Vo+hgb69Fpqfw=; b=SJPBY8VLDKev+GRJKMO8zl32ebRMMr0eoX3Y0S6QTqAj75jY8lwUbORab/QEMrUpsc QeXyuMW2M2K/MkhHfAIWhI+ZuDmTnJ23542wP7HLdHxlCFJ3B+TOx4Ks1jiRQYc+Xjo4 lHWXRGdlgUrrD4HKufCdwVU3EBMFE3nMWUo2nwp78s5xYBANUN79E2r77l5DRyC2P5fR g8jOW4jfkgv06za2Cr4NRRTqO/GCytx84uNtnftUHGgUadyx/XoAaMhdtM9agccqb86S fOhnnQ15T47jwdQC3t58yPOTp+q14M3jJh9n5ktm04cH4aDsRk9fRP7pRnILvtvRSQnK KpzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715776392; x=1716381192; 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=5XjdVTV/76FcCAKo/nqu5PCdfs4U07Vo+hgb69Fpqfw=; b=FbEbYqBZDV/BD6gUcotJGjjV4v30x0OUo7B126jgK/kbHpdJmujPVMDGOo3KgddWwo Dx9lH0kU8/cpXQFyueQqZXo+1KRne3A84Zj9Bi1zFhlLl/WHtECmXxE3/91TMIsQSF4x inB4QFZOLVsZv9oZ5maKFy7g1jXgWJo2420jdrFyzbcmn8bRc89+i9IrP21DRKyE+QPi U6FvjJG2+OBDmAjbEhQ0o6OUk3zIz6mJ0DsIXj2Cgu10MwDtjCrDBPcQQDabtQEVmOII WdZP6zaVQlsI+GtylFUFpQQWF+uRlzYiR22q7qZ83yg1qohPpeVqR49xPh1RcK5eRS7e o9/w== X-Gm-Message-State: AOJu0YxgUesaNMjNf7DjaiWQEzkbpu29pLj9AZ9YG6PJArkNMSbg0rE8 fbaC06bU1qzTU5gnhcKVIatFgHo3CkMeVIrszph2DesFWAP7M4pzP/gb+Vcu5Mr3T2nz32Ex0Je B X-Google-Smtp-Source: AGHT+IGyDmt2bSl5aUDXhLslsgBSXWV39+DfY6j0AwvvhcdPB7Tjpo0npw8FRbPa/mUdGRBL5c+ASQ== X-Received: by 2002:a5d:4745:0:b0:34d:98eb:4cb with SMTP id ffacd0b85a97d-3504a73da3dmr10815843f8f.33.1715776392055; Wed, 15 May 2024 05:33:12 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad042sm16406896f8f.80.2024.05.15.05.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:33:11 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Tom Rini , Ilias Apalodimas , Alexey Brodkin , Eugeniy Paltsev , Phil Sutter , Walter Schweizer , 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 v2 2/4] efi_loader: remove redundant hash includes Date: Wed, 15 May 2024 05:31:57 -0700 Message-Id: <20240515123213.1701691-3-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240515123213.1701691-1-raymond.mao@linaro.org> References: <20240515123213.1701691-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. 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 Wed May 15 12:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1935579 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=P5SYKren; 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 4VfXhJ6DGCz1ymw for ; Wed, 15 May 2024 22:33:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 39B7388279; Wed, 15 May 2024 14:33:34 +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="P5SYKren"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7DB4188279; Wed, 15 May 2024 14:33:33 +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-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) (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 4BAA188253 for ; Wed, 15 May 2024 14:33:31 +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-x42e.google.com with SMTP id ffacd0b85a97d-351b683f2d8so2905916f8f.3 for ; Wed, 15 May 2024 05:33:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715776410; x=1716381210; 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=5MaMaR+3gTp15zOPExfmxdnZJ/rBSbp3cBCirHRkOLg=; b=P5SYKren1uA/FXP3t5D1ADn5syCzmvyR6rTi+fVqBCHTd95fA/99RkTH5qCWwkkik9 iproMMqciR4Jr2yF/M564B62Z1JCeWbl7dADhgrRUwKBTRbhFxeLnB/4PkTfW9mka7Ml qyShhBUEs77VOb41iE4W+fseeUUPviKsVf5KRPwF4PagZfbI8FuhX3C9GCscs2XKYn3Q fy7FjFscfSxAlurx9dKXPEfulo91z67jgCySJj3wehO8rdlBwKe1S1/WyFu9lFBbBPpQ vm33+ahWn2E+zxkQC2PWaz/9/OlHu/v9dI9GQbez+mR5EDHZq+JPNLWpbMQayBAe5vWg /HhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715776410; x=1716381210; 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=5MaMaR+3gTp15zOPExfmxdnZJ/rBSbp3cBCirHRkOLg=; b=Oyw39jLnP4g/ef3IfOLHV05UKGyGMRj7XRtb7LMda7KaEoBdWfaAlQFrpnRymi+GCE 8y9+grERLAb0tmJiixRIFBnKpSR0VxW8W1DLXnOVuNbXeBskfOXMP1iwte9fF1WOFdHc N0LvA4Xdd+NNcyN/MUAZguQdcjRT3loq5MZdZwikC8VGOqOEdhurkflehozKy9/0y/Dw ySB2Jnrjg1dwb3TySIMcBjNODxVxzNfEfy2kYh6axRPeKj3ANvryb+u3Exp0TteD7/YY W7XpGSRWwzMknzI2Y3vq9MG5CmhRhFqVymRiEpfCFeOKKDjF0WFpG5ANS7qYB1AS3KET U+3Q== X-Gm-Message-State: AOJu0YyaDHUX8TSq0xAT4VUmUCgeDanxPL7cRW9e9QdbDc/WYRFUKSXV OCJRGk+uh2Yz3SUKgHyfkWC5A/fQaeMmdefeJEw708eIKpraHUwGXxU6+epxBGYZPRlvFSRTh7j N X-Google-Smtp-Source: AGHT+IHdtEeBgvu69Ix9pBanYix3MZr6F+sG1JyETbLw3MtovpAhs7O5V0FAx97Md9AvYjY7p4BD4Q== X-Received: by 2002:a05:6000:c91:b0:34d:e262:8b54 with SMTP id ffacd0b85a97d-3504a632fe9mr13220375f8f.7.1715776410313; Wed, 15 May 2024 05:33:30 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad042sm16406896f8f.80.2024.05.15.05.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:33:29 -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 , Nishanth Menon , Roger Quadros , Jonathan Humphreys , Igor Opaniuk , 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 v2 3/4] md5: Use typedef for MD5 context Date: Wed, 15 May 2024 05:31:58 -0700 Message-Id: <20240515123213.1701691-4-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240515123213.1701691-1-raymond.mao@linaro.org> References: <20240515123213.1701691-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. 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 d8065d68ea4..a5033677930 100644 --- a/drivers/crypto/hash/hash_sw.c +++ b/drivers/crypto/hash/hash_sw.c @@ -51,17 +51,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 */ @@ -159,7 +159,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 Wed May 15 12:31:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raymond Mao X-Patchwork-Id: 1935580 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=bRaQD+J3; 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) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VfXhg1FQ0z1ymw for ; Wed, 15 May 2024 22:33:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C08DD882DC; Wed, 15 May 2024 14:33:52 +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="bRaQD+J3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6D01A882DF; Wed, 15 May 2024 14:33:51 +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-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 4D296882D6 for ; Wed, 15 May 2024 14:33:49 +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-x42a.google.com with SMTP id ffacd0b85a97d-34da35cd01cso6290164f8f.2 for ; Wed, 15 May 2024 05:33:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1715776428; x=1716381228; 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=pZB2WN9KCVMfZyYoPhNQjP2Md9H0Pbuq/IK8CBvwCCE=; b=bRaQD+J3aTvWtKIE0m7GfBEd1by5NWI2DrCyLn5Xk0cRrEcv62jFqL6+P3cTi8r3gd W7apueIwFv+6SFcJLxLZCflRWRFzoKb0Cc6+1m4SnupzHjiCNOreuKyC5JliQ+ANV461 UEVKwlSIjXourY3AIOIFMMmttpeXWlvpqD3UjzQrRXVhkYGlOp45wq7WdxRKNHKZC07F 4KJiU710ANTqIAWMAug+AP5irOYHgWQhMAbzgYmN5ZvDQM3knTfZCFjTuUDQKjyImKTZ GjASEM2bcXjg/7pwNYDGsi8Ibd3L2UjWl3FR35jVEvzQMVwoMc8Fx81TQXrETkyLSkBM JyhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715776428; x=1716381228; 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=pZB2WN9KCVMfZyYoPhNQjP2Md9H0Pbuq/IK8CBvwCCE=; b=EHS9ssIKUjrwje67p5ZurC4wI3cQ41QbW2CAwbdtJMqi4bS3RmHztM3T5AKyL1l2tQ Zjuk8xpKgAa15NEMH2Yr88QnUnRBh3IzMOAuFCU5pdO/8udq9esJ3TA4kf8UBe1vSIqU gehsU33CUqR+ApfEGhpPVc4lBCkilr44PaN6+JKO2oILc852AnhEPO4F9fQov5GRwoXZ RGcc3JBDtGxroDcHhgk8K7galfl5rcJAuUtQXqY7N5I0zz883QtNQQUPybNgj6De88kK LuvRZ0+vb+hjJU/AjM0aGGKYM0HvNMwJxcy6L7ibKHrGPGUhX3rhOoQB+IYQlhNf0sSe LRzg== X-Gm-Message-State: AOJu0YzGI7mQbRrFot/yG70drJZ0UbCdqlZuGmn+2D7+6uES4cXxdY2t J023SsXWmEkpBINZVnlqhPhaUy+yRXqgUyyw8DLXaIY29jKFbkS0or/L0fd1TrYZxEGwK4nx4Os K X-Google-Smtp-Source: AGHT+IE01AJZ15v7kp/NN+htPOtmHcuF6XUP1LeqDOobFYwZx8fdOGy/d19t/cG5rZDb5cr/b13JRA== X-Received: by 2002:a5d:68cd:0:b0:34d:83cf:dc56 with SMTP id ffacd0b85a97d-3504a73752cmr14036187f8f.24.1715776428556; Wed, 15 May 2024 05:33:48 -0700 (PDT) Received: from ubuntu.localdomain ([149.14.240.163]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3502baad042sm16406896f8f.80.2024.05.15.05.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 05:33:48 -0700 (PDT) From: Raymond Mao To: u-boot@lists.denx.de Cc: Raymond Mao , Alexey Brodkin , Eugeniy Paltsev , Tom Rini , Tony Dinh , Phil Sutter , Walter Schweizer , Mario Six , Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Nishanth Menon , Roger Quadros , Jonathan Humphreys , 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 v2 4/4] include: Move snprintf to stdio.h Date: Wed, 15 May 2024 05:31:59 -0700 Message-Id: <20240515123213.1701691-5-raymond.mao@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240515123213.1701691-1-raymond.mao@linaro.org> References: <20240515123213.1701691-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 --- Changes in v2 - New patch. arch/arc/lib/cpu.c | 2 +- board/Synology/common/legacy.c | 1 + board/ti/common/fdt_ops.c | 2 +- cmd/part.c | 2 +- common/button_cmd.c | 2 +- drivers/cpu/mpc83xx_cpu.c | 2 +- include/stdio.h | 1 + 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, 13 insertions(+), 25 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 c75f85acd52..b1c06064ad5 100644 --- a/cmd/part.c +++ b/cmd/part.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include enum cmd_part_info { CMD_PART_INFO_START = 0, 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 e451c11116a..5b2d0485258 100644 --- a/drivers/cpu/mpc83xx_cpu.c +++ b/drivers/cpu/mpc83xx_cpu.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include "mpc83xx_cpu.h" diff --git a/include/stdio.h b/include/stdio.h index 3241e2d493f..ecd0f996efb 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -45,6 +45,7 @@ static inline int vprintf(const char *fmt, va_list args) return 0; } #endif +int snprintf(char *buf, size_t size, const char *fmt, ...); /* * 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 adf36ffaab1..a03824ab653 100644 --- a/test/dm/scmi.c +++ b/test/dm/scmi.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/test/print_ut.c b/test/print_ut.c index bb844d2542b..a0d6a551203 100644 --- a/test/print_ut.c +++ b/test/print_ut.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include