Page MenuHome GnuPG

Failure to load PC/SC library on Mac OS (easy fix as of OS X 10.4)
Closed, ResolvedPublic

Description

Release: 1.4.2

Environment

Mac OS X 10.4.2

Description

GnuPG can't use the smart card drivers supported on Mac OS X because in g10/g10.c the name of the dynamic library for all non-W32 systems is "libpcsclite.so". The PC/SC dynamic library that Apple ships with Mac OS X
is named "/System/Library/Frameworks/PCSC.framework/PCSC".

Fix

In g10/g10.c immediately below

opt.pcsc_driver = "winscard.dll";

add the two lines

#elif defined(APPLE)

	opt.pcsc_driver = "/System/Library/Frameworks/PCSC.framework/PCSC";

Pass "APPLE=1" to ./configure and rebuild GnuPG.

With the patch I was able to use gnupg --card-status to read an OpenPGP card using an Athena AESIIIe USB smart card reader (driver bundled with Mac OS X) and a SCM SCR243 PCMCIA smart card reader (OS X driver available from SCM).

This works for Mac OS X 10.4 because Apple supports "native" dlopen() in that version. With a another switch to ./configure it might work for Mac OS X 10.3, which shipped with dlopen() as part of the dlcompat library, but I haven't tried this.

Warning: I could not get Apple's own CCID driver, CCIDClassDriver.bundle, to work properly with the SCM SCR335 reader. The work-around for SCR335 owners is to move Apple's driver out of /usr/libexec/SmartCardServices/drivers/ to prevent PCSC from invoking this driver. Then GnuPG immediately defaults to its built-in CCID support, which works fine on Mac OS X.

Event Timeline

Done, thanks for the suggestion.
I also added better support for linking to libusb so people
can use the SCR335 readers (like me).
SCM does claim seem to have a 335 OS X driver, but I haven't
had any success using it.