public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines
@ 2008-04-15 19:16 Harvey Harrison
  2008-04-15 20:05 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Harvey Harrison @ 2008-04-15 19:16 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Andrew Morton, LKML

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




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines
  2008-04-15 19:16 [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines Harvey Harrison
@ 2008-04-15 20:05 ` Andrew Morton
  2008-04-15 20:07   ` Harvey Harrison
  2008-04-15 22:23   ` Harvey Harrison
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2008-04-15 20:05 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: herbert, linux-kernel

On Tue, 15 Apr 2008 12:16:03 -0700
Harvey Harrison <harvey.harrison@gmail.com> wrote:

> 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 +++----------------

git-cryptodev.patch has taken a big chainsaw to the code which you're
patching.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines
  2008-04-15 20:05 ` Andrew Morton
@ 2008-04-15 20:07   ` Harvey Harrison
  2008-04-15 22:23   ` Harvey Harrison
  1 sibling, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-15 20:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: herbert, linux-kernel

On Tue, 2008-04-15 at 13:05 -0700, Andrew Morton wrote:
> On Tue, 15 Apr 2008 12:16:03 -0700
> Harvey Harrison <harvey.harrison@gmail.com> wrote:
> 
> > 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 +++----------------
> 
> git-cryptodev.patch has taken a big chainsaw to the code which you're
> patching.
> 

No worries, I'll wait for the crypto merge and see if this is still
there.

Harvey


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines
  2008-04-15 20:05 ` Andrew Morton
  2008-04-15 20:07   ` Harvey Harrison
@ 2008-04-15 22:23   ` Harvey Harrison
  1 sibling, 0 replies; 4+ messages in thread
From: Harvey Harrison @ 2008-04-15 22:23 UTC (permalink / raw)
  To: Andrew Morton; +Cc: herbert, linux-kernel

On Tue, 2008-04-15 at 13:05 -0700, Andrew Morton wrote:
> On Tue, 15 Apr 2008 12:16:03 -0700
> Harvey Harrison <harvey.harrison@gmail.com> wrote:
> 
> > 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 +++----------------
> 
> git-cryptodev.patch has taken a big chainsaw to the code which you're
> patching.

And after looking through cryptodev.git, this patch is indeed no longer
needed.

Harvey


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-15 22:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 19:16 [PATCH] crypto: padlock-aes.c replace private copy of bit rotation routines Harvey Harrison
2008-04-15 20:05 ` Andrew Morton
2008-04-15 20:07   ` Harvey Harrison
2008-04-15 22:23   ` Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox