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?
  
Pardon my rather limited knowledge about debugging with gdb, but does this mean that there's some problem with glibc:
Program received signal SIGSEGV, Segmentation fault.
0x45964169 in free () from /lib/libc.so.6
(gdb) i sym 0x45964169
free + 74 in section .text
(gdb) i sym free
free in section .text

I recently upgraded my versions of glibc and gcc.
thanks,

Ashu

Reply via email to