Re: opensc-pkcs11.so

2013-02-03 Thread Sergey Bronnikov
Stuart, 

thank you. It works.

On 14:15 Sun 03 Feb , Stuart Henderson wrote:
> On 2013/02/03 17:57, Sergey Bronnikov wrote:
> > Hi, everyone
> > 
> > may be someone knows why attempt to load that module failed:
> > 
> > ~$ ssh -I /usr/local/lib/pkcs11/opensc-pkcs11.so gw
> > dlopen /usr/local/lib/pkcs11/opensc-pkcs11.so failed: Cannot load specified 
> > object
> 
> ssh isn't linked with libpthread, so the symbols required by
> opensc-pkcs11.so aren't available.
> 
> The issue is that various weak-aliased functions in libc are overridden
> by functions in libpthread. If a shared library/module requires libpthread
> functions, it can only be dlopen()'d at runtime if libpthread was preloaded
> or was specifically linked to the executable.
> 
> The normal library dependency resolution has been specifically blocked
> for libpthread to ensure that the functions get overridden.
> 
> Try preloading libpthread like this:
> 
> $ LD_PRELOAD=/usr/lib/libpthread.so ssh \
> -I /usr/local/lib/pkcs11/opensc-pkcs11.so gw
> 
> > > > ~$ pkcs11-tool -I
> > > > error: Failed to load pkcs11 module
> > > > Aborting.
> 
> Same problem, and the LD_PRELOAD hack should work too, though in this
> case it would probably be better if pkcs11-tool (and any of the other
> binaries provided by that package) were linked with -lpthread.
> 
> > On 10:39 Sun 03 Feb , Douglas Santos wrote:
> > > I'm not actively maintaining this port anymore. You can try to ask on
> > > ports@openbsd
> 
> I have dropped the MAINTAINER entry from the port.
> 

-- 
sergeyb@



Re: opensc-pkcs11.so

2013-02-03 Thread Stuart Henderson
On 2013/02/03 17:57, Sergey Bronnikov wrote:
> Hi, everyone
> 
> may be someone knows why attempt to load that module failed:
> 
> ~$ ssh -I /usr/local/lib/pkcs11/opensc-pkcs11.so gw
> dlopen /usr/local/lib/pkcs11/opensc-pkcs11.so failed: Cannot load specified 
> object

ssh isn't linked with libpthread, so the symbols required by
opensc-pkcs11.so aren't available.

The issue is that various weak-aliased functions in libc are overridden
by functions in libpthread. If a shared library/module requires libpthread
functions, it can only be dlopen()'d at runtime if libpthread was preloaded
or was specifically linked to the executable.

The normal library dependency resolution has been specifically blocked
for libpthread to ensure that the functions get overridden.

Try preloading libpthread like this:

$ LD_PRELOAD=/usr/lib/libpthread.so ssh \
-I /usr/local/lib/pkcs11/opensc-pkcs11.so gw

> > > ~$ pkcs11-tool -I
> > > error: Failed to load pkcs11 module
> > > Aborting.

Same problem, and the LD_PRELOAD hack should work too, though in this
case it would probably be better if pkcs11-tool (and any of the other
binaries provided by that package) were linked with -lpthread.

> On 10:39 Sun 03 Feb , Douglas Santos wrote:
> > I'm not actively maintaining this port anymore. You can try to ask on
> > ports@openbsd

I have dropped the MAINTAINER entry from the port.



Re: opensc-pkcs11.so

2013-02-03 Thread Sergey Bronnikov
Hi, everyone

may be someone knows why attempt to load that module failed:

~$ ssh -I /usr/local/lib/pkcs11/opensc-pkcs11.so gw
dlopen /usr/local/lib/pkcs11/opensc-pkcs11.so failed: Cannot load specified 
object

On 10:39 Sun 03 Feb , Douglas Santos wrote:
> Hi there,
> sorry for the late.
> I'm not actively maintaining this port anymore. You can try to ask on
> ports@openbsd
> 
> On Mon, Jan 28, 2013 at 5:05 AM, Sergey Bronnikov  wrote:
> >
> > Hi, Douglas.
> >
> >
> > Did you test ssh client with retrive SSH keys from token?
> >
> > ~$ ssh -I /usr/local/lib/pkcs11/opensc-pkcs11.so gw
> > dlopen /usr/local/lib/pkcs11/opensc-pkcs11.so failed: Cannot load specified 
> > object
> >
> > ~$ pkcs11-tool -I
> > error: Failed to load pkcs11 module
> > Aborting.
> >
> > while opensc successfully detects my token:
> >
> > /usr/ports$ opensc-tool -n
> > Using reader with a card: Rutoken S driver
> > Rutoken S card
> > /usr/ports$ opensc-tool -a
> > Using reader with a card: Rutoken S driver
> > ...
> >
> > I use latest OpenBSD snapshot, amd64.
> >
> > --
> > sergeyb@

-- 
sergeyb@