DSO_load using DSO_method_dlfcn - Openssl

This is a discussion on DSO_load using DSO_method_dlfcn - Openssl ; How to load a DSO from within an engine? I call DSO_load(NULL, "mylibname", NULL, 0); The code path I debugged is as follows: #0 DSO_ctrl (dso=0x48ab98, cmd=2, larg=0, parg=0x0) at dso_lib.c:338 #1 0x2abb9c90 in DSO_load (dso=0x0, filename=0x2ae00888 "mylibname", meth=0x0, flags=0) ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: DSO_load using DSO_method_dlfcn

  1. DSO_load using DSO_method_dlfcn

    How to load a DSO from within an engine?

    I call DSO_load(NULL, "mylibname", NULL, 0);

    The code path I debugged is as follows:
    #0 DSO_ctrl (dso=0x48ab98, cmd=2, larg=0, parg=0x0) at dso_lib.c:338
    #1 0x2abb9c90 in DSO_load (dso=0x0, filename=0x2ae00888 "mylibname",
    meth=0x0, flags=0) at dso_lib.c:209

    DSO_load allocates a new DSO and assigns meth if I passed in the DSO_load
    function, if not it uses a default method. When I tested, it used
    DSO_method_dlfcn.

    The code goes further and calls DSO_ctrl, as the stack shows above. In
    DSO_ctrl, the function returns UNSUPPORTED error since the DSO_method_dlfcn
    has not defined dso->meth->dso_ctrl function pointer.

    Based on this code path, what is the step I'm missing to use DSO_load
    correctly?
    This load failure seems to have nothing to do with the library itself.

    Thanks,
    Piras


  2. Re: DSO_load using DSO_method_dlfcn

    Which version of openssl are you using?

    Cheers,
    Geoff

    On Monday 13 October 2008 16:08:53 Pirasenna Velandai Thiyagarajan wrote:
    > How to load a DSO from within an engine?
    >
    > I call DSO_load(NULL, "mylibname", NULL, 0);
    >
    > The code path I debugged is as follows:
    > #0 DSO_ctrl (dso=0x48ab98, cmd=2, larg=0, parg=0x0) at dso_lib.c:338
    > #1 0x2abb9c90 in DSO_load (dso=0x0, filename=0x2ae00888 "mylibname",
    > meth=0x0, flags=0) at dso_lib.c:209

    [snip]

    --
    Un terrien, c'est un singe avec des clefs de char...
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    Development Mailing List openssl-dev@openssl.org
    Automated List Manager majordomo@openssl.org


  3. Re: DSO_load using DSO_method_dlfcn

    On Mon, 2008-10-13 at 13:08 -0700, Pirasenna Velandai Thiyagarajan
    wrote:
    > How to load a DSO from within an engine?


    See the code that this patch is mostly ripping out in favour of direct
    linking:
    http://git.infradead.org/users/dwmw2...iff;h=624a38a1

    --
    David Woodhouse Open Source Technology Centre
    David.Woodhouse@intel.com Intel Corporation

    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    Development Mailing List openssl-dev@openssl.org
    Automated List Manager majordomo@openssl.org


  4. Re: DSO_load using DSO_method_dlfcn

    On Monday 13 October 2008 18:05:17 David Woodhouse wrote:
    > On Mon, 2008-10-13 at 13:08 -0700, Pirasenna Velandai Thiyagarajan
    >
    > wrote:
    > > How to load a DSO from within an engine?

    >
    > See the code that this patch is mostly ripping out in favour of direct
    > linking:
    > http://git.infradead.org/users/dwmw2...git?a=commitdi
    >ff;h=624a38a1


    I suspect the original poster's issue is the bind_engine() logic in
    engine.h, or rather something missing from it (maybe DSO, but I'm not
    sure). That could be total rubbish too, obviously. Which leads to me
    wondering what your patch is about ...

    What's the relation between this patch and the original poster's
    question? I suspect that I haven't fully understood what your patch is
    trying to resolve.

    Cheers,
    Geoff

    --
    Un terrien, c'est un singe avec des clefs de char...
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    Development Mailing List openssl-dev@openssl.org
    Automated List Manager majordomo@openssl.org


  5. Re: DSO_load using DSO_method_dlfcn

    On Mon, 2008-10-13 at 22:11 -0400, Geoff Thorpe wrote:
    > What's the relation between this patch and the original poster's
    > question? I suspect that I haven't fully understood what your patch is
    > trying to resolve.


    The question was 'how to load a DSO from within an engine'. That patch
    just highlights some existing, functional code which loads a DSO from
    within an external engine (the openssl_tpm_engine, from the Trousers
    project).

    It highlights that code by disabling it, but in doing so it does show
    where to look.

    The problem I was trying to resolve, in that particular case, was that
    the engine _was_ using DSO_load() and I didn't want it to. The opposite
    of the original poster's problem

    --
    David Woodhouse Open Source Technology Centre
    David.Woodhouse@intel.com Intel Corporation

    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    Development Mailing List openssl-dev@openssl.org
    Automated List Manager majordomo@openssl.org


  6. Re: DSO_load using DSO_method_dlfcn

    On Monday 13 October 2008 16:08:53 Pirasenna Velandai Thiyagarajan wrote:
    > How to load a DSO from within an engine?
    >
    > I call DSO_load(NULL, "mylibname", NULL, 0);
    >
    > The code path I debugged is as follows:
    > #0 DSO_ctrl (dso=0x48ab98, cmd=2, larg=0, parg=0x0) at dso_lib.c:338
    > #1 0x2abb9c90 in DSO_load (dso=0x0, filename=0x2ae00888 "mylibname",
    > meth=0x0, flags=0) at dso_lib.c:209
    >
    > DSO_load allocates a new DSO and assigns meth if I passed in the
    > DSO_load function, if not it uses a default method. When I tested, it
    > used DSO_method_dlfcn.
    >
    > The code goes further and calls DSO_ctrl, as the stack shows above.
    > In DSO_ctrl, the function returns UNSUPPORTED error since the
    > DSO_method_dlfcn has not defined dso->meth->dso_ctrl function pointer.


    As per my previous response, you'll need to tell me what version of
    openssl you're using. The current 0.9.8 code as well as the development
    HEAD define cmd=2 as "DSO_CTRL_SET_FLAGS" and DSO_ctrl() is supposed to
    handle this internally. DSO_ctrl() should only fall through and return
    UNSUPPORTED in the way you see if the control command isn't handled
    internally, which it clearly should be in this case.

    If you built openssl yourself, please let me know what version you
    downloaded and make sure also that you are linking against your own
    openssl library rather than something installed natively on your system.
    OTOH, if you're building against headers and libs that are pre-installed
    on your system, which OS and package version?

    Cheers,
    Geoff

    --
    Un terrien, c'est un singe avec des clefs de char...
    __________________________________________________ ____________________
    OpenSSL Project http://www.openssl.org
    Development Mailing List openssl-dev@openssl.org
    Automated List Manager majordomo@openssl.org


  7. Re: DSO_load using DSO_method_dlfcn

    I got this issue resolved just now. I had to use gcc to build the library
    instead of ld. I found that if I used ld, I was having many issues, whereas
    if I just used gcc to build the .so, all the issues went away. For example,
    __umcpdi2 was a function that my code was getting linked with Glibc. This
    function was marked as hidden and so the load was failing. When I used gcc
    as the linker, this problem did not come up. Similarly, I had to explicitly
    pass -shared flag to the ld. Otherwise the .so was not getting .EX_DYN flag
    set. I'm working with 0.9.8i version of OpenSSL on Linux.


    On Wed, Oct 15, 2008 at 7:27 AM, Geoff Thorpe wrote:

    > On Monday 13 October 2008 16:08:53 Pirasenna Velandai Thiyagarajan wrote:
    > > How to load a DSO from within an engine?
    > >
    > > I call DSO_load(NULL, "mylibname", NULL, 0);
    > >
    > > The code path I debugged is as follows:
    > > #0 DSO_ctrl (dso=0x48ab98, cmd=2, larg=0, parg=0x0) at dso_lib.c:338
    > > #1 0x2abb9c90 in DSO_load (dso=0x0, filename=0x2ae00888 "mylibname",
    > > meth=0x0, flags=0) at dso_lib.c:209
    > >
    > > DSO_load allocates a new DSO and assigns meth if I passed in the
    > > DSO_load function, if not it uses a default method. When I tested, it
    > > used DSO_method_dlfcn.
    > >
    > > The code goes further and calls DSO_ctrl, as the stack shows above.
    > > In DSO_ctrl, the function returns UNSUPPORTED error since the
    > > DSO_method_dlfcn has not defined dso->meth->dso_ctrl function pointer.

    >
    > As per my previous response, you'll need to tell me what version of
    > openssl you're using. The current 0.9.8 code as well as the development
    > HEAD define cmd=2 as "DSO_CTRL_SET_FLAGS" and DSO_ctrl() is supposed to
    > handle this internally. DSO_ctrl() should only fall through and return
    > UNSUPPORTED in the way you see if the control command isn't handled
    > internally, which it clearly should be in this case.
    >
    > If you built openssl yourself, please let me know what version you
    > downloaded and make sure also that you are linking against your own
    > openssl library rather than something installed natively on your system.
    > OTOH, if you're building against headers and libs that are pre-installed
    > on your system, which OS and package version?
    >
    > Cheers,
    > Geoff
    >
    > --
    > Un terrien, c'est un singe avec des clefs de char...
    >




    --
    Online Gallery: http://www.deptons.com
    You comments and ratings are very welcome!!


+ Reply to Thread