Andrey Ryabinin <ryabinin....@gmail.com> wrote:

> > David Howells <dhowe...@redhat.com> wrote:
> >
> >> +             if (!rp) {
> >> +                     if (mpi_resize(res, 1) < 0)
> >
> > This is better done with RESIZE_IF_NEEDED().
> >
> 
> mpi_resize() is equal to RESIZE_IF_NEEDED(), it also checks for allocated 
> space:
> 
> int mpi_resize(MPI a, unsigned nlimbs)
> {
> ....
>    if (nlimbs <= a->alloced)
>     return 0; /* no need to do it */

Hmmm...  In that case, should your patch use mpi_resize() rather than
RESIZE_IF_NEEDED()?  It's a trivial case that we should perhaps weed out much
earlier (ie. reject the key if exp<2 or mod<2), but it would make the object
file slightly smaller not to do the test twice.

David

Reply via email to