commit | 88bbab22e96a5872c73337819290ff51424cdec7 | [log] [tgz] |
---|---|---|
author | Hanno Becker <hanno.becker@arm.com> | Thu May 11 15:57:15 2017 +0100 |
committer | Hanno Becker <hanno.becker@arm.com> | Thu May 11 15:57:15 2017 +0100 |
tree | 666c933514033a0eedae7af866fd6e152eb59087 | |
parent | 98864d5c0b154eda7aeb2c2bffe7e7e1c97424bc [diff] [blame] |
Correct sign in modular exponentiation algorithm. The modular exponentiation function handled the sign incorrectly. This commit fixes this and a test case which should have caught it.
diff --git a/library/bignum.c b/library/bignum.c index afde19b..211cb2a 100644 --- a/library/bignum.c +++ b/library/bignum.c
@@ -1788,7 +1788,7 @@ */ mpi_montred( X, N, mm, &T ); - if( neg ) + if( neg && E->n != 0 && ( E->p[0] & 1 ) != 0 ) { X->s = -1; MPI_CHK( mpi_add_mpi( X, N, X ) );