On Tue, Dec 02, 2003, Ashutosh Jaiswal wrote: > I might be doing something really stupid, but I checked my code again > and don't seem to be able to find it. I'm trying to use the function > BN_mod_exp for values which are earlier generated by other BN_* > functions. Here's the code: > > e = BN_new(); > > /* e = (a ^ t) (mod(phi)) */ > if (!BN_mod_exp(e, a, t, phi, ctx)){ > BIO_printf(bio_err, "Can't calculate e = 2^t mod(phi)"); > ERR_print_errors(bio_err); > goto err5; > } > > > I get the following error from gdb: > > Program received signal SIGSEGV, Segmentation fault. > 0x4cd31169 in free () from /lib/libc.so.6 > (gdb) > > An example set of values generated by the program before segfaulting are: > > p: E885D06663F9DAF3 > > q:E3DCF32C591FF3A5 > > n: CEF757A92F690551B3D2C608994BC79F > > (p-1): E885D06663F9DAF2 > > (q-1): E3DCF32C591FF3A4 > > phi: CEF757A92F69054FE7700275DC31F908 > > t: 2710 > > a: 2 /*achieved by using BN_dec2bn*/ > > I would appreciate any help on this. >
Why don't you compile it with debugging symbols so its possible to see where it crashed? That looks like you are manually working out the CRT components... the standard OpenSSL RSA functions will do that. Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]