diff options
| author | Charles.Forsyth <devnull@localhost> | 2008-06-12 21:45:38 +0000 |
|---|---|---|
| committer | Charles.Forsyth <devnull@localhost> | 2008-06-12 21:45:38 +0000 |
| commit | d9bd3181330830c49e714609e86eaa3e39a884ca (patch) | |
| tree | 9836330fa12c11f4dafce942e3eb23f8fcdf80c9 /libmp/port/mpinvert.c | |
| parent | 3d7a0c16959c77d931f7fdd2022945a563bbff10 (diff) | |
20080612-2245
Diffstat (limited to 'libmp/port/mpinvert.c')
| -rw-r--r-- | libmp/port/mpinvert.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libmp/port/mpinvert.c b/libmp/port/mpinvert.c index ee263070..45912d6b 100644 --- a/libmp/port/mpinvert.c +++ b/libmp/port/mpinvert.c @@ -9,13 +9,15 @@ void mpinvert(mpint *b, mpint *m, mpint *res) { mpint *dc1, *dc2; // don't care + int r; dc1 = mpnew(0); dc2 = mpnew(0); mpextendedgcd(b, m, dc1, res, dc2); - if(mpcmp(dc1, mpone) != 0) - abort(); - mpmod(res, m, res); + r = mpcmp(dc1, mpone); mpfree(dc1); mpfree(dc2); + if(r != 0) + sysfatal("mpinvert: no inverse"); + mpmod(res, m, res); } |
