[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABpmuw+hs6__uWF=83psNRX-PbGuo+P8u3WXixswreBsqyne0Q@mail.gmail.com>
Date: Tue, 18 May 2021 21:53:04 +0800
From: hongbo li <herbert.tencent@...il.com>
To: Eric Biggers <ebiggers@...nel.org>
Cc: herberthbli(李弘博)
<herberthbli@...cent.com>,
"keyrings@...r.kernel.org" <keyrings@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"dhowells@...hat.com" <dhowells@...hat.com>,
"jarkko@...nel.org" <jarkko@...nel.org>,
"tianjia.zhang@...ux.alibaba.com" <tianjia.zhang@...ux.alibaba.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/7] lib/mpi: use kcalloc in mpi_resize(Internet mail)
Ok, I'll explain it in the next version of patches.
Regards,
Hongbo
Eric Biggers <ebiggers@...nel.org> 于2021年5月18日周二 上午5:29写道:
>
> On Thu, May 13, 2021 at 02:49:03PM +0000, herberthbli(李弘博) wrote:
> > 在 2021/5/13 3:08, Eric Biggers 写道:
> >
> > On Wed, May 12, 2021 at 10:04:09PM +0800, Hongbo Li wrote:
> >
> >
> > From: Hongbo Li <herberthbli@...cent.com><mailto:herberthbli@...cent.com>
> >
> > We should set the additional space to 0 in mpi_resize().
> > So use kcalloc() instead of kmalloc_array().
> >
> > Signed-off-by: Hongbo Li <herberthbli@...cent.com><mailto:herberthbli@...cent.com>
> >
> >
> >
> > Is this fixing something, and if so what?
> >
> > - Eric
> >
> >
> >
> > In lib/mpi/ec.c:
> >
> > /****************
> > * Resize the array of A to NLIMBS. the additional space is cleared
> > * (set to 0) [done by m_realloc()]
> > */
> > int mpi_resize(MPI a, unsigned nlimbs)
> >
> > Like the comment of kernel's mpi_resize(), the additional space need to set to 0,
> > but when a->d is not NULL, it does not set.
> >
> > The kernel's mpi lib is from libgcrypt, the mpi resize in libgcrypt is _gcry_mpi_resize()
> > which set the additional space to 0.
> >
> > This issue will cause add_points_edwards() get a wrong result, and lead to a failed
> > eddsa verification.
> >
>
> That sounds like it's fixing an existing bug, regardless of the ed25519 support.
> If that's indeed the case, what is the impact of that bug, and what commit is it
> fixing? Please explain in the commit message and not just email.
>
> - Eric
Powered by blists - more mailing lists