Mercurial > dropbear
comparison bn_mp_prime_fermat.c @ 190:d8254fc979e9 libtommath-orig LTM_0.35
Initial import of libtommath 0.35
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 06 May 2005 08:59:30 +0000 |
parents | d29b64170cf0 |
children |
comparison
equal
deleted
inserted
replaced
142:d29b64170cf0 | 190:d8254fc979e9 |
---|---|
41 return err; | 41 return err; |
42 } | 42 } |
43 | 43 |
44 /* compute t = b**a mod a */ | 44 /* compute t = b**a mod a */ |
45 if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { | 45 if ((err = mp_exptmod (b, a, a, &t)) != MP_OKAY) { |
46 goto __T; | 46 goto LBL_T; |
47 } | 47 } |
48 | 48 |
49 /* is it equal to b? */ | 49 /* is it equal to b? */ |
50 if (mp_cmp (&t, b) == MP_EQ) { | 50 if (mp_cmp (&t, b) == MP_EQ) { |
51 *result = MP_YES; | 51 *result = MP_YES; |
52 } | 52 } |
53 | 53 |
54 err = MP_OKAY; | 54 err = MP_OKAY; |
55 __T:mp_clear (&t); | 55 LBL_T:mp_clear (&t); |
56 return err; | 56 return err; |
57 } | 57 } |
58 #endif | 58 #endif |