linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Lemmermann <thepaulodoom@thepaulodoom.com>
To: davem@davemloft.net
Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	Paul Lemmermann <thepaulodoom@thepaulodoom.com>
Subject: [PATCH] crypto: aes_generic: fixed styling warnings
Date: Sat, 26 Mar 2022 12:20:51 -0500	[thread overview]
Message-ID: <20220326172051.14722-1-thepaulodoom@thepaulodoom.com> (raw)

Fixed all styling warnings from the checkpatch.pl script.

Signed-off-by: Paul Lemmermann <thepaulodoom@thepaulodoom.com>
---
 crypto/aes_generic.c | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/crypto/aes_generic.c b/crypto/aes_generic.c
index 27ab27931..322e345ac 100644
--- a/crypto/aes_generic.c
+++ b/crypto/aes_generic.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Cryptographic API.
  *
@@ -56,7 +57,7 @@
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 
-static inline u8 byte(const u32 x, const unsigned n)
+static inline u8 byte(const u32 x, const unsigned int n)
 {
 	return x >> (n << 3);
 }
@@ -325,6 +326,7 @@ __visible const u32 crypto_ft_tab[4][256] ____cacheline_aligned = {
 		0x7bcbb0b0, 0xa8fc5454, 0x6dd6bbbb, 0x2c3a1616,
 	}
 };
+EXPORT_SYMBOL_GPL(crypto_ft_tab);
 
 static const u32 crypto_fl_tab[4][256] ____cacheline_aligned = {
 	{
@@ -853,6 +855,7 @@ __visible const u32 crypto_it_tab[4][256] ____cacheline_aligned = {
 		0x7b6184cb, 0xd570b632, 0x48745c6c, 0xd04257b8,
 	}
 };
+EXPORT_SYMBOL_GPL(crypto_it_tab);
 
 static const u32 crypto_il_tab[4][256] ____cacheline_aligned = {
 	{
@@ -1118,8 +1121,6 @@ static const u32 crypto_il_tab[4][256] ____cacheline_aligned = {
 	}
 };
 
-EXPORT_SYMBOL_GPL(crypto_ft_tab);
-EXPORT_SYMBOL_GPL(crypto_it_tab);
 
 /**
  * crypto_aes_set_key - Set the AES key.
@@ -1144,34 +1145,34 @@ EXPORT_SYMBOL_GPL(crypto_aes_set_key);
 
 /* encrypt a block of text */
 
-#define f_rn(bo, bi, n, k)	do {				\
+#define f_rn(bo, bi, n, k)	while (0) {				\
 	bo[n] = crypto_ft_tab[0][byte(bi[n], 0)] ^			\
 		crypto_ft_tab[1][byte(bi[(n + 1) & 3], 1)] ^		\
 		crypto_ft_tab[2][byte(bi[(n + 2) & 3], 2)] ^		\
 		crypto_ft_tab[3][byte(bi[(n + 3) & 3], 3)] ^ *(k + n);	\
-} while (0)
+}
 
-#define f_nround(bo, bi, k)	do {\
+#define f_nround(bo, bi, k)	while (0) {\
 	f_rn(bo, bi, 0, k);	\
 	f_rn(bo, bi, 1, k);	\
 	f_rn(bo, bi, 2, k);	\
 	f_rn(bo, bi, 3, k);	\
 	k += 4;			\
-} while (0)
+}
 
-#define f_rl(bo, bi, n, k)	do {				\
+#define f_rl(bo, bi, n, k)	while (0) {				\
 	bo[n] = crypto_fl_tab[0][byte(bi[n], 0)] ^			\
 		crypto_fl_tab[1][byte(bi[(n + 1) & 3], 1)] ^		\
 		crypto_fl_tab[2][byte(bi[(n + 2) & 3], 2)] ^		\
 		crypto_fl_tab[3][byte(bi[(n + 3) & 3], 3)] ^ *(k + n);	\
-} while (0)
+}
 
-#define f_lround(bo, bi, k)	do {\
+#define f_lround(bo, bi, k)	while (0) {\
 	f_rl(bo, bi, 0, k);	\
 	f_rl(bo, bi, 1, k);	\
 	f_rl(bo, bi, 2, k);	\
 	f_rl(bo, bi, 3, k);	\
-} while (0)
+}
 
 static void crypto_aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
@@ -1214,12 +1215,12 @@ static void crypto_aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 
 /* decrypt a block of text */
 
-#define i_rn(bo, bi, n, k)	do {				\
+#define i_rn(bo, bi, n, k)	while (0) {				\
 	bo[n] = crypto_it_tab[0][byte(bi[n], 0)] ^			\
 		crypto_it_tab[1][byte(bi[(n + 3) & 3], 1)] ^		\
 		crypto_it_tab[2][byte(bi[(n + 2) & 3], 2)] ^		\
 		crypto_it_tab[3][byte(bi[(n + 1) & 3], 3)] ^ *(k + n);	\
-} while (0)
+}
 
 #define i_nround(bo, bi, k)	do {\
 	i_rn(bo, bi, 0, k);	\
@@ -1229,19 +1230,19 @@ static void crypto_aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 	k += 4;			\
 } while (0)
 
-#define i_rl(bo, bi, n, k)	do {			\
+#define i_rl(bo, bi, n, k)	while (0) {			\
 	bo[n] = crypto_il_tab[0][byte(bi[n], 0)] ^		\
 	crypto_il_tab[1][byte(bi[(n + 3) & 3], 1)] ^		\
 	crypto_il_tab[2][byte(bi[(n + 2) & 3], 2)] ^		\
 	crypto_il_tab[3][byte(bi[(n + 1) & 3], 3)] ^ *(k + n);	\
-} while (0)
+}
 
-#define i_lround(bo, bi, k)	do {\
+#define i_lround(bo, bi, k)	while (0) {\
 	i_rl(bo, bi, 0, k);	\
 	i_rl(bo, bi, 1, k);	\
 	i_rl(bo, bi, 2, k);	\
 	i_rl(bo, bi, 3, k);	\
-} while (0)
+}
 
 static void crypto_aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
 {
-- 
2.35.1


             reply	other threads:[~2022-03-26 17:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-26 17:20 Paul Lemmermann [this message]
2022-03-27 11:41 ` [PATCH] crypto: aes_generic: fixed styling warnings Ard Biesheuvel
     [not found]   ` <20220327224009.2jotnczk67j4cfh2@hp-amd-paul>
2022-03-28  7:39     ` Ard Biesheuvel
2022-03-28 12:51       ` Paul Lemmermann
2022-04-11 10:34 ` [crypto] 8505b026c9: hwsim.fils_sk_hlp_oom.fail kernel test robot
2022-04-12 20:36   ` Paul Lemmermann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220326172051.14722-1-thepaulodoom@thepaulodoom.com \
    --to=thepaulodoom@thepaulodoom.com \
    --cc=davem@davemloft.net \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).