commit | f7ca7b99dd52ed9faec06cb2158599d5fc8261c6 | [log] [tgz] |
---|---|---|
author | Paul Bakker <p.j.bakker@polarssl.org> | Sat Jun 20 10:31:06 2009 +0000 |
committer | Paul Bakker <p.j.bakker@polarssl.org> | Sat Jun 20 10:31:06 2009 +0000 |
tree | b85186a48739f8e819ba727a22ee3e887612ab60 | |
parent | 05feca6f7cc26a22950d17f74c63a7b5e7a20eed [diff] |
- Fixed incorrect handling of one single negative input value in mpi_add_abs() (found by code coverage tests).
diff --git a/library/bignum.c b/library/bignum.c index 5c1de68..218e50b 100644 --- a/library/bignum.c +++ b/library/bignum.c
@@ -683,6 +683,11 @@ if( X != A ) MPI_CHK( mpi_copy( X, A ) ); + + /* + * X should always be positive as a result of unsigned additions. + */ + X->s = 1; for( j = B->n - 1; j >= 0; j-- ) if( B->p[j] != 0 )