Hans,
I printed the size of the alloc after the mp_exptmod_fast() function
was called and it was changing from 0x40 to 0xC0. So this is what i
did in my keyread function(which reads from the file all the fields of
mp_int ) after i allocate the memory. This seems to solve the problem.

if (dh_pub->alloc != MP_PREC)
  {
       m_free (dh_pub->dp);
       dh_pub->dp = m_malloc (sizeof (mp_int) * dh_pub->alloc);
       TRACE (("pub key Alloc size changed\n"));
  }

On 10/2/06, Hans-Christian Egtvedt <[EMAIL PROTECTED]> wrote:
> >
> > Turns out underlying libtommath exp function changes/reallocates the
> > value of alloc and dp (in the mp_int) from whatever allocated in
> > mp_init(). This was the problem that was causing me weird behaviour
> > (becos of uclinux). Now offline keygeneration works fine for me.
>
> This is interessting, where in the code did you discover this? This
> might be the root to some problems I see on my platform.
>
> --
> With kind regards,
> Med vennlig hilsen,
>
> Hans-Christian Egtvedt, siv.ing. (M.Sc.)
> Applications Engineer - AVR Applications Lab
> Atmel Norway
>


Reply via email to