[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <526ddde46b763e0cf082353233751f2cf5beda55.1414116450.git.eric.rost@mybabylon.net>
Date: Thu, 23 Oct 2014 21:12:11 -0500
From: Eric Rost <eric.rost@...abylon.net>
To: gregkh@...uxfoundation.org, jason@...edaemon.net, jake@....net,
antonysaraev@...il.com
Cc: devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH v4 3/3] staging: skein: Inlines rotl_64
Inlines the macro definition rotl_64 to avoid bugs.
Signed-off-by: Eric Rost <eric.rost@...abylon.net>
---
drivers/staging/skein/skein_base.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
index 9f10af9..769bcb4 100644
--- a/drivers/staging/skein/skein_base.h
+++ b/drivers/staging/skein/skein_base.h
@@ -33,10 +33,6 @@
#define SKEIN512_DIGEST_BIT_SIZE 512
#define SKEIN1024_DIGEST_BIT_SIZE 1024
-#ifndef rotl_64
-#define rotl_64(x, N) (((x) << (N)) | ((x) >> (64-(N))))
-#endif
-
/* below two prototype assume we are handed aligned data */
#define skein_put64_lsb_first(dst08, src64, b_cnt) memcpy(dst08, src64, b_cnt)
#define skein_get64_lsb_first(dst64, src08, w_cnt) \
@@ -92,6 +88,11 @@ struct skein_1024_ctx { /* 1024-bit Skein hash context structure */
u8 b[SKEIN_1024_BLOCK_BYTES]; /* partial block buf (8-byte aligned) */
};
+static inline int rotl_64(int x, int 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);
--
2.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists