~ubuntu-branches/ubuntu/utopic/dropbear/utopic-proposed

« back to all changes in this revision

Viewing changes to libtommath/bn_mp_reduce.c

  • Committer: Bazaar Package Importer
  • Author(s): Matt Johnston
  • Date: 2005-12-08 19:20:21 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051208192021-nyp9rwnt77nsg6ty
Tags: 0.47-1
* New upstream release.
* SECURITY: Fix incorrect buffer sizing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * precomputed via mp_reduce_setup.
20
20
 * From HAC pp.604 Algorithm 14.42
21
21
 */
22
 
int
23
 
mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
 
22
int mp_reduce (mp_int * x, mp_int * m, mp_int * mu)
24
23
{
25
24
  mp_int  q;
26
25
  int     res, um = m->used;
40
39
    }
41
40
  } else {
42
41
#ifdef BN_S_MP_MUL_HIGH_DIGS_C
43
 
    if ((res = s_mp_mul_high_digs (&q, mu, &q, um - 1)) != MP_OKAY) {
 
42
    if ((res = s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {
44
43
      goto CLEANUP;
45
44
    }
46
45
#elif defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C)
47
 
    if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um - 1)) != MP_OKAY) {
 
46
    if ((res = fast_s_mp_mul_high_digs (&q, mu, &q, um)) != MP_OKAY) {
48
47
      goto CLEANUP;
49
48
    }
50
49
#else