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

« back to all changes in this revision

Viewing changes to libtommath/bn_mp_prime_is_prime.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:
37
37
 
38
38
  /* is the input equal to one of the primes in the table? */
39
39
  for (ix = 0; ix < PRIME_SIZE; ix++) {
40
 
      if (mp_cmp_d(a, __prime_tab[ix]) == MP_EQ) {
 
40
      if (mp_cmp_d(a, ltm_prime_tab[ix]) == MP_EQ) {
41
41
         *result = 1;
42
42
         return MP_OKAY;
43
43
      }
60
60
 
61
61
  for (ix = 0; ix < t; ix++) {
62
62
    /* set the prime */
63
 
    mp_set (&b, __prime_tab[ix]);
 
63
    mp_set (&b, ltm_prime_tab[ix]);
64
64
 
65
65
    if ((err = mp_prime_miller_rabin (a, &b, &res)) != MP_OKAY) {
66
 
      goto __B;
 
66
      goto LBL_B;
67
67
    }
68
68
 
69
69
    if (res == MP_NO) {
70
 
      goto __B;
 
70
      goto LBL_B;
71
71
    }
72
72
  }
73
73
 
74
74
  /* passed the test */
75
75
  *result = MP_YES;
76
 
__B:mp_clear (&b);
 
76
LBL_B:mp_clear (&b);
77
77
  return err;
78
78
}
79
79
#endif