[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1232068858.5937.222.camel@yhuang-dev.sh.intel.com>
Date: Fri, 16 Jan 2009 09:20:58 +0800
From: Huang Ying <ying.huang@...el.com>
To: roel kluin <roel.kluin@...il.com>,
Herbert Xu <herbert@...dor.apana.org.au>
Cc: Sebastian Siewior <linux-crypto@...breakpoint.cc>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>
Subject: Re: [PATCH crypto -v4 2/2] AES-NI: Add support to Intel AES-NI
instructions for x86_64 platform
On Thu, 2009-01-15 at 17:47 +0800, roel kluin wrote:
> Sorry to bother,
>
> > +static int ecb_encrypt(struct blkcipher_desc *desc,
> > + struct scatterlist *dst, struct scatterlist *src,
> > + unsigned int nbytes)
> > +{
> > + struct crypto_aes_ctx *ctx = aes_ctx(crypto_blkcipher_ctx(desc->tfm));
> > + struct blkcipher_walk walk;
> > + int err;
> > +
> > + blkcipher_walk_init(&walk, dst, src, nbytes);
> > + err = blkcipher_walk_virt(desc, &walk);
> > +
> > + kernel_fpu_begin();
> > + while ((nbytes = walk.nbytes)) {
> > + aesni_ecb_enc(ctx, walk.dst.virt.addr, walk.src.virt.addr,
> > + nbytes & AES_BLOCK_MASK);
> > + nbytes &= AES_BLOCK_SIZE - 1;
> > + err = blkcipher_walk_done(desc, &walk, nbytes);
> > + }
> > + kernel_fpu_end();
> > +
> > + return err;
> > +}
>
> if blkcipher_walk_{virt,done} returns an error, don't we have to break
> out of the loop?
> i.e.
>
> while (!err && (nbytes = walk.nbytes))
>
> (if that's erroneous, it occurs in other places as well)
It seems that it is a bug.
But it seems that the similar code in geode-aes.c and padlock-aes.c has
same bug. I think we should fix them too.
Best Regards,
Huang Ying
Download attachment "signature.asc" of type "application/pgp-signature" (198 bytes)
Powered by blists - more mailing lists