aboutsummaryrefslogtreecommitdiffstats
path: root/scd (unfollow)
Commit message (Collapse)AuthorFilesLines
2012-06-25scd: handle reader/token removal.NIIBE Yutaka1-0/+1
* scd/apdu.c (pcsc_error_to_sw): PCSC_E_UNKNOWN_READER means SW_HOST_NO_READER.
2012-06-05Change all quotes in strings and comments to the new GNU standard.Werner Koch11-41/+39
The asymmetric quotes used by GNU in the past (`...') don't render nicely on modern systems. We now use two \x27 characters ('...'). The proper solution would be to use the correct Unicode symmetric quotes here. However this has the disadvantage that the system requires Unicode support. We don't want that today. If Unicode is available a generated po file can be used to output proper quotes. A simple sed script like the one used for en@quote is sufficient to change them. The changes have been done by applying sed -i "s/\`\([^'\`]*\)'/'\1'/g" to most files and fixing obvious problems by hand. The msgid strings in the po files were fixed with a similar command.
2012-04-10Fix killing PID -1.Ben Kibbey1-6/+12
When the KILLSCD command had been sent a race condition would occur causing PID -1 getting killed, which on Linux seems to terminate all applications for the current user.
2012-03-27Print warning for arguments not considered an option.Werner Koch1-0/+9
GnuPG requires that options are given before other arguments. This can sometimes be confusing. We now print a warning if we found an argument looking alike a long option without being preceded by the stop option. This is bug#1343. * common/argparse.h (ARGPARSE_FLAG_STOP_SEEN): New. * common/argparse.c (arg_parse): Set new flag. * g10/gpg.c (main): Print the warning. * agent/gpg-agent.c (main): Ditto. * dirmngr/dirmngr.c (main): Ditto. * g13/g13.c (main): Ditto. * scd/scdaemon.c (main): Ditto. * sm/gpgsm.c (main): Ditto. * tools/gpg-connect-agent.c (main): Ditto. * tools/gpgconf.c (main): Ditto.
2012-02-07Use new status printing functions.Werner Koch1-22/+16
* agent/command.c (cmd_geteventcounter): Get rid of static buffers. * scd/command.c (cmd_serialno, cmd_learn): Simplify by using print_assuan_status.
2012-02-06common: Add a global variable to for the default error source.Werner Koch1-0/+2
For the shared code parts it is cumbersome to pass an error sourse variable to each function. Its value is always a constant for a given binary and thus a global variable makes things a lot easier than the former macro stuff. * common/init.c (default_errsource): New global var. (init_common_subsystems): Rename to _init_common_subsystems. Set DEFAULT_ERRSOURCE. * common/init.h: Assert value of GPG_ERR_SOURCE_DEFAULT. (init_common_subsystems): New macro. * common/util.h (default_errsource): Add declaration. * kbx/keybox-defs.h: Add some GPG_ERR_SOURCE_DEFAULT trickery.
2012-01-25Port Windows code to NPTH.Marcus Brinkmann1-5/+5
* agent/gpg-agent.c (get_agent_ssh_socket_name): Use INVALID_HANDLE_VALUE instead of 0. (handle_signal) [!HAVE_W32_SYSTEM]: Don't define. (handle_connections): Port Windows code to NPTH. * dirmngr/dirmngr.c (handle_connections): Port Windows code to NPTH. * g13/g13.c (handle_connections): Port Windows code to NPTH. * scd/scdaemon.c (handle_connections): Port Windows code to NPTH.
2012-01-25Port to npth.Marcus Brinkmann6-220/+180
* configure.ac: Don't check for PTH but for NPTH. (AH_BOTTOM): Remove PTH_SYSCALL_SOFT. (have_pth): Rename to ... (have_npth): ... this. (USE_GNU_NPTH): Rename to ... (USE_GNU_PTH): ... this. * m4/npth.m4: New file. * agent/Makefile.am, agent/cache.c, agent/call-pinentry.c, agent/call-scd.c, agent/findkey.c, agent/gpg-agent.c, agent/trustlist.c, common/Makefile.am, common/estream.c, common/exechelp-posix.c, common/exechelp-w32.c, common/exechelp-w32ce.c, common/http.c, common/init.c, common/sysutils.c, dirmngr/Makefile.am, dirmngr/crlfetch.c, dirmngr/dirmngr.c, dirmngr/dirmngr_ldap.c, dirmngr/ldap-wrapper-ce.c, dirmngr/ldap-wrapper.c, dirmngr/ldap.c, g13/Makefile.am, g13/call-gpg.c, g13/g13.c, g13/runner.c, scd/Makefile.am, scd/apdu.c, scd/app.c, scd/ccid-driver.c, scd/command.c, scd/scdaemon.c, tools/Makefile.am: Port to npth.
2012-01-06Merge ccid_driver_improvement branch.NIIBE Yutaka2-30/+108
* scd/apdu.c (ccid_keypad_operation): Rename from ccid_keypad_verify. (open_ccid_reader): Use ccid_keypad_operation for verify and modify. * scd/ccid-driver.c (VENDOR_VASCO, VASCO_920): New. (ccid_transceive_apdu_level): Permit sending packet where apdulen <= 289. Support receiving packets in a chain. (ccid_transceive_secure): Maximum is 15 for VASCO DIGIPASS 920. Support keypad_modify method such as CHANGE_REFERENCE_DATA: 0x24.
2012-01-03Fix compiler warnings.Marcus Brinkmann1-0/+2
* common/dotlock.c (use_hardlinks_p, dotlock_take_unix): Check return value of link(). * g13/g13.c: Make sure err is initialized. * scd/scdaemon.c (main) [!USE_GCRY_THREAD_CBS]: Do not define ERR.
2012-01-03Terminate csh commands with a semicolon.Werner Koch1-1/+1
Fixes bug#1386. * agent/gpg-agent.c (main): Terminate csh style output with a semicolon. * scd/scdaemon.c: Ditto.
2012-01-02Only set gcrypt thread callback for older version of gcrypt.Marcus Brinkmann1-1/+9
* agent/gpg-agent.c, dirmngr/dirmngr.c, g13/g13.c, scd/scdaemon.c (USE_GCRY_THREAD_CBS): New macro, defined if GCRY_THREAD_OPTION_VERSION is 0. (fixed_gcry_pth_init) [!USE_GCRY_THREAD_CBS]: Don't define. (main) [!USE_GCRY_THREAD_CBS]: Do not install thread callbacks.
2011-12-20Require Libassuan 2.0.3Werner Koch1-7/+0
* configure.ac: Require Libassuan 2.0.3. * agent/call-scd.c (ASSUAN_CONVEY_COMMENTS): Remove macro replacement. * agent/command.c (cmd_killagent) [ASSUAN_FORCE_CLOSE]: Remove dependency. (cmd_killagent) [ASSUAN_FORCE_CLOSE]: Ditto. * scd/command.c (cmd_killscd) [ASSUAN_FORCE_CLOSE]: Ditto.
2011-12-20Add error log and debug log for pcsc_keypad_verify and pcsc_keypad_modify.NIIBE Yutaka1-4/+22
* scd/apdu.c (pcsc_keypad_verify): Add debug log and error log. (pcsc_keypad_modify): Likewise.
2011-12-19scd: Fix for card change returning GPG_ERR_CARD_RESET.Werner Koch1-2/+1
* scd/apdu.c (apdu_connect): Do not test for zero atrlen. -- When gpg-agent prompts for insertion of a card this error would be returned. Co-authored-by: Ben Kibbey <[email protected]>
2011-12-15scd: Prefer application Geldkarte over DINSIG.Werner Koch1-3/+3
* scd/app.c (select_application): Reorder application tests. -- Although the DINSIG application is available on most German cards, it is in reality not used. Thus showing the Geldkarte application is more desirable for a good user experience.
2011-12-15scd: Add option --dump-atr to command APDU.Werner Koch4-184/+107
* scd/atr.c: Rewrite. * scd/Makefile.am (scdaemon_SOURCES): Add atr.c and atr.h. * scd/command.c (cmd_apdu): Add option --dump-atr.
2011-12-14scd: Skip S/N reading for the "undefined" application.Werner Koch1-45/+52
* scd/app.c (select_application): Skip serial number reading.
2011-12-14scd: Add more status word values for documentation.Werner Koch2-2/+8
2011-12-14scd: Add the "undefined" stub application.Werner Koch1-0/+10
* scd/app.c (select_application): Implement the "undefined" application.
2011-12-14scd: Fix resetting and closing of the reader.Werner Koch1-24/+33
* scd/command.c (update_card_removed): Do no act on an invalid VRDR. (do_reset): Ignore apdu_reset error codes for no and inactive card. Close the reader before setting the slot to -1. (update_reader_status_file): Notify the application before closing the reader. -- With this change the scd now works as it did in the past. In particular there is no more endless loop trying to open the reader by the update_reader_status_file ticker function. That bug basically blocked all card operations until the scdaemon was killed.
2011-12-14scd: Add debug option for reader function calls.Werner Koch3-67/+143
* scd/scdaemon.h (DBG_READER_VALUE, DBG_READER): New. * scd/apdu.c (apdu_open_reader, apdu_close_reader) (apdu_shutdown_reader, apdu_connect, apdu_disconnect) (apdu_reset, apdu_get_atr, apdu_get_status): Add debug code. (apdu_activate): Remove this unused function.
2011-12-13scd: New option --debug-assuan-log-cats.Werner Koch1-0/+5
* scd/scdaemon.c (oDebugAssuanLogCats): New. (opts): Add option --debug-assuan-log-cats. (main): Implement option. * common/asshelp.c (set_libassuan_log_cats): New. -- The old way of setting the logging categories with an environment variable is awkward if sdaemon is spawned from a running gpg-agent.
2011-12-13scd: Introduce a virtual reader table.Werner Koch5-99/+129
The vreader table makes the code more clear by explicitly talking about APDU slots and reader indices. It also accommodates for future extensions. * scd/scdaemon.h (server_control_s): Remove READER_SLOT. * scd/scdaemon.c (scd_init_default_ctrl): Do not init READER_SLOT. * scd/app.c (check_application_conflict): Add arg SLOT. * scd/command.c (slot_status_s): Rename to vreader_s. (server_local_s): Add field VREADER_IDX as replacement for the READER_SLOT in server_control_s. Change all users. (slot_table): Rename to vreader_table. Change all users. (vreader_slot): New. (do_reset, cmd_apdu): Map vreader to apdu slot. (get_reader_slot): Rename to get_current_reader. Return -1 on error. (open_card): Map vreader toapdu slot. Pass slot to check_application_conflict. (scd_command_handler): Init VREADER_IDX. (update_reader_status_file): Reset SLOT field on error.
2011-12-12scd: Retry command SERIALNO for an inactive card.Werner Koch1-1/+8
* scd/command.c (cmd_serialno): Retry once for an inactive card.
2011-12-12Fix detection of card removal and insertion.Werner Koch2-5/+18
* scd/apdu.c (apdu_connect): Return status codes for no card available and inactive card. * scd/command.c (TEST_CARD_REMOVAL): Also test for GPG_ERR_CARD_RESET. (open_card): Map apdu_connect status to GPG_ERR_CARD_RESET.
2011-12-02Support the Cherry ST-2000 card reader.Werner Koch1-10/+24
* scd/ccid-driver.c (SCM_SCR331, SCM_SCR331DI, SCM_SCR335) (SCM_SCR3320, SCM_SPR532, CHERRY_ST2000): New constants. (parse_ccid_descriptor): Use them. (scan_or_find_usb_device, ccid_transceive_secure): Handle Cherry ST-2000. Suggested by Matthias-Christian Ott.
2011-12-02Fix pinpad input support for passphrase modification.NIIBE Yutaka4-194/+89
* apdu.c (pcsc_keypad_verify): Have dummy Lc field with value 0. (pcsc_keypad_modify): Likewise. (pcsc_keypad_modify): It's only for ISO7816_CHANGE_REFERENCE_DATA. bConfirmPIN value is determined by the parameter p0. * app-openpgp.c (do_change_pin): The flag use_keypad should be 0 when reset_mode is on, or resetcode is on. use_keypad only makes sense for iso7816_change_reference_data_kp. * iso7816.h (iso7816_put_data_kp): Remove. (iso7816_reset_retry_counter_kp): Remove. (iso7816_reset_retry_counter_with_rc_kp): Remove. (iso7816_change_reference_data_kp): Add an argument: IS_EXCHANGE. * iso7816.c (iso7816_put_data_kp): Remove. (iso7816_reset_retry_counter_kp): Remove. (iso7816_reset_retry_counter_with_rc_kp): Remove. (iso7816_change_reference_data_kp): Add an argument: IS_EXCHANGE.
2011-12-01Generate the ChangeLog from commit logs.Werner Koch2-1/+14
* scripts/gitlog-to-changelog: New script. Taken from gnulib. * scripts/git-log-fix: New file. * scripts/git-log-footer: New file. * doc/HACKING: Describe the ChangeLog policy * ChangeLog: New file. * Makefile.am (EXTRA_DIST): Add new files. (gen-ChangeLog): New. (dist-hook): Run gen-ChangeLog. Rename all ChangeLog files to ChangeLog-2011.
2011-12-01Fix pinpad input supportNIIBE Yutaka2-17/+56
2011-11-29PC/SC pinpad support (pinpad input for modify pass phrase with resetcode, by ↵NIIBE Yutaka6-73/+139
admin).
2011-11-29PC/SC pinpad support (pinpad input for modify pass phrase).NIIBE Yutaka6-51/+196
2011-11-28PC/SC pinpad support.NIIBE Yutaka9-25/+460
Before this change, it is layered like following: iso7816_verify iso7816_verify_kp apdu_send_simple, apdu_send_simple_kp ... After this change, it will be layered like: iso7816_verify iso7816_verify_kp apdu_send_simple apdu_keypad_verify ... and apdu_send_simple_kp will be deprecated. For PC/SC API, we use: SCardControl API to compose CCID PC_to_RDR_Secure message SCardTransmit API to compose CCID PC_to_RDR_XfrBlock message Considering the support of PC/SC, we have nothing to share between _kp version of iso7816_* and no _kp version.
2011-08-10Fixed set but unused variable bugsWerner Koch3-6/+3
2011-08-10Made the KILLAGENT and KILLSCD commands working again.Werner Koch2-0/+13
This requires that GnuPG is build with a newer version of Libassuan (2.0.3).
2011-08-08Adjust for signed integer passed to OpenPGP card decrypt.Werner Koch2-8/+26
2011-06-16Allow generation of card keys up to 4096 bit.Werner Koch3-9/+30
This patch implementes a chunk mode to pass the key parameters from scdaemon to gpg. This allows to pass arbitrary long key paremeters; it is used for keys larger than 3072 bit. Note: the card key generation in gpg is currently broken. The keys are generated but it is not possible to create the self-signature because at that time the gpg-agent does not yet know about the new keys and thus can't divert the sign request to the card. We either need to run the learn command right after calling agent_scd_genkey or implement a way to sign using the currently inserted card. Another option would be to get rid of agent_scd_genkey and implement the feature directly in agent_genkey.
2011-03-02fix wLangId in ccid-driver.cNIIBE Yutaka1-2/+2
This is not a part of pin pad support series of mine. As I found the bug while I am preparing the patches, I report this. As CCID protocol is little endian, wLangId of US English = 0x0409 is represented as two bytes of 0x09 then 0x04. It is really confusing that the code like following is floating around: pin_verify -> wLangId = HOST_TO_CCID_16(0x0904); But, it is 0x0409 (not 0x0904). It is defined in the documentation: http://www.usb.org/developers/docs/USB_LANGIDs.pdf and origin of this table is Microsoft. We can see it at: http://msdn.microsoft.com/en-us/library/bb165625%28VS.80%29.aspx Yes, it would be better not to hard-code 0x0409. It would be better to try current locale of the user, or to use the first entry of string descriptor. I don't have time to implement such a thing...
2011-02-23Lock scdaemon to CCID if once found.Werner Koch2-2/+20
This solves a problem where ccid was used, the card unplugged and then scdaemon tries to find a new (plugged in) reader and thus will eventually try PC/SC over and over again. Also added an explicit --kill command to gpgconf.
2011-02-04Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch26-1014/+990
We better do this once and for all instead of cluttering all future commits with diffs of trailing white spaces. In the majority of cases blank or single lines are affected and thus this change won't disturb a git blame too much. For future commits the pre-commit scripts checks that this won't happen again.
2011-01-25Fixed problem with unplugging card readers.Werner Koch2-1/+18
From Grant Olsons's mail to gnupg-devel@: This is three-quarters NIIBE and one-quarter me, but I though it would be easier to have a single complete patch that applies to STABLE-BRANCH-2-0 than two patches floating around. This is basically NIIBE Yatuka's patch here: http://lists.gnupg.org/pipermail/gnupg-devel/2010-November/025828.html Plus another check that closes down the reader explicitly if we get a SW_HOST_NO_READER error, so that an unplugged reader doesn't hold onto the first slot, preventing us from getting to the active plugged reader.
2011-01-25Detect non operational readers.Werner Koch5-10/+52
Backport from 2.0.
2011-01-05Support the gnuk token pinpad code.Werner Koch2-1/+7
2010-11-17Smartcard related updatesWerner Koch2-9/+31
2010-10-27Honor TMPDIR.Werner Koch2-3/+15
2010-10-18Fix a signing problem with the cardWerner Koch2-1/+6
2010-10-01Exporting secret keys via gpg-agent is now basically supported.Werner Koch1-6/+7
A couple of forward ported changes. Doc updates.
2010-08-18Fix regression in logging.Werner Koch2-23/+27
Add a registry key to enable catch-all remote debugging for W32. Replace more stdio stuff by estream.
2010-06-09Merged Dirmngr with GnuPG.Werner Koch2-5/+11
A few code changes to support dirmngr.
2010-03-22More chnages to use estream. Add a way to replace the standardWerner Koch1-1/+1
descriptors.