CRYPTO_set_id_callback problem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CRYPTO_set_id_callback problem

Steffen Pankratz
Hi

I have a Engine which uses pthreads and I copied the thread stuff from mttest.c to implement proper CRYPTO_set_locking_callback and  CRYPTO_set_id_callback functions.

If I don't call 'CRYPTO_set_id_callback' in 'void thread_setup(void)' openssl exits without any problem.

If I call  'CRYPTO_set_id_callback' and I quit openssl I get a segmentation fault, after 'void thread_cleanup(void)' prints 'done cleanup'
so cleanup should be complete.

#0  0xb7d76590 in ?? ()
#1  0xb7dadf39 in CRYPTO_thread_id () at cryptlib.c:444
#2  0xb7daede1 in CRYPTO_mem_ctrl (mode=3) at mem_dbg.c:198
#3  0xb7daf4f9 in CRYPTO_dbg_free (addr=0x80d9360, before_p=0) at mem_dbg.c:516
#4  0xb7daeaf9 in CRYPTO_free (str=0x80d9360) at mem.c:374
#5  0xb7e1dc3f in sk_free (st=0x80d9310) at stack.c:297
#6  0xb7e0c7ce in DSO_free (dso=0x80d92a8) at dso_lib.c:166
#7  0xb7e11762 in dynamic_data_ctx_free_func (parent=0x80d8fe8, ptr=0x80d9050,
    ad=0x80d903c, idx=0, argl=0, argp=0x0) at eng_dyn.c:171
#8  0xb7db0907 in int_free_ex_data (class_index=9, obj=0x80d8fe8, ad=0x80d903c)
    at ex_data.c:518
#9  0xb7db0ac2 in CRYPTO_free_ex_data (class_index=9, obj=0x80d8fe8,
    ad=0x80d903c) at ex_data.c:588
#10 0xb7e0d45f in engine_free_util (e=0x80d8fe8, locked=0) at eng_lib.c:132
#11 0xb7e0e3c2 in engine_unlocked_finish (e=0x80d8fe8, unlock_for_handlers=0)
    at eng_init.c:112
#12 0xb7e0f3f7 in int_cleanup_cb (p=0x80da3d0) at eng_table.c:205
#13 0xb7e0f424 in int_cleanup_cb_LHASH_DOALL (arg=0x80da3d0) at eng_table.c:208
#14 0xb7e1e26c in doall_util_fn (lh=0x80da268, use_arg=0,
    func=0xb7e0f40d <int_cleanup_cb_LHASH_DOALL>, func_arg=0, arg=0x0)
    at lhash.c:289
#15 0xb7e1e29a in lh_doall (lh=0x80da268,
    func=0xb7e0f40d <int_cleanup_cb_LHASH_DOALL>) at lhash.c:297
#16 0xb7e0f470 in engine_table_cleanup (table=0xb7eb5be8) at eng_table.c:214
#17 0xb7e108df in engine_unregister_all_ciphers () at tb_cipher.c:71
#18 0xb7e0d61d in engine_cleanup_cb_free (item=0x80da388) at eng_lib.c:183
#19 0xb7e1dbf0 in sk_pop_free (st=0x80cea20,
    func=0xb7e0d603 <engine_cleanup_cb_free>) at stack.c:290
#20 0xb7e0d669 in ENGINE_cleanup () at eng_lib.c:190
#21 0x08055f34 in main (Argc=11, Argv=0xbfc0fb28) at openssl.c:356

if I call 'CRYPTO_set_id_callback(NULL);' in 'void thread_cleanup(void)' I get this:

done cleanup
 2464 file=err.c, line=1001, number=396, address=080DA0A0
 2465 file=lhash.c, line=193, number=12, address=080D9428
 1860 file=lhash.c, line=119, number=96, address=080CED00
> thread=12750, file=err.c, line=420, info="int_thread_get (err.c)"
 1861 file=lhash.c, line=121, number=64, address=080CEDA0
> thread=12750, file=err.c, line=420, info="int_thread_get (err.c)"
568 bytes leaked in 4 chunks

This output comes from efence because openssl was compiled with debugging information.
With a 'normal' openssl build i don't see any errors.

Any suggestions?
Thank you.

--
Hypnos powered by LFS SVN-20041206 (Linux 2.6.14.1)
        visit http://www.kratz00.org/
                        http://liflg.org/

Best regards, Steffen Pankratz.
 
PGP PUBLIC KEY: http://www.kratz00.org/kratz00.at.gmx.de.asc
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]