[Gpg4win-devel] GnuPG with internal CCID driver

Jiri Kerestes jiri.kerestes at trustica.cz
Wed Jul 25 15:38:29 CEST 2018


Hello,

On 25.7.2018 12:26, Werner Koch wrote:

> I cc Gniibe because he is the maintainer of scdaemon and does all card
> stuff these days.  Even that you write about Windows, this is not
> specific for Gpg4win because Gpg4win uses the standard GnuPG build for
> Windows under the hood.  So gnupg-devel would be more appropriate - but
> this list is also okay as long as we keep Gniibe in the loop.

cc'ing gnupg-devel ML.

>> I've done some hackery and I have a working w32 GnuPG build with libusb
>> support. I'm not very familiar with Gpg4win development history, so
>> before I dive into autotools to do this properly: is there any reason
>> why Gpg4Win shouldn't be shipped with libusb and internal CCID driver?
> 
> Can you give some more background on this libusb?  I would be interested
> to support it also on Windows.

I just modified configure.ac to use precompiled libusb libraries from
SourceForge and included libusb-1.0.dll in
build-aux/speedo/w32/inst.nsi. I've included example diff below, but it
needs to be done properly (e.g. without hardcoded paths).

Windows system setup is described on libusb GitHub wiki [1]. If the USB
reader supports WCID [2], then it should work out-of-the-box. I tested
this on Windows 10 64-bit with our token. It works either with WinUSB
driver installed by Zadig tool, or with automatic WCID WinUSB driver
install.

[1]:
https://github.com/libusb/libusb/wiki/Windows#How_to_use_libusb_on_Windows

[2]: https://github.com/pbatard/libwdi/wiki/WCID-Devices


diff --git a/build-aux/speedo/w32/inst.nsi b/build-aux/speedo/w32/inst.nsi
index
fb452d513014088b12a946a76731c123dbbc3c11..ca38498b2550a14aa294b274b2840e31f429377b
100644
--- a/build-aux/speedo/w32/inst.nsi
+++ b/build-aux/speedo/w32/inst.nsi
@@ -628,6 +628,7 @@ Section "GnuPG" SEC_gnupg
   File "libexec/dirmngr_ldap.exe"
   File "libexec/gpg-preset-passphrase.exe"
   File "libexec/gpg-wks-client.exe"
+  File "/home/nephirus/MinGW32/dll/libusb-1.0.dll"

   ClearErrors
   SetOverwrite try


diff --git a/configure.ac b/configure.ac
index
f77317f369ab247d64dce564197cbfbf943cf473..c89a7cbb3556c669bc5693503a49b4a1190bce9f
100644
--- a/configure.ac
+++ b/configure.ac
@@ -806,7 +806,7 @@
AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
 if test "$use_ccid_driver" = auto || test "$use_ccid_driver" = yes; then
    case "${host}" in
      *-mingw32*)
-       LIBUSB_NAME=
+       LIBUSB_NAME=usb-1.0.dll
        LIBUSB_LIBS=
        LIBUSB_CPPFLAGS=
        ;;
@@ -826,6 +826,8 @@ if test "$use_ccid_driver" = auto || test
"$use_ccid_driver" = yes; then
    esac
 fi
 if test x"$LIBUSB_NAME" != x ; then
+   CPPFLAGS="${CPPFLAGS} -I/home/nephirus/include/libusb-1.0"
+   LDFLAGS="${LDFLAGS} -L/home/nephirus/MinGW32/dll"
    AC_CHECK_LIB($LIBUSB_NAME, libusb_init,
                 [ LIBUSB_LIBS="-l$LIBUSB_NAME $LIBUSB_LIBS"
                   have_libusb=yes ])


Best regards

Jiri

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <https://lists.gnupg.org/pipermail/gnupg-devel/attachments/20180725/f49df4a4/attachment-0001.sig>


More information about the Gnupg-devel mailing list