staging: skein: Convert local rotl_64 to kernel's rol64
authorJoe Perches <joe@perches.com>
Mon, 28 Mar 2016 23:51:17 +0000 (16:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Mar 2016 19:40:20 +0000 (12:40 -0700)
Remove the local inline and use the generic kernel rol64 instead.

Miscellanea:

o Added a newline between a multiple line macro for consistency
  with the other multiple line macros

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/skein/skein_base.h
drivers/staging/skein/skein_block.c

index 3c7f8ad3627d7e38e7c1697f51d837bdda75cbc6..9c4be1ab2c5d5e1210437d854c295e5867c317c4 100644 (file)
@@ -84,11 +84,6 @@ struct skein_1024_ctx { /* 1024-bit Skein hash context structure */
        u8 b[SKEIN_1024_BLOCK_BYTES];   /* partial block buf (8-byte aligned) */
 };
 
-static inline u64 rotl_64(u64 x, u8 N)
-{
-       return (x << N) | (x >> (64 - N));
-}
-
 /* Skein APIs for (incremental) "straight hashing" */
 int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len);
 int skein_512_init(struct skein_512_ctx *ctx, size_t hash_bit_len);
index 45b47327e02444c94f56c3c385e54b031bd04418..1a547b307b33a2719972ce87ac141b55b767eda5 100644 (file)
@@ -15,6 +15,7 @@
 ************************************************************************/
 
 #include <linux/string.h>
+#include <linux/bitops.h>
 #include "skein_base.h"
 #include "skein_block.h"
 
 #define ROUND256(p0, p1, p2, p3, ROT, r_num)         \
        do {                                         \
                X##p0 += X##p1;                      \
-               X##p1 = rotl_64(X##p1, ROT##_0);     \
+               X##p1 = rol64(X##p1, ROT##_0);       \
                X##p1 ^= X##p0;                      \
                X##p2 += X##p3;                      \
-               X##p3 = rotl_64(X##p3, ROT##_1);     \
+               X##p3 = rol64(X##p3, ROT##_1);       \
                X##p3 ^= X##p2;                      \
        } while (0)
 
 #define ROUND512(p0, p1, p2, p3, p4, p5, p6, p7, ROT, r_num)    \
        do {                                                    \
                X##p0 += X##p1;                                 \
-               X##p1 = rotl_64(X##p1, ROT##_0);                \
+               X##p1 = rol64(X##p1, ROT##_0);                  \
                X##p1 ^= X##p0;                                 \
                X##p2 += X##p3;                                 \
-               X##p3 = rotl_64(X##p3, ROT##_1);                \
+               X##p3 = rol64(X##p3, ROT##_1);                  \
                X##p3 ^= X##p2;                                 \
                X##p4 += X##p5;                                 \
-               X##p5 = rotl_64(X##p5, ROT##_2);                \
+               X##p5 = rol64(X##p5, ROT##_2);                  \
                X##p5 ^= X##p4;                                 \
-               X##p6 += X##p7; X##p7 = rotl_64(X##p7, ROT##_3);\
+               X##p6 += X##p7;                                 \
+               X##p7 = rol64(X##p7, ROT##_3);                  \
                X##p7 ^= X##p6;                                 \
        } while (0)
 
                  pF, ROT, r_num)                                             \
        do {                                                                  \
                X##p0 += X##p1;                                               \
-               X##p1 = rotl_64(X##p1, ROT##_0);                              \
+               X##p1 = rol64(X##p1, ROT##_0);                                \
                X##p1 ^= X##p0;                                               \
                X##p2 += X##p3;                                               \
-               X##p3 = rotl_64(X##p3, ROT##_1);                              \
+               X##p3 = rol64(X##p3, ROT##_1);                                \
                X##p3 ^= X##p2;                                               \
                X##p4 += X##p5;                                               \
-               X##p5 = rotl_64(X##p5, ROT##_2);                              \
+               X##p5 = rol64(X##p5, ROT##_2);                                \
                X##p5 ^= X##p4;                                               \
                X##p6 += X##p7;                                               \
-               X##p7 = rotl_64(X##p7, ROT##_3);                              \
+               X##p7 = rol64(X##p7, ROT##_3);                                \
                X##p7 ^= X##p6;                                               \
                X##p8 += X##p9;                                               \
-               X##p9 = rotl_64(X##p9, ROT##_4);                              \
+               X##p9 = rol64(X##p9, ROT##_4);                                \
                X##p9 ^= X##p8;                                               \
                X##pA += X##pB;                                               \
-               X##pB = rotl_64(X##pB, ROT##_5);                              \
+               X##pB = rol64(X##pB, ROT##_5);                                \
                X##pB ^= X##pA;                                               \
                X##pC += X##pD;                                               \
-               X##pD = rotl_64(X##pD, ROT##_6);                              \
+               X##pD = rol64(X##pD, ROT##_6);                                \
                X##pD ^= X##pC;                                               \
                X##pE += X##pF;                                               \
-               X##pF = rotl_64(X##pF, ROT##_7);                              \
+               X##pF = rol64(X##pF, ROT##_7);                                \
                X##pF ^= X##pE;                                               \
        } while (0)