commit | 1ef7a53fa29d058abd3fd5aab8acde016f15df06 | [log] [tgz] |
---|---|---|
author | Paul Bakker <p.j.bakker@polarssl.org> | Sat Jun 20 10:50:55 2009 +0000 |
committer | Paul Bakker <p.j.bakker@polarssl.org> | Sat Jun 20 10:50:55 2009 +0000 |
tree | 8927fa53785d4f834139178167db12340696dd0d | |
parent | f7ca7b99dd52ed9faec06cb2158599d5fc8261c6 [diff] [blame] |
- Fixed incorrect handling of negative first input value in mpi_sub_abs() (found by code coverage tests).
diff --git a/library/bignum.c b/library/bignum.c index 218e50b..9f11a70 100644 --- a/library/bignum.c +++ b/library/bignum.c
@@ -762,6 +762,11 @@ if( X != A ) MPI_CHK( mpi_copy( X, A ) ); + /* + * X should always be positive as a result of unsigned substractions. + */ + X->s = 1; + ret = 0; for( n = B->n - 1; n >= 0; n-- )