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 A1804C4332F for ; Fri, 18 Nov 2022 16:13:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DBBF085265; Fri, 18 Nov 2022 17:13:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=metanate.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=metanate.com header.i=@metanate.com header.b="iLihjKwr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A65BB85161; Fri, 18 Nov 2022 17:13:32 +0100 (CET) Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E677485161 for ; Fri, 18 Nov 2022 17:13:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=metanate.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=john@metanate.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Content-Type:Reply-To:Content-ID:Content-Description: In-Reply-To:References; bh=TWoEBYODZgYFTAdDVo/6ArgI9F/QmPc69HY8fo5IU24=; b=iL ihjKwrXdz+noj0GGkA86DHr77LuHr09Grh3ydqF/pDdLcsqBd0HOFKQpfBlnzfsUICeLbSffGyQDY nom2Zp4KuNuYm0iW7Dduhho8LkykJXZB4IzvDtOf71IPNcJ/Jcshe/+qCtCR0pJMXvF1DYK3M4xty efO7qwOqspB4uQGbP82Dc1wynZiaY/WwSuxGmlFkMidC/0Skm88TTqUF7LvWZhi59RSPeSpIwBjWo VIHtvSkiOo7sxFSL3FmjR64VNxAZXPVR6UzDEoDIGeG6HFSUaevhTOJS2bswEV9FcBFXBLnsJUv10 k4Eurw+yl/5jXLIJm1XuOuh/tXD8WgYg==; Received: from 188-39-28-98.static.enta.net ([188.39.28.98] helo=donbot.metanate.com) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ow3za-0003i5-FJ; Fri, 18 Nov 2022 16:13:27 +0000 From: John Keeping To: Simon Glass Cc: u-boot@lists.denx.de, Philipp Tomsich , Kever Yang , John Keeping Subject: [PATCH 1/2] rc4: mark key as const Date: Fri, 18 Nov 2022 16:13:17 +0000 Message-Id: <20221118161318.120821-1-john@metanate.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated: YES 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.6 at phobos.denx.de X-Virus-Status: Clean Key data is never written so the parameter can be const, which allows putting fixed keys in .rodata. Signed-off-by: John Keeping --- include/rc4.h | 2 +- lib/rc4.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rc4.h b/include/rc4.h index c1ff1349d4..d1257f20a4 100644 --- a/include/rc4.h +++ b/include/rc4.h @@ -15,6 +15,6 @@ * @len: Length of buffer in bytes * @key: 16-byte key to use */ -void rc4_encode(unsigned char *buf, unsigned int len, unsigned char key[16]); +void rc4_encode(unsigned char *buf, unsigned int len, const unsigned char key[16]); #endif diff --git a/lib/rc4.c b/lib/rc4.c index 0c00439843..720112d1fd 100644 --- a/lib/rc4.c +++ b/lib/rc4.c @@ -12,7 +12,7 @@ #endif #include -void rc4_encode(unsigned char *buf, unsigned int len, unsigned char key[16]) +void rc4_encode(unsigned char *buf, unsigned int len, const unsigned char key[16]) { unsigned char s[256], k[256], temp; unsigned short i, j, t; -- 2.38.1