GnuPG with scdaemon_shared-access patch applied
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

77 lines
2.6 KiB

  1. # Patch from GPGTools/MacGPG2 repo
  2. # https://github.com/GPGTools/MacGPG2/blob/dev/patches/gnupg/scdaemon_shared-access.patch
  3. # Add the option "shared-access" to scdaemon.
  4. # If set, pcsc_connect is called with PCSC_SHARE_SHARED instead of PCSC_SHARE_EXCLUSIVE.
  5. --- a/scd/apdu.c
  6. +++ b/scd/apdu.c
  7. @@ -816,7 +816,7 @@ connect_pcsc_card (int slot)
  8. err = pcsc_connect (reader_table[slot].pcsc.context,
  9. reader_table[slot].rdrname,
  10. - PCSC_SHARE_EXCLUSIVE,
  11. + opt.shared_access ? PCSC_SHARE_SHARED : PCSC_SHARE_EXCLUSIVE,
  12. PCSC_PROTOCOL_T0|PCSC_PROTOCOL_T1,
  13. &reader_table[slot].pcsc.card,
  14. &reader_table[slot].pcsc.protocol);
  15. --- a/scd/scdaemon.c
  16. +++ b/scd/scdaemon.c
  17. @@ -99,6 +99,7 @@ enum cmd_and_opt_values
  18. oDenyAdmin,
  19. oDisableApplication,
  20. oEnablePinpadVarlen,
  21. + oSharedAccess,
  22. oListenBacklog,
  23. oNoop
  24. @@ -164,6 +165,8 @@ static ARGPARSE_OPTS opts[] = {
  25. /* Stubs for options which are implemented by 2.3 or later. */
  26. ARGPARSE_s_s (oNoop, "application-priority", "@"),
  27. + ARGPARSE_s_n (oSharedAccess, "shared-access", N_("use PCSC_SHARE_SHARED for pcsc_connect")),
  28. +
  29. ARGPARSE_end ()
  30. };
  31. @@ -629,6 +632,8 @@ main (int argc, char **argv )
  32. case oNoop: break;
  33. + case oSharedAccess: opt.shared_access = 1; break;
  34. +
  35. default:
  36. pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR;
  37. break;
  38. @@ -727,6 +732,7 @@ main (int argc, char **argv )
  39. es_printf ("disable-pinpad:%lu:\n", GC_OPT_FLAG_NONE );
  40. es_printf ("card-timeout:%lu:%d:\n", GC_OPT_FLAG_DEFAULT, 0);
  41. es_printf ("enable-pinpad-varlen:%lu:\n", GC_OPT_FLAG_NONE );
  42. + es_printf ("shared-access:%lu:\n", GC_OPT_FLAG_NONE );
  43. scd_exit (0);
  44. }
  45. --- a/scd/scdaemon.h
  46. +++ b/scd/scdaemon.h
  47. @@ -62,6 +62,8 @@ struct
  48. strlist_t disabled_applications; /* Card applications we do not
  49. want to use. */
  50. unsigned long card_timeout; /* Disconnect after N seconds of inactivity. */
  51. +
  52. + int shared_access;
  53. } opt;
  54. --- a/tools/gpgconf-comp.c
  55. +++ b/tools/gpgconf-comp.c
  56. @@ -653,6 +653,9 @@ static gc_option_t gc_options_scdaemon[] =
  57. { "card-timeout", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
  58. "gnupg", "|N|disconnect the card after N seconds of inactivity",
  59. GC_ARG_TYPE_UINT32, GC_BACKEND_SCDAEMON },
  60. + { "shared-access", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
  61. + "gnupg", "use PCSC_SHARE_SHARED for pcsc_connect",
  62. + GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
  63. { "Debug",
  64. GC_OPT_FLAG_GROUP, GC_LEVEL_ADVANCED,