lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080213183628.GB6150@joi>
Date:	Wed, 13 Feb 2008 19:36:49 +0100
From:	Marcin Slusarz <marcin.slusarz@...il.com>
To:	Roel Kluin <12o3l@...cali.nl>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] crypto: be*_add_cpu conversion

On Wed, Feb 13, 2008 at 09:25:47AM +0100, Roel Kluin wrote:
> marcin.slusarz@...il.com wrote:
> > From: Marcin Slusarz <marcin.slusarz@...il.com>
> > 
> > replace all:
> > big_endian_variable = cpu_to_beX(beX_to_cpu(big_endian_variable) +
> > 					expression_in_cpu_byteorder);
> > with:
> > 	beX_add_cpu(&big_endian_variable, expression_in_cpu_byteorder);
> > generated with semantic patch
> > 
> > Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
> > Cc: Herbert Xu <herbert@...dor.apana.org.au>
> > Cc: David S. Miller <davem@...emloft.net>
> > ---
> >  crypto/lrw.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/crypto/lrw.c b/crypto/lrw.c
> > index 9d52e58..4d93928 100644
> > --- a/crypto/lrw.c
> > +++ b/crypto/lrw.c
> > @@ -92,7 +92,7 @@ struct sinfo {
> >  static inline void inc(be128 *iv)
> >  {
> >  	if (!(iv->b = cpu_to_be64(be64_to_cpu(iv->b) + 1)))
> 
> maybe you also want instead of the line above:
> 
> 	be64_add_cpu(&iv->b, 1);
> 	if (!iv->b)
> 
> > -		iv->a = cpu_to_be64(be64_to_cpu(iv->a) + 1);
> > +		be64_add_cpu(&iv->a, 1);
> >  }
> >  
> >  static inline void lrw_round(struct sinfo *s, void *dst, const void *src)
> 
I'm a bit ashamed... but here is updated patch:
---
crypto: replace all adds to big endians variables with be*_add_cpu

replace all:
big_endian_variable = cpu_to_beX(beX_to_cpu(big_endian_variable) +
					expression_in_cpu_byteorder);
with:
	beX_add_cpu(&big_endian_variable, expression_in_cpu_byteorder);

Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
Cc: David S. Miller <davem@...emloft.net>
Cc: Roel Kluin <12o3l@...cali.nl>
---
 crypto/lrw.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/crypto/lrw.c b/crypto/lrw.c
index 9d52e58..8ef664e 100644
--- a/crypto/lrw.c
+++ b/crypto/lrw.c
@@ -91,8 +91,9 @@ struct sinfo {
 
 static inline void inc(be128 *iv)
 {
-	if (!(iv->b = cpu_to_be64(be64_to_cpu(iv->b) + 1)))
-		iv->a = cpu_to_be64(be64_to_cpu(iv->a) + 1);
+	be64_add_cpu(&iv->b, 1);
+	if (!iv->b)
+		be64_add_cpu(&iv->a, 1);
 }
 
 static inline void lrw_round(struct sinfo *s, void *dst, const void *src)
-- 
1.5.3.7

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ