Hello,

Thank you for your report.

Mario Hoberg wrote:
> On macOS, scdaemon resolves SCardControl with dlsym() but calls it
> through a seven-argument function pointer. Apple’s PC/SC framework
> exports SCardControl as the legacy five-argument function; its
> seven-argument function is named SCardControl132.

I have looked around PC/SC-lite and OpenSC, and this is a kind of old
problem.  It seems that pinpad feature is not used on macOS.

I think that it is better to follow what OpenSC does; Try to find the
function by the symbol "ScardControl132" and then the symbol
"ScardControl" if "ScardControl132" fails.  If Apple will change to
follow new API, it will still work.

Attached is a patch candidate:
-- 
>From cccc068c1ac00855b75541197126d1f0fab39907 Mon Sep 17 00:00:00 2001
Message-ID: <cccc068c1ac00855b75541197126d1f0fab39907.1790236595.git.gni...@fsij.org>
From: NIIBE Yutaka <[email protected]>
Date: Thu, 24 Sep 2026 16:54:05 +0900
Subject: [PATCH] scd: Fix pinpad handling for macOS.
To: [email protected]
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.47.3"

This is a multi-part message in MIME format.
--------------2.47.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


* scd/apdu.c (pcsc_init): Try SCardControl123 firstly.

--

Co-authored-by: Mario Hoberg
Signed-off-by: NIIBE Yutaka <[email protected]>
---
 scd/apdu.c | 6 ++++++
 1 file changed, 6 insertions(+)


--------------2.47.3
Content-Type: text/x-patch; name="0001-scd-Fix-pinpad-handling-for-macOS.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-scd-Fix-pinpad-handling-for-macOS.patch"

diff --git a/scd/apdu.c b/scd/apdu.c
index 6b874ef29..d899d1126 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -1182,6 +1182,12 @@ pcsc_init (void)
       pcsc_end_transaction   = dlsym (handle, "SCardEndTransaction");
       pcsc_transmit          = dlsym (handle, "SCardTransmit");
       pcsc_set_timeout       = dlsym (handle, "SCardSetTimeout");
+#ifdef __APPLE__
+      /* Apple keeps old name, gives a different name for new API.  */
+      pcsc_control           = dlsym (handle, "SCardControl123");
+      /* If it's not available, try "SCardControl" */
+      if (!pcsc_control)
+#endif
       pcsc_control           = dlsym (handle, "SCardControl");
 
       if (!pcsc_establish_context

--------------2.47.3--


_______________________________________________
Gnupg-users mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to