Dr. Stephen Henson wrote:
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?

  
I'll do that and report back.
That looks like you are manually working out the CRT components... the
standard OpenSSL RSA functions will do that.

  
CRT? I'm trying to implement a Time lock crypto puzzle as documented at:
http://theory.lcs.mit.edu/~rivest/RivestShamirWagner-timelock.ps

I don't know if this is already implemented in OpenSSL.

thanks,
Ashu



Reply via email to