aboutsummaryrefslogtreecommitdiffstats
path: root/scd/apdu.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* scd:p15: Make it code work again for D-Trust cards.Werner Koch2021-02-231-0/+1
| | | | | | | | | | | | | | | | | | | * scd/app-p15.c (select_and_read_binary): Allow to skip the select. (select_and_read_record): Return the statusword. Silence error message for SW_FILE_STRUCT. (select_ef_by_path): Fix selection with a home_DF. (read_first_record): Fallback to read_binary for CardOS and return info about this. (read_ef_prkdf): Use info from read_first_record to decide whether to use record or binary mode. (read_ef_pukdf): Ditto. (read_ef_aodf): Ditto. (read_ef_cdf): Ditto. New arg cdftype for diagnostics. (read_p15_info): Pass cdftype. * scd/apdu.h (SW_FILE_STRUCT): New. * scd/apdu.c (apdu_strerror): Map that one to a string. * scd/iso7816.c (map_sw): and to a gpg-error.
* scd: Define new status wordWerner Koch2021-01-271-0/+1
| | | | | | | | * scd/apdu.h (SW_NO_CURRENT_EF): New. -- This merely to show better diagnostics. Used for example by CardOS 5.3.
* scd:ccid-driver: Fix pinpad error handling for cancel/timeout.NIIBE Yutaka2020-11-271-1/+3
| | | | | | | | | | | | | | * scd/apdu.h (SW_HOST_UI_CANCELLED, SW_HOST_UI_TIMEOUT): New. * scd/ccid-driver.h (CCID_DRIVER_ERR_UI_CANCELLED): New. (CCID_DRIVER_ERR_UI_TIMEOUT): New. * scd/ccid-driver.c (bulk_in): Handle PIN input cancel/timeout error. * scd/iso7816.c (map_sw): Support SW_HOST_UI_CANCELLED and SW_HOST_UI_TIMEOUT. -- GnuPG-bug-id: 4614 Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Map some error codes from libusb to ccid-driver error codes.Werner Koch2020-08-121-1/+9
| | | | | | | | | | | | | | | * scd/ccid-driver.h (CCID_DRIVER_ERR_USB_*): New error codes. * scd/apdu.h: New SW_HOST error codes. * scd/apdu.c (host_sw_string): Print them * scd/ccid-driver.c (map_libusb_error): New. (ccid_open_usb_reader, bulk_in, abort_cmd): Map libusb error codes. * scd/iso7816.c (map_sw): Map new codes to gpg-error. -- This change will help to get low level error conditions from hipher application code. Signed-off-by: Werner Koch <[email protected]>
* scd,pcsc: Remove the restriction of no-scanning in PC/SC.NIIBE Yutaka2019-09-111-1/+1
| | | | | | | | * scd/apdu.h (app_open_reader): Remove the last argument. * scd/apdu.c (app_open_reader): Ditto. * scd/app.c (select_application): Don't supply APP_EMPTY. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Handle ack button timeout as GPG_ERR_TIMEOUT.NIIBE Yutaka2019-02-211-0/+1
| | | | | | | * scd/apdu.h (SW_ACK_TIMEOUT): New. * scd/iso7816.c (map_sw): Return GPG_ERR_TIMEOUT for SW_ACK_TIMEOUT. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: One new and one improved 7816 function.Werner Koch2019-01-201-1/+1
| | | | | | | | | | | | | | | | * scd/apdu.c (apdu_send_direct): New arg R_SW. * scd/command.c (cmd_apdu): Ditto. * scd/iso7816.c (iso7816_apdu_direct): New arg R_SW. (iso7816_general_authenticate): New. * scd/app-nks.c (get_chv_status, get_nks_version): Pass NULL for new arg. -- iso7816_general_authenticate will be used for the PIV card support. The new arg to iso7816_apdu_direct and apdu_send_direct allows to get the raw status word back without the need to handle an output buffer. Signed-off-by: Werner Koch <[email protected]>
* scd: Support "acknowledge button" feature.NIIBE Yutaka2018-10-111-0/+1
| | | | | | | | | | | | | * scd/apdu.c (set_prompt_cb): New member function. (set_prompt_cb_ccid_reader): New function. (open_ccid_reader): Initialize with set_prompt_cb_ccid_reader. (apdu_set_prompt_cb): New. * scd/app.c (lock_app, unlock_app): Add call to apdu_set_prompt_cb. * ccid-driver.c (ccid_set_prompt_cb): New. (bulk_in): Call ->prompt_cb when timer extension. * scd/command.c (popup_prompt): New. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Distinguish cancel by user and protocol error.NIIBE Yutaka2017-09-201-1/+2
| | | | | | | | | | * scd/apdu.h (SW_HOST_CANCELLED): New. * scd/apdu.c (host_sw_string): Support SW_HOST_CANCELLED. (pcsc_error_to_sw): Return SW_HOST_CANCELLED for PCSC_E_CANCELLED. * scd/iso7816.c (map_sw): Return GPG_ERR_INV_RESPONSE for SW_HOST_ABORTED and GPG_ERR_CANCELED for SW_HOST_CANCELLED. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Fix use case of PC/SC.NIIBE Yutaka2017-02-131-1/+1
| | | | | | | | | | | | | | | | | * 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: Improve watching USB device removal.NIIBE Yutaka2017-01-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * 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/+1
| | | | | | | | | | | | | | | * 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: Support multiple readers by CCID driver.NIIBE Yutaka2017-01-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: Fix a race condition for new_reader_slot.NIIBE Yutaka2016-12-291-0/+2
| | | | | | | | | | | | | | | | | | | * scd/apdu.c (reader_table_lock, apdu_init): New. (new_reader_slot): Serialize by reader_table_lock. * scd/app.c (lock_app, unlock_app, app_new_register): Fix error code usage. (initialize_module_command): Call apdu_init. * scd/scdaemon.c (main): Handle error for initialize_module_command. -- This is a long standing bug. There are two different things; The serialization of allocating a new SLOT, and the serialization of using the SLOT. The latter was implemented in new_reader_slot by lock_slot. However, the former was not done. Thus, there was a possible race where a same SLOT is allocated to multiple threads. Signed-off-by: NIIBE Yutaka <[email protected]>
* scd: Simplify monitoring card removal.NIIBE Yutaka2016-12-281-2/+1
| | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (struct reader_table_s): Remove any_status, last_status, status, and change_counter field. (new_reader_slot, dump_reader_status, ct_activate_card, open_ct_reader) (connect_pcsc_card, open_pcsc_reader_direct, open_pcsc_reader_wrapped) (open_ccid_reader, apdu_reset): Follow the change. (ct_dump_reader_status): Remove. (apdu_get_status_internal, apdu_get_status): Remove CHANGED arg. (apdu_connect): Follow the change. * scd/command.c (struct vreader_s): Remove reset_failed, any, and changed field. (cmd_getinfo, update_reader_status_file): Follow the change. -- In the past, scdaemon monitors card insertion (as well as removal), so the code has been complicated, and there has been duplication in two layers. Now, it only monitors card removal, it's now simplified. 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-1/+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]>
* scd: Add reder information to --card-status.NIIBE Yutaka2015-11-091-1/+1
| | | | | | | | | * 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.
* gpg: Add sub-command "factory-reset" to --card-edit.Werner Koch2014-12-151-1/+1
| | | | | | | | | | | | | | | | | | * common/util.h (GPG_ERR_OBJ_TERM_STATE): New. * scd/iso7816.c (map_sw): Add this error code. * scd/app-openpgp.c (do_getattr): Return the life cycle indicator. * scd/app.c (select_application): Allow a return value of GPG_ERR_OBJ_TERM_STATE. * scd/scdaemon.c (set_debug): Print the DBG_READER value. * g10/call-agent.c (start_agent): Print a status line for the termination state. (agent_scd_learn): Make arg "info" optional. (agent_scd_apdu): New. * g10/card-util.c (send_apdu): New. (factory_reset): New. (card_edit): Add command factory-reset. Signed-off-by: Werner Koch <[email protected]>
* scd: Add a new status word code.Werner Koch2014-07-251-0/+1
| | | | | * scd/apdu.h (SW_REF_DATA_INV): New. * scd/apdu.c (apdu_strerror): Add string.
* scd: Rename 'keypad' to 'pinpad'.NIIBE Yutaka2013-02-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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: API cleanup for keypad handling.NIIBE Yutaka2013-02-051-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * scd/iso7816.h (struct pininfo_s): Rename from iso7816_pininfo_s. Change meaning of MODE. (pininfo_t): Rename from iso7816_pininfo_t. * scd/sc-copykeys.c: Include "iso7816.h". * scd/scdaemon.c, scd/command.c: Likewise. * scd/ccid-driver.c: Include "scdaemon.h" and "iso7816.h". (ccid_transceive_secure): Follow the change of PININFO_T. * scd/app.c: Include "apdu.h" after "iso7816.h". * scd/iso7816.c (iso7816_check_keypad, iso7816_verify_kp) (iso7816_change_reference_data_kp): Follow the change of API. * scd/apdu.c (struct reader_table_s): Change API of CHECK_KEYPAD, KEYPAD_VERIFY, KEYPAD_MODIFY to have arg of PININFO_T. (check_pcsc_keypad, check_ccid_keypad): Likewise. (apdu_check_keypad, apdu_keypad_verify, apdu_keypad_modify): Likewise. (pcsc_keypad_verify, pcsc_keypad_modify, ct_send_apdu) (pcsc_send_apdu_direct, pcsc_send_apdu_wrapped, pcsc_send_apdu) (send_apdu_ccid, ccid_keypad_operation, my_rapdu_send_apdu, send_apdu) (send_le): Follow the change of API. * scd/apdu.h (apdu_check_keypad, apdu_keypad_verify) (apdu_keypad_modify): Change the API. * scd/app-dinsig.c, scd/app-nks.c, scd/app-openpgp.c: Follow the change.
* SCD: Clean up. Remove PADLEN for keypad input.NIIBE Yutaka2013-02-051-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (struct pininfo_s): Use iso7816_pininfo_s. (struct reader_table_s): Remove last arg from check_keypad method. (check_pcsc_keypad, check_pcsc_keypad): Remove PIN_PADLEN. (pcsc_keypad_verify, pcsc_keypad_modify): Don't check PIN_PADLEN. (send_apdu_ccid, ccid_keypad_operation): Remove PIN_PADLEN. (apdu_check_keypad, apdu_keypad_verify, apdu_keypad_modify): Likewise. * scd/apdu.h (apdu_check_keypad, apdu_keypad_verify) (apdu_keypad_modify): Remove PIN_PADLEN. * scd/ccid-driver.c (ccid_transceive_secure): Remove PIN_PADLEN. * scd/ccid-driver.h (ccid_transceive_secure): Remove PIN_PADLEN. * scd/iso7816.c (iso7816_check_keypad, iso7816_verify_kp) (iso7816_change_reference_data_kp): Remove PADLEN. * scd/iso7816.h (struct iso7816_pininfo_s): Remove PADLEN, PADCHAR. -- In the OpenPGPcard specification, password comes with no padding. In GnuPG, we support keypad input for OpenPGPcard only. Thus, it is useless to try to support padding for keypad input.
* Revert SCD changes of 2010-05-03.NIIBE Yutaka2012-12-041-1/+1
| | | | | | | | | | | | | | | | * scd/apdu.c (pcsc_no_service): Remove. (open_pcsc_reader_direct, open_pcsc_reader_wrapped): Remove pcsc_no_service support. (apdu_open_reader): Remove R_NO_SERVICE. * scd/apdu.h (apdu_open_reader): Remove R_NO_SERVICE. * scd/command.c (reader_disabled): Remove. (get_current_reader): Follow the change of R_NO_SERVICE. (open_card, cmd_serialno, scd_command_handler): Remove reader_disabled support. * scd/sc-copykeys.c (main): Follow the change of R_NO_SERVICE. -- Daemon should handle all possible cases. Even if such a difficult case like reader_disabled, it should not exit.
* scd: Add more status word values for documentation.Werner Koch2011-12-141-0/+3
|
* scd: Add debug option for reader function calls.Werner Koch2011-12-141-1/+0
| | | | | | | | * 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.
* PC/SC pinpad support (pinpad input for modify pass phrase with resetcode, by ↵NIIBE Yutaka2011-11-291-4/+0
| | | | admin).
* PC/SC pinpad support (pinpad input for modify pass phrase).NIIBE Yutaka2011-11-291-0/+3
|
* PC/SC pinpad support.NIIBE Yutaka2011-11-281-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-6/+3
| | | | | | | | 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.
* Detect non operational readers.Werner Koch2011-01-251-2/+2
| | | | Backport from 2.0.
* Add code to better handle unplugging of a reader.Werner Koch2009-07-161-0/+1
|
* Add new prototypesWerner Koch2009-07-131-0/+2
|
* Improved smartcard robustness.Werner Koch2009-05-131-1/+1
|
* Implement decryption for TCOS 3 cards.Werner Koch2009-03-301-4/+6
|
* SCD changes for PC/SC under W32.Werner Koch2008-10-141-2/+12
|
* Support the Certifciate DO of the v2 OpenPGP cards.Werner Koch2008-09-231-2/+6
|
* Changed to GPLv3.Werner Koch2007-07-041-4/+2
| | | | | Removed intl/.
* Preparing an interim releaseWerner Koch2005-11-281-1/+8
|
* Basically made Belgian EID cards work.Werner Koch2005-09-051-1/+5
| | | | | | Signature creation has not yet been tested. Also other changes to better cope with T=0 cards.
* Added ID keywords because these files are often used in other packages.Werner Koch2004-10-141-0/+2
|
* Preparing a new release. Updated gettextWerner Koch2004-09-301-0/+1
|
* * configure.ac: Changed tests for libusb to also suuport theWerner Koch2004-08-051-1/+2
| | | | | | | | | | | | | | | | | | stable version 0.1.x. * scdaemon.texi (Card applications): New section. * scdaemon.c (main): New option --disable-application. * app.c (is_app_allowed): New. (select_application): Use it to check for disabled applications. * ccid-driver.h (CCID_DRIVER_ERR_ABORTED): New. * ccid-driver.c (ccid_open_reader): Support the stable 0.1 version of libusb. (ccid_get_atr): Handle short messages. * apdu.c (my_rapdu_get_status): Implemented.
* (reader_table_s): Add function pointers for the backends.Werner Koch2004-07-161-2/+25
| | | | | | | | | | | | | | | | | | (apdu_close_reader, apdu_get_status, apdu_activate) (send_apdu): Make use of them. (new_reader_slot): Intialize them to NULL. (dump_ccid_reader_status, ct_dump_reader_status): New. (dump_pcsc_reader_status): New. (open_ct_reader, open_pcsc_reader, open_ccid_reader) (open_osc_reader, open_rapdu_reader): Intialize function pointers. (ct_activate_card, ct_send_apdu, pcsc_send_apdu, osc_send_apdu) (error_string): Removed. Replaced by apdu_strerror. (get_ccid_error_string): Removed. (ct_activate_card): Remove the unused loop. (reset_ct_reader): Implemented. (ct_send_apdu): Activate the card if not yet done. (pcsc_send_apdu): Ditto.
* * pcsc-wrapper.c: New.Werner Koch2004-04-201-2/+9
| | | | | | | | * Makefile.am (pkglib_PROGRAMS): Install it here. * apdu.c (writen, readn): New. (open_pcsc_reader, pcsc_send_apdu, close_pcsc_reader): Use the pcsc-wrapper if we are using Pth.
* Some minor bug fixes, new test utilities and started support for otherWerner Koch2004-01-271-1/+4
| | | | | smartcard applications.
* * command.c (cmd_checkpin): New.Werner Koch2003-10-211-0/+1
| | | | | | | | | (register_commands): Add command CHECKPIN. * app.c (app_check_pin): New. * app-openpgp.c (check_against_given_fingerprint): New. Factored out that code elsewhere. (do_check_pin): New.
* Cleanups, fixes and PC/SC supportWerner Koch2003-08-051-1/+2
|
* This commit was manufactured by cvs2svn to create branchRepo Admin2003-08-051-0/+73
'GNUPG-1-9-BRANCH'.