Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1096741 (part 2) - In mp_exptmod_safe_i(), instantiate |tmp| lazi…
…ly, r=rrelyea, r=kaie
  • Loading branch information
nnethercote committed Nov 13, 2014
1 parent 2f62227 commit c6c24b7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/freebl/mpi/mpmontg.c
Expand Up @@ -911,7 +911,6 @@ mp_err mp_exptmod_safe_i(const mp_int * montBase,

MP_CHECKOK( mp_init_size(&accum1, 3 * nLen + 2) );
MP_CHECKOK( mp_init_size(&accum2, 3 * nLen + 2) );
MP_CHECKOK( mp_init_size(&tmp, 3 * nLen + 2) );

/* build the first WEAVE_WORD powers inline */
/* if WEAVE_WORD_SIZE is not 4, this code will have to change */
Expand Down Expand Up @@ -993,6 +992,11 @@ mp_err mp_exptmod_safe_i(const mp_int * montBase,
pa1 = &accum1;
pa2 = &accum2;

/* tmp is not used if window_bits == 1. */
if (window_bits != 1) {
MP_CHECKOK( mp_init_size(&tmp, 3 * nLen + 2) );
}

for (expOff = bits_in_exponent - window_bits*2; expOff >= 0; expOff -= window_bits) {
mp_size smallExp;
MP_CHECKOK( mpl_get_bits(exponent, expOff, window_bits) );
Expand Down

0 comments on commit c6c24b7

Please sign in to comment.