Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

crypto/bn/bn_mul.c signed-ness issue

0 views
Skip to first unread message

Ivan D Nestlerode

unread,
Aug 2, 2001, 6:52:28 PM8/2/01
to

In OpenSSL 0.9.6b, (after running config for Solaris)
in bn_mul.c line 244 (function bn_mul_part_recursive),
there is a switch statement:

switch (c1*3+c2) {
case -4:
bn_sub_words(t, &(a[n]),a, n); /* - */
bn_sub_words(&(t[n]),b, &(b[n]),n); /* - */
break;
case -3:
......

The issue is that c1 and c2 are of type unsigned int.
The expression being switched on will never be negative,
so it is strange to have negative cases. I guess the -4 gets
interpreted as an unsigned or something strange.

If this is what was intended, my apologies for questioning
the code, but I thought it might be unintentional as it looks
like this code may have been pasted from elsewhere in the file.
bn_mul_recursive and bn_mul_high have similar switch statements,
but the variables there are signed.

Although, I am using 0.9.6b, I believe
this same code exists in the current CVS tree (I checked it
earlier today), but at a slightly different line.

-Ivan Nestlerode
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List opens...@openssl.org
Automated List Manager majo...@openssl.org

0 new messages