From: "Sean O'Riordain" <[EMAIL PROTECTED]>
seanpor> test BN_kronecker
seanpor> ...............................++++++
seanpor> bn_recp.c: BN_mul does not work
seanpor> r
seanpor>
=11541F8FE8920C6C986F34AF21225F3B7402C2CD3994F855256EB8353148B87C6D4D1BFFAFEA097DACE9234501921EBED3BC543215DD6EE498128465986560D46
seanpor> m
seanpor>
=EC5F453A532A005E56334E08A4DF8C97BD2DCBE51801BA1B4205CA86CBE261F21E42EB9B8288EAD51E8662B972F7F158D081FC2F220E12E5529A7E5B4ED22573
seanpor> r*m
seanpor>
=614CA801000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000614CA7FF74827FA50EEA62549C36A5B70B98DBD7BBF4C96650C20A4D931D7FCA85ECD81F73E2C2F60BDF52600D4890EFFA27D568AA6643C60E3420BC56DC2125FFFF1472
seanpor> make[1]: *** [test_bn] Error 134
seanpor> make[1]: Leaving directory `/home/sean/openssl-dev/test'
seanpor> make: *** [tests] Error 2
The following test program hows me a different result (it gives me
what is contained in the variables cs, which is the output from bc for
the same multiplication), which means that something is wrong in
bn_recp.c, or at least that's a theory:
#include <openssl/bn.h>
/* 1 BN_mod_mul()
2 BN_mul()
*/
#define FUNCTION 2
char *as =
"11541F8FE8920C6C986F34AF21225F3B7402C2CD3994F855256EB8353148B87C6D4D1BFFAFEA097DACE9234501921EBED3BC543215DD6EE498128465986560D46";
char *bs =
"EC5F453A532A005E56334E08A4DF8C97BD2DCBE51801BA1B4205CA86CBE261F21E42EB9B8288EAD51E8662B972F7F158D081FC2F220E12E5529A7E5B4ED22573";
char *cs = "1";
char *rs =
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF74827FA50EEA62549C36A5B70B98DBD7BBF4C96650C20A4D931D7FCA85ECD81F73E2C2F60BDF52600D4890EFFA27D568AA6643C60E3420BC56DC2125FFFF1472";
main()
{
BIGNUM *a = NULL;
BIGNUM *b = NULL;
BIGNUM *c = NULL;
BIGNUM *r = NULL;
BIGNUM *e = BN_new();
BIGNUM *d = BN_new();
BN_CTX *ctx = BN_CTX_new();
BN_ULONG bn_add_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl);
BN_ULONG bn_sub_part_words(BN_ULONG *r,
const BN_ULONG *a, const BN_ULONG *b,
int cl, int dl);
BN_ULONG carry;
int ret = 0;
if (BN_hex2bn(&a, as) == 0)
{
ERR_print_errors_fp(stderr);
exit(1);
}
if (BN_hex2bn(&b, bs) == 0)
{
ERR_print_errors_fp(stderr);
exit(1);
}
if (BN_hex2bn(&c, cs) == 0)
{
ERR_print_errors_fp(stderr);
exit(1);
}
if (BN_hex2bn(&r, rs) == 0)
{
ERR_print_errors_fp(stderr);
exit(1);
}
bn_wexpand(d,a->dmax);
carry = bn_sub_part_words(d->d,a->d,b->d,b->top,a->top-b->top);
switch(FUNCTION)
{
case 1:
ret = BN_mod_mul(e,a,b,c,ctx);
break;
case 2:
ret = BN_mul(e,a,b,ctx);
}
exit(0);
}
--
Richard Levitte \ Spannv�gen 38, II \ [EMAIL PROTECTED]
Chairman@Stacken \ S-168 35 BROMMA \ T: +46-8-26 52 47
Redakteur@Stacken \ SWEDEN \ or +46-709-50 36 10
Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/
Software Engineer, Celo Communications: http://www.celocom.com/
Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]