aboutsummaryrefslogtreecommitdiffstats
path: root/scd/apdu.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2021-03-12 08:21:57 +0000
committerWerner Koch <[email protected]>2021-03-12 08:31:17 +0000
commit5732e7a8e97cebf8e850c472e644e2a9b040836f (patch)
tree06987165f537056be9983c912bda613cc7a5f5b5 /scd/apdu.c
parentscd: Fix computing fingerprint for ECC with SOS. (diff)
downloadgnupg-5732e7a8e97cebf8e850c472e644e2a9b040836f.tar.gz
gnupg-5732e7a8e97cebf8e850c472e644e2a9b040836f.zip
scd: New option --pcsc-shared.
* scd/scdaemon.h (opt): Add field opcsc_shared. * scd/scdaemon.c (opcscShared): New. (opts): Add "--pcsc-shared". (main): Set flag. * scd/apdu.c (connect_pcsc_card): Use it. (pcsc_get_status): Take flag in account. * scd/app-openpgp.c (cache_pin): Bypass in shared mode. (verify_chv2: Do not auto verify chv1 in shared mode. * scd/app-piv.c (cache_pin): By pass caceh in shared mode. -- This option should in general not be used. The patch tries to limit bad effects but using shared mode is somewhat dangerous depending on the other PC/SC users.
Diffstat (limited to 'scd/apdu.c')
-rw-r--r--scd/apdu.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/scd/apdu.c b/scd/apdu.c
index 68ad733cb..1ca63e41f 100644
--- a/scd/apdu.c
+++ b/scd/apdu.c
@@ -732,7 +732,8 @@ pcsc_get_status (int slot, unsigned int *status, int on_wire)
mode. */
if ( (*status & (APDU_CARD_PRESENT|APDU_CARD_ACTIVE))
== (APDU_CARD_PRESENT|APDU_CARD_ACTIVE)
- && !(reader_table[slot].pcsc.current_state & PCSC_STATE_INUSE) )
+ && (opt.pcsc_shared
+ || !(reader_table[slot].pcsc.current_state & PCSC_STATE_INUSE)))
*status |= APDU_CARD_USABLE;
#else
/* Some winscard drivers may set EXCLUSIVE and INUSE at the same
@@ -856,7 +857,7 @@ connect_pcsc_card (int slot)
err = pcsc_connect (pcsc.context,
reader_table[slot].rdrname,
- PCSC_SHARE_EXCLUSIVE,
+ opt.pcsc_shared? PCSC_SHARE_SHARED:PCSC_SHARE_EXCLUSIVE,
PCSC_PROTOCOL_T0|PCSC_PROTOCOL_T1,
&reader_table[slot].pcsc.card,
&reader_table[slot].pcsc.protocol);