linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib/crypto: use rol32 in md5.c
@ 2025-12-14 11:15 Rusydi H. Makarim
  2025-12-18 19:33 ` Eric Biggers
  0 siblings, 1 reply; 2+ messages in thread
From: Rusydi H. Makarim @ 2025-12-14 11:15 UTC (permalink / raw)
  To: Eric Biggers, Jason A. Donenfeld, Ard Biesheuvel
  Cc: linux-crypto, linux-kernel, kernel-janitor, Rusydi H. Makarim

use rol32 in MD5STEP

---
this patch replaces the bitwise left rotation in lib/crypto/md5.c
with rol32

Signed-off-by: Rusydi H. Makarim <rusydi.makarim@kriptograf.id>
---
 lib/crypto/md5.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/crypto/md5.c b/lib/crypto/md5.c
index c0610ea1370e..c4af57db0ea8 100644
--- a/lib/crypto/md5.c
+++ b/lib/crypto/md5.c
@@ -29,7 +29,7 @@ static const struct md5_block_state md5_iv = {
 #define F4(x, y, z) (y ^ (x | ~z))
 
 #define MD5STEP(f, w, x, y, z, in, s) \
-	(w += f(x, y, z) + in, w = (w << s | w >> (32 - s)) + x)
+	(w += f(x, y, z) + in, w = rol32(w, s) + x)
 
 static void md5_block_generic(struct md5_block_state *state,
 			      const u8 data[MD5_BLOCK_SIZE])

---
base-commit: 3f9f0252130e7dd60d41be0802bf58f6471c691d
change-id: 20251214-rol32_in_md5-a3299000db10

Best regards,
-- 
Rusydi H. Makarim <rusydi.makarim@kriptograf.id>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lib/crypto: use rol32 in md5.c
  2025-12-14 11:15 [PATCH] lib/crypto: use rol32 in md5.c Rusydi H. Makarim
@ 2025-12-18 19:33 ` Eric Biggers
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Biggers @ 2025-12-18 19:33 UTC (permalink / raw)
  To: Rusydi H. Makarim
  Cc: Jason A. Donenfeld, Ard Biesheuvel, linux-crypto, linux-kernel,
	kernel-janitor

On Sun, Dec 14, 2025 at 06:15:12PM +0700, Rusydi H. Makarim wrote:
> use rol32 in MD5STEP
> 
> ---
> this patch replaces the bitwise left rotation in lib/crypto/md5.c
> with rol32
> 
> Signed-off-by: Rusydi H. Makarim <rusydi.makarim@kriptograf.id>
> ---
>  lib/crypto/md5.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next

I cleaned up your commit message as follows:

commit 325c29e7d11caaf3b4f04f2c8f7d6bc4861cce5a
Author: Rusydi H. Makarim <rusydi.makarim@kriptograf.id>
Date:   Sun Dec 14 18:15:12 2025 +0700

    lib/crypto: md5: Use rol32() instead of open-coding it

    For the bitwise left rotation in MD5STEP, use rol32() from
    <linux/bitops.h> instead of open-coding it.

    Signed-off-by: Rusydi H. Makarim <rusydi.makarim@kriptograf.id>
    Link: https://lore.kernel.org/r/20251214-rol32_in_md5-v1-1-20f5f11a92b2@kriptograf.id
    Signed-off-by: Eric Biggers <ebiggers@kernel.org>

For future reference: please don't include a scissors line in the middle
of your commit message.  Everything below it gets cut off.

- Eric

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-18 19:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-14 11:15 [PATCH] lib/crypto: use rol32 in md5.c Rusydi H. Makarim
2025-12-18 19:33 ` Eric Biggers

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).