aboutsummaryrefslogtreecommitdiffstats
path: root/scd/ccid-driver.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* scd: Fix for inactive card at start by internal CCID driver.NIIBE Yutaka2017-12-271-2/+15
| | | | | | | | | | | | | | * scd/ccid-driver.c (do_close_reader): Set NULL on close. (bulk_in): Move DEBUGOUT and check by EP_INTR. (ccid_get_atr): Clear powered_off flag after initial status check. -- Many card readers automatically turn on inserted card, but some defaults to turning off at start. GnuPG-bug-id: 3508 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Enable card removal check after select_application.NIIBE Yutaka2017-11-211-4/+6
| | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (open_ccid_reader): Fix error handling of ccid_get_atr. * scd/app.c (select_application): Always kick the loop if new APP. * scd/ccid-driver.c (ccid_open_usb_reader): Don't setup at open. (ccid_slot_status): Setup interrupt transfer when !ON_WIRE. -- We can use the interrupt transfer to be notified about card status change. In this case, we don't need to issue PC_to_RDR_GetSlotStatus command. This change improve the setup the notification; it should be done after registration of APP. When the setup is done just after opening the USB connection (before issuing PC_to_RDR_IccPowerOn), a reader might notifies about no card availability (because of not yet powered on), even though the card is ready to be powered on. GnuPG-bug-id: 3508 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix SEGV in CCID driver.NIIBE Yutaka2017-07-211-4/+7
| | | | | | | * scd/ccid-driver.c (intr_cb): Only kick the loop for removal. (bulk_in): Don't set POWERED_OFF when interrupt transfer is enabled. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix error code on failure at usb_init.NIIBE Yutaka2017-05-311-1/+1
| | | | | | * scd/ccid-driver.c (ccid_dev_scan): Return GPG_ERR_ENODEV. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Handle a failure of libusb_init.NIIBE Yutaka2017-05-311-4/+15
| | | | | | | | | | * scd/ccid-driver.c (ccid_get_reader_list, ccid_dev_scan): Handle failure. -- Reported-by: Yuriy M. Kaminskiy <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Handle unexpected suspend/resume by CCID driver.NIIBE Yutaka2017-04-121-4/+16
| | | | | | | | | * scd/ccid-driver.c (bulk_in): Handle unexpected failure. -- GnuPG-bug-id: 3083 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Remove "special transport" support.NIIBE Yutaka2017-04-101-292/+64
| | | | | | | | | | * scd/ccid-driver.c (transports, my_sleep, prepare_special_transport) (writen): Remove. (ccid_dev_scan, ccid_dev_scan_finish, ccid_get_BAI): Only for USB. (ccid_open_reader, do_close_reader, bulk_out, bulk_in, abort_cmd) (ccid_poll, ccid_transceive): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Internal CCID reader cleanup.NIIBE Yutaka2017-04-071-269/+41
| | | | | | | | | | | | * scd/ccid-reader.c (scan_usb_device): Only for scan mode, so, rename from scan_or_find_usb_device. (scan_devices): Likewise. Remove support of special transport types. (ccid_get_reader_list): Simplify. (abort_cmd): Fix error return. (send_escape_cmd): Fix for RESULTLEN == NULL. (ccid_transceive_secure): Remove unnecessary var updates. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix timeout handling for key generation.NIIBE Yutaka2017-03-271-5/+13
| | | | | | | | | | | | | | | | * scd/ccid-driver.c (CCID_CMD_TIMEOUT): Back to original value. (CCID_CMD_TIMEOUT_LONGER): New. (ccid_transceive): Add kludge for key generation. -- At key generation of longer key size, OpenPGP card sends back "time extension" with BWI=100, which is unusual value in the protocol and it actually requires host having longer timeout like 43 seconds. Reported-by: Szczepan Zalega <[email protected]> Fixes-commit: 6510df3a7cd2b5bf44fac1e4d50ee54b8c897daa Signed-off-by: NIIBE Yutaka <[email protected]>
* Clean up word replication.Yuri Chornoivan2017-02-211-2/+2
| | | | | | | | | -- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* scd: Fix SERIALNO for multiple devices.NIIBE Yutaka2017-01-311-7/+18
| | | | | | | | | | | | | | * scd/app.c (select_application): Fix the logic if periodical check is needed. If it is needed for newly found device(s), kick the loop. (scd_update_reader_status_file): Return value if select(2) should be called with timeout. * scd/ccid-driver.c (ccid_require_get_status): Don't return 0 for token with no interrupt transfer for now. * scd/command.c (open_card_with_request): Fix scan by SERIALNO. * scd/scdaemon.c (update_usb): Remove. (handle_connections): Evaluate need_tick after handle_tick. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix GetSlotStatus.NIIBE Yutaka2017-01-301-2/+12
| | | | | | | | | | | | | | | * scd/apdu.c (get_status_reader): Add ON_WIRE arg, here. (ct_get_status, pcsc_get_status_direct, pcsc_get_status_wrapped) (pcsc_get_status, get_status_ccid, my_rapdu_get_status): Likewise. (reset_pcsc_reader_wrapped, open_pcsc_reader_wrapped): Follow the change. (apdu_get_status_internal): It's lower-level driver which judge it's not needed. Otherwise, it can't detect the removal. * scd/ccid-driver.c (ccid_slot_status): After the POWERED_OFF check, we can skip sending GetSlotStatus packet on wire, when no need. Signed-off-by: NIIBE Yutaka <[email protected]> Fixes-commit: c8eee4d396a751d41fd1ee1e1b87b851fca172a
* scd: Fix cancel INTERRUPT transfer.NIIBE Yutaka2017-01-291-19/+10
| | | | | | | * scd/ccid-driver.c (do_close_reader): Don't lock events, but check the return value of libusb_cancel_transfer. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: More changes on watching removal of card/reader.NIIBE Yutaka2017-01-271-8/+139
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/app-common.h (struct app_ctx_s): Rename field to periodical_check_needed. * scd/scdaemon.c (update_usb): Rename from update_fdset_for_usb. Don't use libusb_get_pollfds any more. (scd_kick_the_loop): New. (need_tick): Follow the rename. (handle_connections): No libusb event handling here. * scd/app.c (app_new_register): Follow the change of rename. (select_application, scd_update_reader_status_file): Likewise. * scd/ccid-driver.c (ccid_usb_thread_is_alive): New. (intr_cb): Call scd_kick_the_loop. (ccid_usb_thread): New. Thread to invoke INTERRUPT callback. (ccid_open_usb_reader): Add thread invocation. (ccid_require_get_status): Remove LIBUSB_WORKS_EXPECTED_FOR_INTERRUPT_ENDP. (do_close_reader): Carefully handle handle->transfer. (get_escaped_usb_string): Insert npth_unprotect/npth_protect. (do_close_reader, bulk_out, bulk_in, abort_cmd, ccid_slot_status) (ccid_transceive, ccid_transceive_secure): Likewise. -- It found that libusb_get_pollfds is not supported on Windows. Besides, it's a bit difficult to use for the select loop. Thus, we use the thread named ccid_usb_thread, instead. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix release of transfer object.NIIBE Yutaka2017-01-271-17/+28
| | | | | | | | * scd/ccid-driver.c (intr_cb): Handle LIBUSB_TRANSFER_CANCELLED. (do_close_reader): When callback is active, call libusb_cancel_transfer and wait callback is fired off. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Improve watching USB device removal.NIIBE Yutaka2017-01-271-14/+30
| | | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c(struct reader_table_s): Add require_get_status. (apdu_connect): Change return value meaning. Call apdu_reset here. * scd/app.c (app_new_register): Add require_get_status. (select_application): Use the return value of apdu_connect. (scd_update_reader_status_file): Call update_fdset_for_usb with checking all_have_intr_endp. (app_list_start, app_list_finish): Remove. * scd/ccid-driver.c (struct ccid_driver_s): Add transfer. (intr_cb): Don't call libusb_transfer in this callback. (ccid_require_get_status): New. (do_close_reader): Call libusb_transfer here. * scd/scdaemon.c (update_fdset_for_usb): Remove the first argument. -- With Gnuk Token, it works fine as expected. With Gemalto reader, intr_cb is not called when card is removed. So, the macro LIBUSB_WORKS_EXPECTED_FOR_INTERRUPT_ENDP is not defined yet. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Only submit apdu_get_status when needed.NIIBE Yutaka2017-01-261-1/+7
| | | | | | | | | | | | | | | * scd/apdu.c (apdu_dev_list_finish): Return Boolean value if all device support INTERRUPT transfer. * scd/ccid-driver.c (ccid_dev_scan_finish): Likewise. * scd/app.c (app_new_register): Fix initial value of card_status. (select_application): Call update_fdset_for_usb. (scd_update_reader_status_file): Ditto. * scd/scdaemon.c (update_fdset_for_usb, need_tick): New. (handle_connections): Call handle_tick when select returns. Let select watch USB file descriptors, too. Call libusb_handle_events_timeout_completed for INTERRUPT transfer. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Add INTERRUPT endp support to CCID driver.NIIBE Yutaka2017-01-261-4/+69
| | | | | | | | | | * scd/app.c (scd_update_reader_status_file): Fix releas of APP. * scd/ccid-driver.c (struct ccid_driver_s): Add INTR_BUF. (intr_cb, ccid_setup_intr): New. (ccid_open_usb_reader): Call ccid_setup_intr. (ccid_slot_status): Return CCID_DRIVER_ERR_NO_READER when removed. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix INTERRUPT transfer.NIIBE Yutaka2017-01-231-5/+6
| | | | | | | | * scd/ccid-driver.c (find_endpoint): Don't return Bulk endpoint as Interrupt endpoint. (ccid_poll): Call libusb_interrupt_transfer. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Support multiple readers by CCID driver.NIIBE Yutaka2017-01-061-101/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (new_reader_slot): Lock is now in apdu_dev_list_start. (close_pcsc_reader_direct, close_ccid_reader): RDRNAME is handled... (apdu_close_reader): ... by this function now. (apdu_prepare_exit): Likewise. (open_ccid_reader): Open with dev_list. (apdu_dev_list_start, apdu_dev_list_finish): New. (apdu_open_one_reader): New. (apdu_open_reader): Support multiple readers. * scd/app.c (select_application): With SCAN, opening all readers available, and register as new APP. (app_write_learn_status): app->ref_count == 0 is valid for APP which is not yet used. (app_list_start, app_list_finish): New. * scd/ccid-driver.c (struct ccid_driver_s): Remove RID and BCD_DEVICE. Add BAI. (parse_ccid_descriptor): BCD_DEVICE is now on the arguments. (ccid_dev_scan, ccid_dev_scan_finish): New. (ccid_get_BAI, ccid_compare_BAI, ccid_open_usb_reader): New. (ccid_open_reader): Support multiple readers. (ccid_set_progress_cb, ccid_close_reader): No RID any more. -- With this change, multiple readers/tokens are supported by the internal CCID driver of GnuPG. Until the changes of upper layers (scdaemon, gpg-agent, and gpg front end), only a single reader is used, though. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Improve internal CCID driver.NIIBE Yutaka2016-12-291-152/+151
| | | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Don't scan for configuration but use active configuration. Support alt_setting. (scan_or_find_devices): Support alt_setting. (ccid_open_reader): Support alt_setting. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Improve internal CCID driver.NIIBE Yutaka2016-12-271-89/+87
| | | | | | | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Fix return value. Support device with multiple CCID interfaces. Fix the case with READERNO. Support partial string match of "reader-port" like PC/SC driver. -- I don't know any device with multiple CCID interfaces, though. Signed-off-by: NIIBE Yutaka <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* scd: Clean up unused shutdown method.NIIBE Yutaka2016-09-021-72/+0
| | | | | | | | | | * scd/apdu.c (shutdown_ccid_reader, apdu_shutdown_reader): Remove. (reset_ccid_reader): Don't set shutdown_reader. * scd/ccid-driver.c (ccid_shutdown_reader): Remove. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* More cleanup of "allow to".Daniel Kahn Gillmor2016-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | * README, agent/command.c, agent/keyformat.txt, common/i18n.c, common/iobuf.c, common/keyserver.h, dirmngr/cdblib.c, dirmngr/ldap-wrapper.c, doc/DETAILS, doc/TRANSLATE, doc/announce-2.1.txt, doc/gpg.texi, doc/gpgsm.texi, doc/scdaemon.texi, doc/tools.texi, doc/whats-new-in-2.1.txt, g10/export.c, g10/getkey.c, g10/import.c, g10/keyedit.c, m4/ksba.m4, m4/libgcrypt.m4, m4/ntbtls.m4, po/ca.po, po/cs.po, po/da.po, po/de.po, po/el.po, po/eo.po, po/es.po, po/et.po, po/fi.po, po/fr.po, po/gl.po, po/hu.po, po/id.po, po/it.po, po/ja.po, po/nb.po, po/pl.po, po/pt.po, po/ro.po, po/ru.po, po/sk.po, po/sv.po, po/tr.po, po/uk.po, po/zh_CN.po, po/zh_TW.po, scd/app-p15.c, scd/ccid-driver.c, scd/command.c, sm/gpgsm.c, sm/sign.c, tools/gpgconf-comp.c, tools/gpgtar.h: replace "Allow to" with clearer text. In standard English, the normal construction is "${XXX} allows ${YYY} to" -- that is, the subject (${XXX}) of the sentence is allowing the object (${YYY}) to do something. When the object is missing, the phrasing sounds awkward, even if the object is implied by context. There's almost always a better construction that isn't as awkward. These changes should make the language a bit clearer. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* scd: Reset nonnull_nad to zero for VENDOR_GEMPC.Niibe Yutaka2016-06-191-1/+1
| | | | | | | | | | | | | | * (parse_ccid_descriptor): nonnull_nad = 0 for all GEMPC device. -- We can't use the driver for 08E6:3438, while it works well under PC/SC service. I found that the library of ccid always uses the node address = ZERO for all transactions. So, we extend the same handling for not only GEMPC_CT30, but also for all its devices. Debian-bug-id: 814584 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix error return path.NIIBE Yutaka2016-04-281-3/+4
| | | | | | | | | | * scd/ccid-driver.c (bulk_in): Remove EAGAIN handling. Handle LIBUSB_ERROR_NO_DEVICE to return CCID_DRIVER_ERR_NO_READER. -- GnuPG-bug-id: 2306 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix memory leaks.NIIBE Yutaka2016-04-271-1/+10
| | | | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Return on LIBUSB_ERROR_NO_MEM. Free CONFIG before return except on error. (scan_or_find_devices): Free device list. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Bug fix for a device with multiple interfaces.NIIBE Yutaka2016-03-071-2/+3
| | | | | | | | * scd/ccid-driver.c (scan_or_find_usb_device): Use IFC_NO when accessing interface information. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix size_t/int mismatch in libusbWerner Koch2016-01-271-3/+5
| | | | | | | | * scd/ccid-driver.c (bulk_in, abort_cmd, ccid_poll): Change msglen to int. -- Signed-off-by: Werner Koch <[email protected]>
* scd: Migrate to new API of libusb 1.0.NIIBE Yutaka2016-01-271-180/+150
| | | | | | | | | | * configure.ac (LIBUSB_CPPFLAGS): New. * scd/Makefile.am (AM_CPPFLAGS): Add LIBUSB_CPPFLAGS. * scd/ccid-driver.c: Use libusb 1.0 API. -- Changes are straightforward, not use any new features. Signed-off-by: NIIBE Yutaka <[email protected]>
* Fix typos found using codespell.Justus Winter2015-11-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c: Fix typos. * agent/call-pinentry.c: Likewise. * agent/call-scd.c: Likewise. * agent/command-ssh.c: Likewise. * agent/command.c: Likewise. * agent/divert-scd.c: Likewise. * agent/findkey.c: Likewise. * agent/gpg-agent.c: Likewise. * agent/w32main.c: Likewise. * common/argparse.c: Likewise. * common/audit.c: Likewise. * common/audit.h: Likewise. * common/convert.c: Likewise. * common/dotlock.c: Likewise. * common/exechelp-posix.c: Likewise. * common/exechelp-w32.c: Likewise. * common/exechelp-w32ce.c: Likewise. * common/exechelp.h: Likewise. * common/helpfile.c: Likewise. * common/i18n.h: Likewise. * common/iobuf.c: Likewise. * common/iobuf.h: Likewise. * common/localename.c: Likewise. * common/logging.c: Likewise. * common/openpgp-oid.c: Likewise. * common/session-env.c: Likewise. * common/sexputil.c: Likewise. * common/sysutils.c: Likewise. * common/t-sexputil.c: Likewise. * common/ttyio.c: Likewise. * common/util.h: Likewise. * dirmngr/cdblib.c: Likewise. * dirmngr/certcache.c: Likewise. * dirmngr/crlcache.c: Likewise. * dirmngr/dirmngr-client.c: Likewise. * dirmngr/dirmngr.c: Likewise. * dirmngr/dirmngr_ldap.c: Likewise. * dirmngr/dns-stuff.c: Likewise. * dirmngr/http.c: Likewise. * dirmngr/ks-engine-hkp.c: Likewise. * dirmngr/ks-engine-ldap.c: Likewise. * dirmngr/ldap-wrapper.c: Likewise. * dirmngr/ldap.c: Likewise. * dirmngr/misc.c: Likewise. * dirmngr/ocsp.c: Likewise. * dirmngr/validate.c: Likewise. * g10/encrypt.c: Likewise. * g10/getkey.c: Likewise. * g10/gpg.c: Likewise. * g10/gpgv.c: Likewise. * g10/import.c: Likewise. * g10/keydb.c: Likewise. * g10/keydb.h: Likewise. * g10/keygen.c: Likewise. * g10/keyid.c: Likewise. * g10/keylist.c: Likewise. * g10/keyring.c: Likewise. * g10/mainproc.c: Likewise. * g10/misc.c: Likewise. * g10/options.h: Likewise. * g10/packet.h: Likewise. * g10/parse-packet.c: Likewise. * g10/pkclist.c: Likewise. * g10/pkglue.c: Likewise. * g10/plaintext.c: Likewise. * g10/server.c: Likewise. * g10/sig-check.c: Likewise. * g10/sqlite.c: Likewise. * g10/tdbio.c: Likewise. * g10/test-stubs.c: Likewise. * g10/tofu.c: Likewise. * g10/trust.c: Likewise. * g10/trustdb.c: Likewise. * g13/create.c: Likewise. * g13/mountinfo.c: Likewise. * kbx/keybox-blob.c: Likewise. * kbx/keybox-file.c: Likewise. * kbx/keybox-init.c: Likewise. * kbx/keybox-search-desc.h: Likewise. * kbx/keybox-search.c: Likewise. * kbx/keybox-update.c: Likewise. * scd/apdu.c: Likewise. * scd/app-openpgp.c: Likewise. * scd/app-p15.c: Likewise. * scd/app.c: Likewise. * scd/ccid-driver.c: Likewise. * scd/command.c: Likewise. * scd/iso7816.c: Likewise. * sm/base64.c: Likewise. * sm/call-agent.c: Likewise. * sm/call-dirmngr.c: Likewise. * sm/certchain.c: Likewise. * sm/gpgsm.c: Likewise. * sm/import.c: Likewise. * sm/keydb.c: Likewise. * sm/minip12.c: Likewise. * sm/qualified.c: Likewise. * sm/server.c: Likewise. * tools/gpg-check-pattern.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgkey2ssh.c: Likewise. * tools/gpgparsemail.c: Likewise. * tools/gpgtar.c: Likewise. * tools/rfc822parse.c: Likewise. * tools/symcryptrun.c: Likewise. Signed-off-by: Justus Winter <[email protected]>
* scd: Add reder information to --card-status.NIIBE Yutaka2015-11-091-2/+6
| | | | | | | | | * g10/call-agent.h, g10/call-agent.c (agent_release_card_info) g10/card-util.c (card_status): Add READER. * scd/apdu.c (close_ccid_reader, open_ccid_reader): Handle RDRNAME. (apdu_get_reader_name): New. * scd/ccid-driver.c (ccid_open_reader): Add argument to RDRNAME_P. * scd/command.c (cmd_learn): Return READER information.
* scd: Fix error handling with libusb-compat library.NIIBE Yutaka2015-11-041-7/+12
| | | | | | | | | * scd/ccid-driver.c (bulk_out): Use LIBUSB_ERRNO_NO_SUCH_DEVICE. -- With libusb-compat library, the error is different than original libusb. (The libusb-compat library is used by Fedora.)
* scd: Fix ccid-driver timeout for OpenPGPcard v2.1.NIIBE Yutaka2015-09-171-3/+6
| | | | | | | | | | | | * scd/ccid-driver.c (CCID_CMD_TIMEOUT): New. (ccid_transceive_apdu_level, ccid_transceive): Use. -- It is reported that key generation causes timeout with OpenPGPcard v2.1. Ideally, timeout value could be determined at run-time by examining card's ATR. Compile-time fixed value is OK for internal CCID driver.
* scd: Fix Cherry ST-2000 support for pinpad input.NIIBE Yutaka2015-06-221-2/+4
| | | | | | | | | | * scd/apdu.c (pcsc_vendor_specific_init): Set pinmax to 15. * scd/ccid-driver.c (ccid_transceive_secure): Add zero for the template of APDU. -- GnuPG-bug-id: 2003, 2004
* common: Remove two JNLIB_ macros (jnlib merge).Werner Koch2015-04-241-6/+4
| | | | | | | | | | * configure.ac: Merge seperate jnlib checks. (HAVE_JNLIB_LOGGING): Remove. * common/logging.c, common/simple-pwquery.c (JNLIB_NEED_AFLOCAL): Rename to GNUPG_COMMON_NEED_AFLOCAL. Change all tests. -- Signed-off-by: Werner Koch <[email protected]>
* scd: better handling of extended APDU.NIIBE Yutaka2015-04-141-77/+79
| | | | | | | | | | | | | | | | * scd/apdu.c (send_le): Bug fix for not append Z when lc<0&&le<0. * scd/app-common.h (struct app_ctx_s): Use bit fields for flags. * scd/ccid-driver.c (CCID_MAX_BUF): New. Only for OpenPGPcard. (struct ccid_driver_s): New field of max_ccid_msglen. Remove ifsd field. (parse_ccid_descriptor): Initialize max_ccid_msglen. (ccid_transceive_apdu_level): Implement sending extended APDU in chain of CCID message. -- With this patch, we won't need PC/SC library/service any more. GnuPG-bug-id: 1947
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-111-1/+1
| | | | | | | | | | | | | | | * common/host2net.h (buf16_to_ulong, buf16_to_uint): New. (buf16_to_ushort, buf16_to_u16): New. (buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New. -- Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to avoid all sign extension on shift problems. Hanno Böck found a case with an invalid read due to this problem. To fix that once and for all almost all uses of "<< 24" and "<< 8" are changed by this patch to use an inline function from host2net.h. Signed-off-by: Werner Koch <[email protected]>
* ccid: Remove incorrect expression leading to errors.Joshua Rogers2015-01-251-1/+1
| | | | | | | | | | | | | | * scd/ccid-driver.c (send_escape_cmd): Fix setting of 'rc'. -- Variable 'rc' in send_escape_cmd was overwritten before it was returned, leading to incorrect computation. Signed-off-by: Joshua Rogers <[email protected]> [Log entry reformatted - wk] (cherry picked from commit 3d9f8bf1dc0c7165a5d2a31568ed425d2dc3b91e)
* scd: Add pinpad support for REINER SCT cyberJack goNIIBE Yutaka2014-06-271-0/+1
| | | | | | | | | | * scd/ccid-driver.h (VENDOR_REINER, CYBERJACK_GO): New. * scd/ccid-driver.c (ccid_transceive_secure): Handle the case for VENDOR_REINER. Original work was by Alina Friedrichsen (tiny change). -- This is revised version which adapts changes of ccid-driver and was later ported from branch-2.0 to master (2.1)
* scd: Support reader Gemalto IDBridge CT30Werner Koch2014-06-271-0/+5
| | | | | | | | | * scd/ccid-driver.h (GEMPC_CT30): New product id. * scd/ccid-driver.c (parse_ccid_descriptor): Add quirk for that reader. -- GnuPG-bug-id: 1638
* common: Cleanup the use of USE_NPTH and HAVE_NPTH macros.Werner Koch2014-05-021-12/+2
| | | | | | | | | | | | | | | | | * configure.ac (HAVE_NPTH): New ac_define. * common/estream.c: Use USE_NPTH instead of HAVE_NPTH. * common/http.c: Ditto. Replace remaining calls to pth by npth calls. (connect_server): Remove useless _(). * common/exechelp-posix.c, common/exechelp-w32.c * common/exechelp-w32ce.c: Use HAVE_PTH to include npth.h. * common/init.c (_init_common_subsystems): Remove call to pth_init. * common/sysutils.c (gnupg_sleep): Use npth_sleep. * scd/ccid-driver.c (my_sleep): Ditto. -- USE_NPTH is used in case were we may build with and without nPth. The missing definition HAVE_NPTH didn't allowed us to build outher sources with nPTh support.
* scd: Use vendor and product id macros also in apdu.cWerner Koch2013-08-301-23/+1
| | | | | | | | | * scd/ccid-driver.c: Move vendor and product ids to ... * scd/ccid-driver.h: here. * scd/apdu.c (CCID_DRIVER_INCLUDE_USB_IDS): Define to include ids. (pcsc_vendor_specific_init): Use vendor and product id macros. Signed-off-by: Werner Koch <[email protected]>
* agent: Fix two compiler warnings.Werner Koch2013-08-281-1/+1
| | | | | | | | | | | | | | * agent/command.c (cmd_preset_passphrase, pinentry_loopback): Use %zu in format string. * scd/ccid-driver.c (ccid_get_atr): Ditto. * agent/command-ssh.c (stream_read_string): Init arg STRING_SIZE to avoid maybe_unitialized warning. -- Actually the first one might have been a problem on big endian machines. Signed-off-by: Werner Koch <[email protected]>
* scd: fix Vega for Alpha reader.NIIBE Yutaka2013-08-271-2/+6
| | | | | | | | | * scd/ccid-driver.c (ccid_vendor_specific_init): Fix error handling and size of command. -- Signed-off-by: NIIBE Yutaka
* scd: change default value of pinpad maxlen.NIIBE Yutaka2013-03-211-3/+4
| | | | | | | | | | | | * scd/apdu.c (pcsc_pinpad_verify, pcsc_pinpad_modify): Default value of maxlen for pinpad input is now 15 (was: 25). * scd/ccid-driver.c (ccid_transceive_secure): Likewise. -- For newer PC/SC, it is better to use FEATURE_GET_TLV_PROPERTIES to get bMaxPINSize.
* scd: ccid-driver supporting larger APDU.NIIBE Yutaka2013-03-141-1/+1
| | | | | | | | | * scd/ccid-driver.c (ccid_transceive_apdu_level): Support larger APDU. -- This is still ad hoc change, but it's OK. Supporting full extended APDU exchange level is not worth yet.
* scd: Rename 'keypad' to 'pinpad'.NIIBE Yutaka2013-02-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NEWS: Mention scd changes. * agent/divert-scd.c (getpin_cb): Change message. * agent/call-scd.c (inq_needpin): Change the protocol to POPUPPINPADPROMPT and DISMISSPINPADPROMPT. * scd/command.c (pin_cb): Likewise. * scd/apdu.c (struct reader_table_s): Rename member functions. (check_pcsc_pinpad, pcsc_pinpad_verify, pcsc_pinpad_modify, check_ccid_pinpad, ccid_pinpad_operation, apdu_check_pinpad apdu_pinpad_verify, apdu_pinpad_modify): Rename. * scd/apdu.h (SW_HOST_NO_PINPAD, apdu_check_pinpad) (apdu_pinpad_verify, apdu_pinpad_modify): Rename. * scd/iso7816.h (iso7816_check_pinpad): Rename. * scd/iso7816.c (map_sw): Use SW_HOST_NO_PINPAD. (iso7816_check_pinpad): Rename. (iso7816_verify_kp, iso7816_change_reference_data_kp): Follow the change. * scd/ccid-driver.h (CCID_DRIVER_ERR_NO_PINPAD): Rename. * scd/ccid-driver.c (ccid_transceive_secure): Use it. * scd/app-dinsig.c (verify_pin): Follow the change. * scd/app-nks.c (verify_pin): Follow the change. * scd/app-openpgp.c (check_pinpad_request): Rename. (parse_login_data, verify_a_chv, verify_chv3, do_change_pin): Follow the change. * scd/scdaemon.c (oDisablePinpad, oEnablePinpadVarlen): Rename. * scd/scdaemon.h (opt): Rename to disable_pinpad, enable_pinpad_varlen. * tools/gpgconf-comp.c (gc_options_scdaemon): Rename to disable-pinpad.
* SCD: Add vendor specific initalization.NIIBE Yutaka2013-02-051-0/+28
| | | | | * scd/ccid-driver.c (ccid_vendor_specific_init): New. (ccid_open_reader): Call ccid_vendor_specific_init.