> From: Todd Williams <[EMAIL PROTECTED]>
>
> Todd.Williams> Square test failed!
> Todd.Williams> make: *** [test_bn] Error 1
> From: Richard Levitte - VMS Whacker [mailto:[EMAIL PROTECTED]]
>
> You should find the file test/tmp.bntest, which contains what went
> through bc. Perhaps some investigation of it would help?
The problem seems to now be in the BN_sqr function, not bc.
Here's the results of the test:
test BN_sqr
print "test BN_sqr\n"
-C64600F4F4 * -C64600F4F4 - B44048221A6E7E4
Square test failed!
1
I investigated the test_sqr function in bntest.c. The test is checking to
see if n * n - (n^2) = 0. It actually tests this calculation:
((n^2) / n) - n == 0.
..or..
c = a ^ 2
d = c / a
d = d - a
d == 0
I can do the same calculation manually within bc and see that the problem is
in bntest's calculation of (a^2), which is calculated with the BN_sqr
function.
BN_sqr has calculated (-C64600F4F4 ^ 2) as B44048221A6E7E4 which is
incorrect.
> bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
a = -C64600F4F4
a
-9646009494
a * a
93045499158338136036
93045499158338136036 / -9646009494
-9646009494
B44048221A6E7E4
944048221969794
You can see bc knows that -0xC64600F4F4 (decimal -9646009494) squared is
93045499158338136036, not 944048221969794 (0xB44048221A6E7E4) as BN_sqr
calculated it.
So I guess now we should look at BN_sqr function to see why it isn't
working.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]