* [PATCH v2] lib/crypto: md5: remove unused header
@ 2026-10-15 6:08 Mohamad Raizudeen
2026-10-15 17:56 ` Eric Biggers
0 siblings, 1 reply; 3+ messages in thread
From: Mohamad Raizudeen @ 2026-10-15 6:08 UTC (permalink / raw)
To: herbert, ebiggers, ardb
Cc: Jason, skhan, me, jkoolstra, linux-crypto, linux-kernel,
Mohamad Raizudeen
The `<linux/unaligned.h>` header is included but never actually used.
The code handles memory accesses using direct pointer casts and
functions like 'cpu_to_le64()' instead of the unaligned helpers.
Remove this unused header to avoid false dependencies.
Signed-off-by: Mohamad Raizudeen <raizudeen.kerneldev@gmail.com>
---
Changes in v2:
- Drop the addition of bitops.h as it is already included by kernel.h.
lib/crypto/md5.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/crypto/md5.c b/lib/crypto/md5.c
index 3d2b017a0525..ded7ccd1a5fc 100644
--- a/lib/crypto/md5.c
+++ b/lib/crypto/md5.c
@@ -16,7 +16,6 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
-#include <linux/unaligned.h>
#include <linux/wordpart.h>
static const struct md5_block_state md5_iv = {
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] lib/crypto: md5: remove unused header
2026-10-15 6:08 [PATCH v2] lib/crypto: md5: remove unused header Mohamad Raizudeen
@ 2026-10-15 17:56 ` Eric Biggers
2026-10-16 2:26 ` Mohamad Raizudeen
0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2026-10-15 17:56 UTC (permalink / raw)
To: Mohamad Raizudeen
Cc: herbert, ardb, Jason, skhan, me, jkoolstra, linux-crypto, linux-kernel
On Thu, Oct 15, 2026 at 11:38:06AM +0530, Mohamad Raizudeen wrote:
> The code handles memory accesses using direct pointer casts and
> functions like 'cpu_to_le64()' instead of the unaligned helpers.
This should say "using memcpy() instead of the unaligned helpers". The
actual unaligned accesses in lib/crypto/md5.c are the following:
memcpy(in, data, MD5_BLOCK_SIZE);
le32_to_cpu_array(in, ARRAY_SIZE(in));
and:
cpu_to_le32_array(ctx->state.h, ARRAY_SIZE(ctx->state.h));
memcpy(out, ctx->state.h, MD5_DIGEST_SIZE);
- Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] lib/crypto: md5: remove unused header
2026-10-15 17:56 ` Eric Biggers
@ 2026-10-16 2:26 ` Mohamad Raizudeen
0 siblings, 0 replies; 3+ messages in thread
From: Mohamad Raizudeen @ 2026-10-16 2:26 UTC (permalink / raw)
To: Eric Biggers
Cc: herbert, ardb, Jason, skhan, me, jkoolstra, linux-crypto, linux-kernel
On Thu, Oct 15, 2026 at 05:56:55PM +0000, Eric Biggers wrote:
> On Thu, Oct 15, 2026 at 11:38:06AM +0530, Mohamad Raizudeen wrote:
> > The code handles memory accesses using direct pointer casts and
> > functions like 'cpu_to_le64()' instead of the unaligned helpers.
>
> This should say "using memcpy() instead of the unaligned helpers". The
> actual unaligned accesses in lib/crypto/md5.c are the following:
>
> memcpy(in, data, MD5_BLOCK_SIZE);
> le32_to_cpu_array(in, ARRAY_SIZE(in));
>
> and:
>
> cpu_to_le32_array(ctx->state.h, ARRAY_SIZE(ctx->state.h));
> memcpy(out, ctx->state.h, MD5_DIGEST_SIZE);
>
> - Eric
You are right, the main data block accesses use memcpy().
The reason I mentioned "direct pointer access" because of the
`*(__le64 *)` cast used for the bitcount padding in __md5_final() and
hmac_md5_final(). But I agree that mentioning memcpy() is more accurate
for the whole file.
I will update the commit message and send a v3 soon.
Thanks,
Mohamad Raizudeen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-16 2:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-15 6:08 [PATCH v2] lib/crypto: md5: remove unused header Mohamad Raizudeen
2026-10-15 17:56 ` Eric Biggers
2026-10-16 2:26 ` Mohamad Raizudeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®