Skip to contentSkip to conversation

lib/halfmd4: Use rol32 inline function in the ROUND macro

PATCH New Alexander Kuleshov 1 participant 1 message Sep 13, 2015 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/halfmd4: Use rol32 inline function in the ROUND macro

The <linux/bitops.h> provides rol32() inline function, let's use already predefined function instead of direct expression.

---
 lib/halfmd4.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/halfmd4.c +2 -1
index a8fe627..137e861 100644
@@ -1,6 +1,7 @@
 #include <linux/compiler.h>
 #include <linux/export.h>
 #include <linux/cryptohash.h>
+#include <linux/bitops.h>
 
 /* F, G and H are basic MD4 functions: selection, majority, parity */
 #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
@@ -14,7 +15,7 @@
  * Rotation is separate from addition to prevent recomputation
  */
 #define ROUND(f, a, b, c, d, x, s)	\
-	(a += f(b, c, d) + x, a = (a << s) | (a >> (32 - s)))
+	(a += f(b, c, d) + x, a = rol32(a, s))
 #define K1 0
 #define K2 013240474631UL
 #define K3 015666365641UL
Signature · 1 line
2.5.0