[PATCH] crypto: Fix checkpatch issues

From: Franziska Naepelt
Date: Sat Jun 03 2023 - 10:25:09 EST


crypto/crct10dif_common.c
- WARNING: Missing or malformed SPDX-License-Identifier tag

crypto/fcrypt.c
- WARNING: Missing or malformed SPDX-License-Identifier tag
- WARNING: Block comments use a trailing */ on a separate line

crypto/hmac.c
- WARNING: Missing a blank line after declarations

crypto/md4.c
- WARNING: Missing or malformed SPDX-License-Identifier tag
- ERROR: space required after that ',' (ctx:VxV)
- ERROR: space prohibited after that open square bracket '['
- WARNING: space prohibited between function name and open parenthesis '('
- ERROR: code indent should use tabs where possible

not fixed:
crypto/md4.c
- ERROR: space required after that ',' (ctx:VxV)
Lines 64, 65, 66 have not been fixed due to readability

Signed-off-by: Franziska Naepelt <franziska.naepelt@xxxxxxxxx>
---
crypto/crct10dif_common.c | 1 +
crypto/fcrypt.c | 4 +++-
crypto/hmac.c | 1 +
crypto/md4.c | 11 ++++++-----
4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/crypto/crct10dif_common.c b/crypto/crct10dif_common.c
index b2fab366f518..134553bf0d60 100644
--- a/crypto/crct10dif_common.c
+++ b/crypto/crct10dif_common.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Cryptographic API.
*
diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c
index 95a16e88899b..d81d65489c41 100644
--- a/crypto/fcrypt.c
+++ b/crypto/fcrypt.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/* FCrypt encryption algorithm
*
* Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
@@ -303,7 +304,8 @@ static int fcrypt_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key

#if BITS_PER_LONG == 64 /* the 64-bit version can also be used for 32-bit
* kernels - it seems to be faster but the code is
- * larger */
+ * larger
+ */

u64 k; /* k holds all 56 non-parity bits */

diff --git a/crypto/hmac.c b/crypto/hmac.c
index 09a7872b4060..ea93f4c55f25 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -177,6 +177,7 @@ static int hmac_clone_tfm(struct crypto_shash *dst, struct crypto_shash *src)
static void hmac_exit_tfm(struct crypto_shash *parent)
{
struct hmac_ctx *ctx = hmac_ctx(parent);
+
crypto_free_shash(ctx->hash);
}

diff --git a/crypto/md4.c b/crypto/md4.c
index 2e7f2f319f95..4083698c242c 100644
--- a/crypto/md4.c
+++ b/crypto/md4.c
@@ -1,4 +1,5 @@
-/*
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
* Cryptographic API.
*
* MD4 Message Digest Algorithm (RFC1320).
@@ -90,7 +91,7 @@ static void md4_transform(u32 *hash, u32 const *in)
ROUND1(c, d, a, b, in[14], 11);
ROUND1(b, c, d, a, in[15], 19);

- ROUND2(a, b, c, d,in[ 0], 3);
+ ROUND2(a, b, c, d, in[0], 3);
ROUND2(d, a, b, c, in[4], 5);
ROUND2(c, d, a, b, in[8], 9);
ROUND2(b, c, d, a, in[12], 13);
@@ -107,7 +108,7 @@ static void md4_transform(u32 *hash, u32 const *in)
ROUND2(c, d, a, b, in[11], 9);
ROUND2(b, c, d, a, in[15], 13);

- ROUND3(a, b, c, d,in[ 0], 3);
+ ROUND3(a, b, c, d, in[0], 3);
ROUND3(d, a, b, c, in[8], 9);
ROUND3(c, d, a, b, in[4], 11);
ROUND3(b, c, d, a, in[12], 15);
@@ -190,7 +191,7 @@ static int md4_final(struct shash_desc *desc, u8 *out)

*p++ = 0x80;
if (padding < 0) {
- memset(p, 0x00, padding + sizeof (u64));
+ memset(p, 0x00, padding + sizeof(u64));
md4_transform_helper(mctx);
p = (char *)mctx->block;
padding = 56;
@@ -200,7 +201,7 @@ static int md4_final(struct shash_desc *desc, u8 *out)
mctx->block[14] = mctx->byte_count << 3;
mctx->block[15] = mctx->byte_count >> 29;
le32_to_cpu_array(mctx->block, (sizeof(mctx->block) -
- sizeof(u64)) / sizeof(u32));
+ sizeof(u64)) / sizeof(u32));
md4_transform(mctx->hash, mctx->block);
cpu_to_le32_array(mctx->hash, ARRAY_SIZE(mctx->hash));
memcpy(out, mctx->hash, sizeof(mctx->hash));

base-commit: 7877cb91f1081754a1487c144d85dc0d2e2e7fc4
--
2.39.2 (Apple Git-143)