From: Harvey Harrison <harvey.harrison@gmail.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines
Date: Tue, 15 Apr 2008 12:16:03 -0700 [thread overview]
Message-ID: <1208286963.11920.90.camel@brick> (raw)
Use the generic kernel implementation of the bit-rotation routines.
The generic routines to not shift by mod 32, but all callers in the
file pass constant values less than 32 making this a non-issue.
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
drivers/crypto/padlock-aes.c | 19 +++----------------
1 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
index 2f3ad3f..84adbc0 100644
--- a/drivers/crypto/padlock-aes.c
+++ b/drivers/crypto/padlock-aes.c
@@ -45,6 +45,7 @@
#include <crypto/algapi.h>
#include <crypto/aes.h>
+#include <linux/bitops.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
@@ -86,22 +87,8 @@ struct aes_ctx {
/* ====== Key management routines ====== */
-static inline uint32_t
-generic_rotr32 (const uint32_t x, const unsigned bits)
-{
- const unsigned n = bits % 32;
- return (x >> n) | (x << (32 - n));
-}
-
-static inline uint32_t
-generic_rotl32 (const uint32_t x, const unsigned bits)
-{
- const unsigned n = bits % 32;
- return (x << n) | (x >> (32 - n));
-}
-
-#define rotl generic_rotl32
-#define rotr generic_rotr32
+#define rotl rol32
+#define rotr ror32
/*
* #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
--
1.5.5.144.g3e42
next reply other threads:[~2008-04-15 19:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-15 19:16 Harvey Harrison [this message]
2008-04-15 20:05 ` [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines Andrew Morton
2008-04-15 20:07 ` Harvey Harrison
2008-04-15 22:23 ` Harvey Harrison
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=1208286963.11920.90.camel@brick \
--to=harvey.harrison@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=herbert@gondor.apana.org.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.