On 2004.12.06 at 15:54:16 +0100, Dr. Stephen Henson wrote:

> 
> I doubt its related to the NIDs and OBJ_create(). The NIDs and associated
> objects duplicate strings for use in OpenSSLs internal tables and so there
> shouldn't be any hanging references when a DLL unloads.

Here is trace of our segfault.

Address 44339fd0 is address of constant string in our DLL.

#0  0x400f7d53 in lh_strhash (c=0x44339fd0 <Address 0x44339fd0 out of bounds>)
    at lhash.c:445
445             if ((c == NULL) || (*c == '\0'))
(gdb) bt
#0  0x400f7d53 in lh_strhash (c=0x44339fd0 <Address 0x44339fd0 out of bounds>)
    at lhash.c:445
#1  0x4008a911 in obj_name_hash (a_void=0xbffff480) at o_names.c:140
#2  0x400f7c69 in getrn (lh=0x4034afa0, data=0xbffff480, rhash=0xbffff44c)
    at lhash.c:406
#3  0x400f77e9 in lh_delete (lh=0x4034afa0, data=0xbffff480) at lhash.c:224
#4  0x4008ab83 in OBJ_NAME_remove (
    name=0x44339fd0 <Address 0x44339fd0 out of bounds>, type=2)
    at o_names.c:233
#5  0x4008ae29 in names_lh_free (onp=0x446c0ff0) at o_names.c:332
#6  0x4008ae48 in names_lh_free_LHASH_DOALL (arg=0x446c0ff0) at o_names.c:336
#7  0x400f794e in doall_util_fn (lh=0x4034afa0, use_arg=0, 
    func=0x4008ae31 <names_lh_free_LHASH_DOALL>, func_arg=0, arg=0x0)
    at lhash.c:289
#8  0x400f797c in lh_doall (lh=0x4034afa0, 
    func=0x4008ae31 <names_lh_free_LHASH_DOALL>) at lhash.c:297
#9  0x4008aecb in OBJ_NAME_cleanup (type=2) at o_names.c:353
#10 0x400ff899 in EVP_cleanup () at names.c:132
#11 0x08055dd4 in main (Argc=1, Argv=0xbffffa74) at openssl.c:355




> In any case the extra objects are freed up when OBJ_cleanup() is called.

Problem is that EVP_cleanup  calls OBJ_NAME_cleanup several times with
 various OBJ_NAME_TYPE flags before it is going to call OBJ_cleanup.

Really our problem seems to be located in another place. As dgst command works 
without segfault, it seems that in our case req doesn't just initialize engine 
properly. So, engine unload funcion doesn't get called before  EVP_cleanup.

In dgst it does, and there is no segfault.

It looks strange to me, because req uses digest method to generate signature 
under certificate request. (And since we are generating GOST algorithm key,
it use GOST message digest from our engine). Probably we have forgotten 
something when developed our patches to generalize asymmetric algorithm 
handling.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to