Skip to content

Commit

Permalink
bugfix: 0 - w (w != 0) is actually negative
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Larsch committed Jul 17, 2005
1 parent 3eeaab4 commit 449bd38
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crypto/bn/bn_word.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,13 @@ int BN_sub_word(BIGNUM *a, BN_ULONG w)
/* degenerate case: w is zero */
if (!w) return 1;
/* degenerate case: a is zero */
if(BN_is_zero(a)) return BN_set_word(a,w);
if(BN_is_zero(a))
{
i = BN_set_word(a,w);
if (i != 0)
BN_set_negative(a, 1);
return i;
}
/* handle 'a' when negative */
if (a->neg)
{
Expand Down

0 comments on commit 449bd38

Please sign in to comment.