Mercurial > dropbear
comparison libtommath/bn_mp_exptmod.c @ 1436:60fc6476e044
Update to libtommath v1.0
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sat, 24 Jun 2017 22:37:14 +0800 |
parents | 5ff8218bcee9 |
children | 8bba51a55704 |
comparison
equal
deleted
inserted
replaced
1435:f849a5ca2efc | 1436:60fc6476e044 |
---|---|
1 #include <tommath.h> | 1 #include <tommath_private.h> |
2 #ifdef BN_MP_EXPTMOD_C | 2 #ifdef BN_MP_EXPTMOD_C |
3 /* LibTomMath, multiple-precision integer library -- Tom St Denis | 3 /* LibTomMath, multiple-precision integer library -- Tom St Denis |
4 * | 4 * |
5 * LibTomMath is a library that provides multiple-precision | 5 * LibTomMath is a library that provides multiple-precision |
6 * integer arithmetic as well as number theoretic functionality. | 6 * integer arithmetic as well as number theoretic functionality. |
10 * additional optimizations in place. | 10 * additional optimizations in place. |
11 * | 11 * |
12 * The library is free for all purposes without any express | 12 * The library is free for all purposes without any express |
13 * guarantee it works. | 13 * guarantee it works. |
14 * | 14 * |
15 * Tom St Denis, [email protected], http://math.libtomcrypt.com | 15 * Tom St Denis, [email protected], http://libtom.org |
16 */ | 16 */ |
17 | 17 |
18 | 18 |
19 /* this is a shell function that calls either the normal or Montgomery | 19 /* this is a shell function that calls either the normal or Montgomery |
20 * exptmod functions. Originally the call to the montgomery code was | 20 * exptmod functions. Originally the call to the montgomery code was |
87 } | 87 } |
88 #endif | 88 #endif |
89 | 89 |
90 /* if the modulus is odd or dr != 0 use the montgomery method */ | 90 /* if the modulus is odd or dr != 0 use the montgomery method */ |
91 #ifdef BN_MP_EXPTMOD_FAST_C | 91 #ifdef BN_MP_EXPTMOD_FAST_C |
92 if (mp_isodd (P) == 1 || dr != 0) { | 92 if ((mp_isodd (P) == MP_YES) || (dr != 0)) { |
93 return mp_exptmod_fast (G, X, P, Y, dr); | 93 return mp_exptmod_fast (G, X, P, Y, dr); |
94 } else { | 94 } else { |
95 #endif | 95 #endif |
96 #ifdef BN_S_MP_EXPTMOD_C | 96 #ifdef BN_S_MP_EXPTMOD_C |
97 /* otherwise use the generic Barrett reduction technique */ | 97 /* otherwise use the generic Barrett reduction technique */ |
105 #endif | 105 #endif |
106 } | 106 } |
107 | 107 |
108 #endif | 108 #endif |
109 | 109 |
110 /* $Source: /cvs/libtom/libtommath/bn_mp_exptmod.c,v $ */ | 110 /* $Source$ */ |
111 /* $Revision: 1.4 $ */ | 111 /* $Revision$ */ |
112 /* $Date: 2006/03/31 14:18:44 $ */ | 112 /* $Date$ */ |