Re: [PATCH] MPI helper of addition one limb, Least Leak Intended

NIIBE Yutaka via Gcrypt-devel <[email protected]>
Newsgroups gmane.comp.encryption.gpg.libgcrypt.devel
Message-ID <[email protected]>
Hello, Jussi,

Jussi Kivilinna <[email protected]> wrote:
> I think this function could use 'add_ssaaaa' macro to handle addition with
> carry.
>
> Something like this (completely untested):
>
>    cy = s2_limb;
>    while ( s1_size )
>      {
>        x = *s1_ptr;
>        add_ssaaaa(cy, x, 0, cy, 0, x);
>        *s1_ptr++ = x;
>        s1_size--;
>      }
>    return cy;

Good.  I'm going to push this to master for _gcry_mpih_add_1_lli
function.

Further, I'm goint to push the chnage for _gcry_mpih_add_lli
function as:

mpi_limb_t
_gcry_mpih_add_lli (mpi_ptr_t wp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t usize)
{
  mpi_size_t i;
  mpi_limb_t cy;

  cy = 0;
  for (i = 0; i < usize; i++)
    {
      mpi_limb_t u = up[i];
      mpi_limb_t v = vp[i];
      mpi_limb_t w;

      add_ssaaaa (cy, w, 0, u, 0, cy);
      add_ssaaaa (cy, w, cy, w, 0, v);
      wp[i] = w;
    }

  return cy;
}
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.