From: Eric Rost <eric.rost@mybabylon.net>
To: gregkh@linuxfoundation.org, jason@lakedaemon.net, jake@lwn.net,
antonysaraev@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: [PATCH v4 5/7] staging: skein: Inlines rotl_64
Date: Fri, 24 Oct 2014 06:19:17 -0500 [thread overview]
Message-ID: <5dbe104122b60b509a58a5ff804d32d40f6f41fb.1414149238.git.eric.rost@mybabylon.net> (raw)
In-Reply-To: <cover.1414149238.git.eric.rost@mybabylon.net>
Inlines the rotl_64 macro.
Signed-off-by: Eric Rost <eric.rost@mybabylon.net>
---
drivers/staging/skein/skein_base.h | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h
index 9f10af9..0111fa4 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) \
@@ -49,12 +45,12 @@ enum {
SKEIN_BAD_HASHLEN = 2
};
-#define SKEIN_MODIFIER_WORDS (2) /* number of modifier (tweak) words */
+#define SKEIN_MODIFIER_WORDS 2 /* number of modifier (tweak) words */
-#define SKEIN_256_STATE_WORDS (4)
-#define SKEIN_512_STATE_WORDS (8)
-#define SKEIN_1024_STATE_WORDS (16)
-#define SKEIN_MAX_STATE_WORDS (16)
+#define SKEIN_256_STATE_WORDS 4
+#define SKEIN_512_STATE_WORDS 8
+#define SKEIN_1024_STATE_WORDS 16
+#define SKEIN_MAX_STATE_WORDS 16
#define SKEIN_256_STATE_BYTES (8*SKEIN_256_STATE_WORDS)
#define SKEIN_512_STATE_BYTES (8*SKEIN_512_STATE_WORDS)
@@ -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
next prev parent reply other threads:[~2014-10-24 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-24 11:16 [PATCH v4 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
2014-10-24 11:16 ` [PATCH v4 1/7] staging: skein: Collapses threefish module Eric Rost
2014-10-24 11:17 ` [PATCH v4 2/7] staging: skein: Renames skein to skein_base Eric Rost
2014-10-24 11:17 ` [PATCH v4 3/7] staging: skein: Adds CryptoAPI Support Eric Rost
2014-10-24 11:18 ` [PATCH v4 4/7] staging: skein: Adds Loadable Module Support Eric Rost
2014-10-24 11:19 ` Eric Rost [this message]
2014-10-24 11:19 ` [PATCH v4 6/7] staging: skein: Removes unneeded #define Eric Rost
2014-10-24 11:20 ` [PATCH v4 7/7] staging: skein: Removes skein_debug include Eric Rost
2014-10-24 11:23 ` [PATCH v4 0/7] staging: skein: CryptoAPI and Module Support Eric Rost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5dbe104122b60b509a58a5ff804d32d40f6f41fb.1414149238.git.eric.rost@mybabylon.net \
--to=eric.rost@mybabylon.net \
--cc=antonysaraev@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jake@lwn.net \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®