[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKLgIbI583asXCAc@gmail.com>
Date: Mon, 17 May 2021 14:29:05 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: herberthbli(李弘博)
<herberthbli@...cent.com>
Cc: Hongbo Li <herbert.tencent@...il.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)
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