On 12/19/2012 3:59 AM, Anna Pavlova wrote:
> Hello Douglas,
>

Something completely different to try is to test use your libPkcs11.so
module with FireFox or Thunderbird:

FireFox:
Tools-> Options-> Advanced -> Security Devices -> Load
Then give it a name, and the /path/to/libPkcs11.so.

The if it loads, it will show up in the left hand column,
and list the readers it can see. If you put a card in the reader
it will show some info about it.

If that fails, then the problem is in your module for sure
and not OpenSC, and the problem may be in the way you link
the module.


I also see you module is C++. I don't think this is a problem
but could be.

Can you do a ldd pkcs11-tool
and ldd libPkcs11.so

There might be some share lib that both use but different versions.


>  >It sounds like opensc is compiled with the -g but not your module.
>
> you're right I didn't use the -g option while compiling my module, I added 
> the -g option into my project and now when I compile my module I do 
> (simplified):
>
> gcc -fpermissive -Wall -g   -c -O2 -I../foo/includes -fPIC  -MMD -MP -MF 
> build/Release/GNU-Linux-x86/source/foox.o.d -o 
> build/Release/GNU-Linux-x86/source/foox.o source/foox.cpp
>
> gcc -fpermissive -Wall -g -shared -o ../../../libPkcs11.so -fPIC 
> build/Release/GNU-Linux-x86/source/foos.o -L../../../ -lbase 
> -lboost_date_time -lboost_serialization -lboost_system -lboost_thread
> -lpkcs11crypto -lpcsclite -lstdc++ -lrt
>
>
> When I try to debug the p11->C_Initialize(NULL) line it doesn't allow me to 
> go into the call. I used
>
> (gdb) break pkcs11-tool.c:670
> (gdb) run
> Breakpoint 1, main (argc=5, argv=0xbffff294) at pkcs11-tool.c:670
> 670        rv = p11->C_Initialize(NULL);
> (gdb) step
>
> which immediately returns:
>
> Program received signal SIGSEGV, Segmentation fault.
> 0xd810b787 in ?? ()

OK, then lets step back a bit,
and set a breakpoint at C_LoadModule
Its in OpenSC ./common/libpkcs11.c

step through it (using s command)
step into the sc_dlopen, sc_dlsym
function (using n command)

Then step into the line:
rv = sc_get_function_list(func)
This should be the C_GetFunctionList command in your module.
Then print out the funcs:

  p *funcs

>
>
> I can give OpenSC-0.13.0 a try but I don't think with a newer version my 
> problem disappears...
>
>
>  >In the OpenSC ./src/pkcs11/Makefile.am has:
>  >
>  >    opensc_pkcs11_la_LDFLAGS = $(AM_LDFLAGS) \
>  >          -export-symbols "$(srcdir)/opensc-pkcs11.exports" \
>  >          -module -shared -avoid-version -no-undefined
>
> I'm sorry, but I don't really know what the -module and -no-undefined options 
> are :-(. Are these gcc options?

No they are libtool options, and it looks like on Ubuntu -module -no-undefined
are not required. But the -export-symbols tells the linker to only export
the functions as listed in opensc-pkcs11.exports which is one function
C_GetFunctionList.

Consider using libtool to build your module.


>
> Cheers,
> Anna
>
> On Tue, Dec 18, 2012 at 4:38 PM, Douglas E. Engert <deeng...@anl.gov 
> <mailto:deeng...@anl.gov>> wrote:
>
>     module
>
>

-- 

  Douglas E. Engert  <deeng...@anl.gov>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to