aboutsummaryrefslogtreecommitdiffstats
path: root/scd (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* 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: Relax a condition for p15 driver.NIIBE Yutaka2017-04-101-1/+1
| | | | | | | | | * scd/app-p15.c (read_ef_aodf): Fix. -- Fixes-commit: 3c1ad96f1ce838daf2d861b33e6611f6d3043d25 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Relax a condition for p15 driver.NIIBE Yutaka2017-04-101-1/+1
| | | | | | * scd/app-p15.c (read_ef_aodf): Remove possibly redundant condition. 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: Don't keep CCID reader open when card is not available.NIIBE Yutaka2017-04-071-8/+3
| | | | | | * scd/apdu.c (open_ccid_reader): Fail if no ATR. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Change the order of applications when accessed.NIIBE Yutaka2017-03-271-2/+9
| | | | | | * scd/app.c (select_application): Move the app to top. 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]>
* More change for common.NIIBE Yutaka2017-03-071-2/+2
| | | | | | * g10, scd, test, tools: Follow the change of removal of -Icommon. Signed-off-by: NIIBE Yutaka <[email protected]>
* Remove -I option to common.NIIBE Yutaka2017-03-0712-30/+30
| | | | | | | | | | | | | * dirmngr/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * g10/Makefile.am (AM_CPPFLAGS): Ditto. * g13/Makefile.am (AM_CPPFLAGS): Ditto. * kbx/Makefile.am (AM_CPPFLAGS): Ditto. * scd/Makefile.am (AM_CPPFLAGS): Ditto. * sm/Makefile.am (AM_CPPFLAGS): Ditto. * tools/Makefile.am (AM_CPPFLAGS): Ditto. * Throughout: Follow the change. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Close THE_EVENT handle.NIIBE Yutaka2017-03-071-0/+4
| | | | | | | | * scd/scdaemon.c (handle_connections): Close the handle. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix compiler warnings for app-openpgp.c.NIIBE Yutaka2017-03-061-4/+2
| | | | | | | | * scd/app-openpgp.c (retrieve_key_material): Remove touching I. (do_change_pin): Make sure going to leave if PINVALUE == 0. (rsa_writekey): Emit simpler log. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: More cleanup of old code.NIIBE Yutaka2017-03-063-8/+5
| | | | | | | | | | | | | * scd/app-dinsig.c (do_sign): Remove assignment to HASHALGO. * scd/app-p15.c (parse_keyusage_flags): Remove assign to MASK. (read_ef_aodf): Likewise. (read_ef_cdf): Change the control to parse_error. * scd/app-sc-hsm.c (parse_keyusage_flags): Remove assign to MASK. (read_ef_prkd): Remove assign to S. (read_ef_prkd): Check if PRKDF is not null. (read_ef_cd): Likewise for CDF. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Clean up old code.NIIBE Yutaka2017-03-061-1145/+22
| | | | | | | | | | | | | | * scd/apdu.c (CT_init, CT_data, CT_close): Remove. (ct_error_string, ct_activate_card, close_ct_reader, reset_ct_reader) (ct_get_status, ct_send_apdu, open_ct_reader): Remove. (new_reader_slot) [NEED_PCSC_WRAPPER]: Remove fd and pid handling. (writen, readn): Remove. (pcsc_get_status, pcsc_send_apdu, control_pcsc, close_pcsc_reader) (reset_pcsc_reader, open_pcsc_reader): Only DIRECT version. (apdu_open_one_reader): Remove CT_api handling. (apdu_get_status_internal, send_le): Fix to stop warnings. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix API of select_file/_path.NIIBE Yutaka2017-03-067-48/+25
| | | | | | | | | | | | | | | | * scd/iso7816.c (iso7816_select_file, iso7816_select_path): Remove unused arguments. * scd/app-dinsig.c (do_readcert): Follow the change. * scd/app-help.c (app_help_read_length_of_cert): Likewise. * scd/app-nks.c (keygripstr_from_pk_file, do_readcert, do_readkey) (switch_application): Likewise. * scd/app-p15.c (select_and_read_binary, select_ef_by_path) (micardo_mse, app_select_p15): Likewise. * scd/app.c (app_new_register): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix scd_kick_the_loop.NIIBE Yutaka2017-03-031-31/+56
| | | | | | | | | | | | | | | | * scd/scdaemon.c (notify_fd): Remove. (the_event) [W32]: New. (main_thread_pid) [!W32]: New. (handle_signal): Handle SIGCONT. (scd_kick_the_loop): Use signal on UNIX and event on Windows. (handle_connections): Likewise. -- Code with CreateEvent is copied from gpg-agent.c. Code for signal is copied from dkg's gpg-agent-idling in Debian. GnuPG-bug-id: 2982 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd,agent: Improve the OpenPGP PIN prompt texts.Werner Koch2017-02-221-7/+18
| | | | | | | | | | | | | * scd/app-openpgp.c (get_prompt_info): Change texts. * agent/call-pinentry.c (struct entry_features): New. (getinfo_features_cb): New. (start_pinentry): Set new fucntion as status callback. (build_cmd_setdesc): New. Replace all snprintf for SETDESC by this one. -- Suggested-by: Andre Heinecke Signed-off-by: Werner Koch <[email protected]>
* Revert "scd: Nitpicks on the improved card prompts"Werner Koch2017-02-221-7/+7
| | | | | | | -- This reverts commit 143ca039e1e81140ae520cc1025f8e25c01acc80. I have a more improved version in the works.
* scd: Nitpicks on the improved card promptsAndre Heinecke2017-02-221-7/+7
| | | | | | | | | | | | | * src/app-openpgp.c (get_prompt_info): Change wording and order slightly. -- The word "Card" was repeated too much in the prompt and moving signatures to the bottom results in a more consistent layout between the prompts with signcount and the prompts without. Signed-off-by: Andre Heinecke <[email protected]>
* scd: Improve the prompts for OpenPGP cards.Werner Koch2017-02-221-38/+182
| | | | | | | | | | | | | | | | * scd/app-openpgp.c (get_disp_name): New. (get_disp_serialno): New. (get_prompt_info): New. (build_enter_admin_pin_prompt): Rework the prompt texts. Factor some code out to ... (get_remaining_tries): New. (verify_a_chv): Print a remaining counter also for the standard PIN. Rework the prompt texts. * agent/divert-scd.c (ask_for_card): Pretty format an OpenPGP serial no. Signed-off-by: Werner Koch <[email protected]>
* Clean up word replication.Yuri Chornoivan2017-02-217-11/+11
| | | | | | | | | -- 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 RESET command handling (more).NIIBE Yutaka2017-02-173-12/+26
| | | | | | | | | | | | | | | * scd/app-common.h (struct app_ctx_s): Add reset_requested. * scd/app.c (app_reset): Locking APP, set reset_requested. (deallocate_app): Release the lock. (release_application): Add LOCKED_ALREADY argument. (scd_update_reader_status_file): Hold the lock when accessing APP. When reset_requested is set, close the reader and deallocate APP. * scd/command.c (open_card_with_request, cmd_restart): Follow the change of release_application. (send_client_notifications): Here it calls release_application holding the lock. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Minor fixes to silence compiler warnings.NIIBE Yutaka2017-02-162-4/+6
| | | | | | | | * scd/app.c (app_reset): Initialize ERR. * scd/scdaemon.c (scd_kick_the_loop, handle_connections): Catch the return value. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix RESET command handling.NIIBE Yutaka2017-02-151-28/+24
| | | | | | | | | | * scd/app.c (release_application_internal): Remove. (release_application): Merge release_application_internal. (app_reset): Kick the loop and let close the reader. Sleep is required here to wait closing. (scd_update_reader_status_file): When APP is no use, close it. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix use case of PC/SC.NIIBE Yutaka2017-02-133-5/+13
| | | | | | | | | | | | | | | | | * scd/apdu.c (apdu_open_reader): Add an argument APP_EMPTY. When CCID driver fails to open, try PC/SC if APP is nothing. * scd/app.c (select_application): Supply arg if APP is nothing. -- After scanning available card readers by CCID driver, scdaemon should try PC/SC service if no APP is registered yet. Also, when the slot is allocated for PC/SC (ccid.handle==NULL), it should not call ccid_compare_BAI, otherwise scdaemon crashes. Debian-bug-id: 852702, 854005, 854595, 854616 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix regression tracking the connection count.NIIBE Yutaka2017-01-313-24/+41
| | | | | | | | | | | | | | | | * scd/scdaemon.c (get_active_connection_count): New. (start_connection_thread): Bump ACTIVE_CONNECTIONS up and down. * scd/command.c (cmd_getinfo): Add subcommand "connections". -- Apply gpg-agent change to scdaemon. See the commit in 2016-08-06: 40d16029ed8b334c371fa7f24ac762d47302826e Then, add kicking the loop, so that main loop can notice the change of the connection. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Remove --debug-disable-ticker option.NIIBE Yutaka2017-01-311-34/+11
| | | | | | | | | | | | | * scd/scdaemon.c (ticker_disabled): Remove. (handle_tick, need_tick): Remove. (handle_connections): Don't check ticker_disabled. -- Now, removal of device/card is only done by the function scd_update_reader_status_file, it should be called if needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix SERIALNO for multiple devices.NIIBE Yutaka2017-01-315-76/+71
| | | | | | | | | | | | | | * 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-303-29/+31
| | | | | | | | | | | | | | | * 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: Don't send GET_STATUS packet if not needed.NIIBE Yutaka2017-01-301-8/+19
| | | | | | | | | * scd/apdu.c (apdu_get_status_internal): Add ON_WIRE arg. (apdu_connect): Call apdu_get_status_internal with ON_WIRE enabled. (apdu_get_status): For periodical check, call apdu_get_status_internal with ON_WIRE disabled. Signed-off-by: NIIBE Yutaka <[email protected]>
* 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-275-113/+189
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-278-106/+127
| | | | | | | | | | | | | | | | | | | | | | | * 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: Wake up the select when new USB scan.NIIBE Yutaka2017-01-271-6/+45
| | | | | | | | | | | | | | | * scd/scdaemon.c (update_fdset_for_usb): Wake up the select(2). (handle_connections): Use a kind of "self-pipe" technique. -- Use pipe to wake up select(2). If UNIX-only, signal could be used. For portability, "self-pipe" is better, here. Setup for non-blocking for pipe fds are not needed, because speed of USB device insertion is limited by human physical interaction; No one can do hundreds of device insertion/removal-s per second. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Only submit apdu_get_status when needed.NIIBE Yutaka2017-01-267-42/+145
| | | | | | | | | | | | | | | * 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: Fix APP reference counting.NIIBE Yutaka2017-01-262-2/+1
| | | | | | | | | * scd/app.c (scd_update_reader_status_file): Don't call another release_application_internal. * scd/command.c (open_card_with_request): Don't require APPTYPE != NULL. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Add INTERRUPT endp support to CCID driver.NIIBE Yutaka2017-01-262-4/+70
| | | | | | | | | | * 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]>
* Fix format string errors and some missing error case initialization.Werner Koch2017-01-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/logging.c (do_logv): Remove extra parentheses in comparison. * dirmngr/dns-stuff.c (resolve_addr_libdns): Init RES so that dns_res_close is given a defined value in the error case. * dirmngr/http.c (cookie_read, cookie_write) [HTTP_USE_NTBTLS]: Fix format string char. * dirmngr/ks-engine-hkp.c (ks_hkp_help): Remove duplicate "const". * dirmngr/ks-engine-http.c (ks_http_help): Ditto. * dirmngr/ks-engine-kdns.c (ks_kdns_help): Ditto. * dirmngr/ks-engine-ldap.c (ks_ldap_help): Ditto. * scd/app-p15.c (send_keypairinfo, do_getattr): Fix format string char. * tools/gpgconf-comp.c (gpg_agent_runtime_change): Init PID for the error case. (scdaemon_runtime_change): Ditto. (dirmngr_runtime_change): Ditto. * tools/gpgconf.c (query_swdb): Init VALUE_SIZE_UL. Signed-off-by: Werner Koch <[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: Cleanup SERIALNO protocol.NIIBE Yutaka2017-01-184-65/+38
| | | | | | | | | | | | | | | | | | | | * scd/app.c (app_get_serial_and_stamp): Remove. (app_get_serialno): New. (app_write_learn_status): Use send_status_direct. (app_getattr): Use app_get_serialno for SERIALNO and send with send_status_direct. * scd/app-openpgp.c (do_getattr): Likewise. * scd/command.c (cmd_serialno): Don't send TIMESTAMP of 0. (cmd_learn): Likewise. Don't inquire with TIMESTAMP of 0. -- In the SERIALNO protocol, timestamp used to be considered, but had never used at all. In the new implementation, removed card/token is always detected and connection becomes invalid, no timestamp is required any more. Examined scute and poldi as well for this protocol change. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Add "card_list" sub command for GETINFO.NIIBE Yutaka2017-01-183-4/+33
| | | | | | | | * scd/app.c (app_send_card_list): New. * scd/command.c (cmd_getinfo): Fix "status" sub command. Add "card_list" sub command. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Add --demand option for SERIALNO.NIIBE Yutaka2017-01-163-39/+91
| | | | | | | | | | | | | | | * scd/app.c (select_application): Add SERIALNO_BIN and SERIALNO_BIN_LEN arguments. Return matched APP with a serial number when specified. * scd/command.c (open_card): Modify for the implicit open only. (open_card_with_request): New for explicit open and support match with a serial number. (cmd_serialno): Support --demand option. (cmd_learn, cmd_readcert, cmd_readkey, cmd_pksign, cmd_pkauth) (cmd_pkdecrypt, cmd_getattr, cmd_setattr, cmd_writecert, cmd_writekey) (cmd_genkey, cmd_random, cmd_passwd, cmd_checkpin, cmd_apdu): Follow the change of open_card. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix for --disable-ccid for scdaemon.NIIBE Yutaka2017-01-061-6/+7
| | | | | | | | * scd/apdu.c (apdu_dev_list_finish): Don't call ccid_dev_scan_finish with no table. (apdu_open_reader): Only increment when it's zero. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix for --disable-ccid-driver.NIIBE Yutaka2017-01-061-1/+6
| | | | | | | * scd/apdu.c [HAVE_LIBUSB] (apdu_dev_list_start): Conditionalize. [HAVE_LIBUSB] (apdu_dev_list_finish, apdu_open_reader): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Support multiple readers by CCID driver.NIIBE Yutaka2017-01-066-190/+589
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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]>
* Replace use of variable-length-arrays.Werner Koch2017-01-021-1/+13
| | | | | | | | | | | | | * common/t-iobuf.c (main): Replace variable-length-array. * g10/gpgcompose.c (mksubpkt_callback): Ditto. (encrypted): Ditto. * g10/t-stutter.c (log_hexdump): Ditto. (oracle_test): Ditto. * g10/tofu.c (get_policy): Ditto. Use "%zu" for size_t. * scd/app-openpgp.c (ecc_writekey): Replace variable-length-array. Check for zero length OID_LEN. Signed-off-by: Werner Koch <[email protected]>
* scd: Fix select_application.NIIBE Yutaka2016-12-301-2/+4
| | | | | | * scd/app.c (select_application): Fix the condition for open. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix card removal monitor.NIIBE Yutaka2016-12-303-60/+70
| | | | | | | | * scd/app.c (app_reset): Call send_client_notification with REMOVAL. (scd_update_reader_status_file): Likewise. * scd/command.c (send_client_notifications): Distinguish removal. 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]>