aboutsummaryrefslogtreecommitdiffstats
path: root/scd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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: Force key attribute change for writekey.NIIBE Yutaka2015-09-071-33/+62
| | | | | | | * scd/app-openpgp.c (change_rsa_keyattr): New. (change_keyattr_from_string): Use change_rsa_keyattr. (rsa_writekey): Call change_rsa_keyattr when different size. (ecc_writekey): Try to change key attribute.
* scd: KEYNO cleanup.NIIBE Yutaka2015-09-071-70/+67
| | | | | | | * scd/app-openpgp.c (get_public_key, send_keypair_info, do_readkey) (change_keyattr, change_keyattr_from_string, ecc_writekey, do_genkey) (compare_fingerprint, check_against_given_fingerprint): KEYNO starts from 0.
* Typo fixesWerner Koch2015-09-011-1/+1
| | | | --
* Curve25519 support.NIIBE Yutaka2015-08-061-57/+62
| | | | | | | | | | | | | | | | | | | | | | | | * agent/cvt-openpgp.c (get_keygrip): Handle Curve25519. (convert_secret_key, convert_transfer_key): Ditto. * common/openpgp-oid.c (oidtable): Add Curve25519. (oid_crv25519, openpgp_oid_is_crv25519): New. * common/util.h (openpgp_oid_is_crv25519): New. * g10/ecdh.c (pk_ecdh_encrypt_with_shared_point): Handle the case with Montgomery curve which uses x-only coordinate. * g10/keygen.c (gen_ecc): Handle Curve25519. (ask_curve): Change the API and second arg is to return subkey algo. (generate_keypair, generate_subkeypair): Follow chage of ask_curve. * g10/keyid.c (keygrip_from_pk): Handle Curve25519. * g10/pkglue.c (pk_encrypt): Handle Curve25519. * g10/pubkey-enc.c (get_it): Handle the case with Montgomery curve. * scd/app-openpgp.c (ECC_FLAG_DJB_TWEAK): New. (send_key_attr): Work with general ECC, Ed25519, and Curve25519. (get_public_key): Likewise. (ecc_writekey): Handle flag_djb_tweak. -- When libgcrypt has Curve25519, GnuPG now supports Curve25519.
* common: extend API of openpgp_oid_to_curve for canonical name.NIIBE Yutaka2015-08-061-2/+2
| | | | | | | | | | | | | | | * common/openpgp-oid.c (openpgp_oid_to_curve): Add CANON argument. * common/util.h: Update. * g10/import.c (transfer_secret_keys): Follow the change. * g10/keyid.c (pubkey_string): Likewise. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Likewise. * parse-packet.c (parse_key): Likewise. * scd/app-openpgp.c (send_key_attr, get_public_key): Likewise. -- Change the function so that caller can select canonical name of curve or name for printing. Suggested by wk.
* scd: Fix ecc_oid.NIIBE Yutaka2015-08-041-1/+1
| | | | * scd/app-openpgp.c (ecc_oid): Call with OIDBUF.
* scd: Fix ECC support.NIIBE Yutaka2015-08-041-17/+44
| | | | | | | | * scd/app-openpgp.c (send_key_attr): Send KEYNO. (get_public_key): Fix SEXP composing. (ecc_writekey): Fix OID length calculation. (ecc_oid): Prepend the length before query. (parse_algorithm_attribute): Handle the case the curve is not available.
* scd: Fix size_t/unsigned int mismatch.Werner Koch2015-07-261-1/+3
| | | | * scd/app-openpgp.c (ecc_writekey): Use extra var n.
* Replace GNUPG_GCC_A_ macros by GPGRT_ATTR_ macros.Werner Koch2015-07-261-1/+1
| | | | | | | | | | | | | * common/util.h: Provide replacement for GPGRT_ATTR_ macros when using libgpg-error < 1.20. * common/mischelp.h: Ditto. * common/types.h: Ditto. -- Given that libgpg-error is a dependency of all GnuPG related libraries it is better to define such macros at only one place instead of having similar macros at a lot of places. For now we need repalcement macros, though.
* scd: support any curves defined by libgcrypt.NIIBE Yutaka2015-07-251-221/+143
| | | | | | | | | | | | | | * g10/call-agent.h (struct agent_card_info_s): Add curve field. * g10/call-agent.c (learn_status_cb): Use curve name. * g10/card-util.c (card_status): Show pubkey name. * scd/app-openpgp.c (struct app_local_s): Record OID and flags. (store_fpr): Use ALGO instead of key type. (send_key_attr): Use curve name instead of OID. (get_public_key): Clean up by OID to curve name. (ecc_writekey): Support any curves in libgcrypt. (do_genkey, do_auth, ): Follow the change. (ecc_oid): New. (parse_algorithm_attribute): Show OID here.
* scd: Format change to specify "rsa2048" for KEY-ATTR.NIIBE Yutaka2015-07-231-6/+10
| | | | | | | | | * g10/card-util.c (do_change_keysize): Put "rsa". * scd/app-openpgp.c (change_keyattr, change_keyattr_from_string): Change the command format. (rsa_writekey): Check key type. (do_writekey): Remove "ecdh" and "ecdsa" support which was available in experimental libgcrypt before 1.6.0.
* scd: change_keyattr_from_string for ECC.NIIBE Yutaka2015-07-211-55/+95
| | | | | | * scd/app-openpgp.c (change_keyattr, change_keyattr_from_string): Support ECC. (rsa_writekey): Don't change key attribute.
* scd: Use openpgpdefs.h for constants.NIIBE Yutaka2015-07-171-13/+17
| | | | * scd/app-openpgp.c: Include openpgpdefs.h.
* scd: Remove unused files.NIIBE Yutaka2015-07-097-3036/+0
| | | | | | | | | | | | | * scd/Makefile.am (sc_copykeys_*): Remove. * scd/sc-copykeys.c: Remove. * scd/pcsc-wrapper.c: Remove. * scd/{card-common.h,card-dinsig.c,card-p15.c,card.c}: Remove. -- sc-copykeys doesn't work any more because it's based on old API. pcsc-wrapper has gone because of nPth which is compatible to pthreads. The card* files are old files, now we have app*.
* scd: Support AES decryption for OpenPGPcard v3.0.NIIBE Yutaka2015-07-021-1/+4
| | | | * scd/app-openpgp.c (do_decipher): Support AES decryption.
* scd: Support button flag and AES key data for OpenPGPcard v3.0.NIIBE Yutaka2015-06-261-8/+28
| | | | | | * scd/app-openpgp.c (do_getattr, show_caps, app_select_openpgp): Support button and symmetric decryption. (do_setattr): Support setting AESKEY.
* Allow use of debug flag names for all tools.Werner Koch2015-06-231-13/+26
| | | | | | | | | | * g13/g13.c: Make use of debug_parse_flag. * scd/scdaemon.c: Ditto. * sm/gpgsm.c: Ditto * agent/gpg-agent.c: Ditto. But do not terminate on "help" * dirmngr/dirmngr.c: Ditto. Signed-off-by: Werner Koch <[email protected]>
* scd: pinpad workaround for PC/SC implementations.NIIBE Yutaka2015-06-231-4/+12
| | | | | | | | | | | | * scd/adpu.c (pcsc_pinpad_verify, pcsc_pinpad_modify): Bigger buffer for TPDU card reader. -- GnuPG-bug-id: 2003, 2004 This is needed for PC/SC on Debian Jessie. Note that it's not only for Cherry ST-2000, but also, for any TPDU card readers.
* scd: Fix Cherry ST-2000 support for pinpad input.NIIBE Yutaka2015-06-222-6/+16
| | | | | | | | | | * 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
* scd: do_decipher change for OpenPGPcard v3.0.NIIBE Yutaka2015-06-051-3/+21
| | | | * scd/app-openpgp.c (do_decipher): Add a header for ECDH.
* scd: Fix key template of ECC.NIIBE Yutaka2015-05-291-1/+1
| | | | | | | | * scd/app-openpgp.c (build_ecc_privkey_template): Use correct value. -- Forthcoming OpenPGPcard specification 3.0 will address this 0x92.
* scd: PC/SC reader selection by partial string match.NIIBE Yutaka2015-04-301-4/+8
| | | | | | | | | | | | | | | | | * scd/apdu.c (open_pcsc_reader_direct): Partial string match. -- The card reader name by PC/SC service might include USB bus, which varies (on some platform like GNU/Linux). Thus, it's better to match partial string. Original patch was submitted by anstein. I changed it to fallback to the first reader if no match found. Note that we need to change pcsc-wrapper.c in 2.0 backport. GnuPG-bug-id: 1618, 1930
* common: Remove two JNLIB_ macros (jnlib merge).Werner Koch2015-04-243-9/+5
| | | | | | | | | | * 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-143-83/+87
| | | | | | | | | | | | | | | | * 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
* Remove obsolete directories from AM_CPPFLAGS.Werner Koch2015-04-101-1/+1
|
* Rename DBG_ASSUAN to DBG_IPC and add separate DBG_EXTPROG.Werner Koch2015-04-062-6/+6
| | | | * g10/options.h (DBG_EXTPROG_VALUE): Separate from DBG_IPC_VALUE.
* scd: Fix possible NULL deref in apdu.cWerner Koch2015-03-151-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | * scd/apdu.c (control_pcsc_direct): Take care of BUFLEN being NULL. (control_pcsc_wrapped): Ditto. -- pcsc_vendor_specific_init calls the above with BUFFER and BUFLEN as NULL. Reported by Stack 0.3: bug: anti-dce model: | control_pcsc.exit77: %retval.0.i.i76 = phi i32 [ %rc.0.i.i.i73, \ %pcsc_error_to_sw.exit.i.i74 ], [ 0, %if.end.i.i75 ] %tobool198 = icmp ne i32 %retval.0.i.i76, 0, !dbg !728 br i1 %tobool198, label %if.then199, label %if.end200, !dbg !728 stack: - /home/wk/s/gnupg/scd/apdu.c:1882:0 ncore: 1 core: - /home/wk/s/gnupg/scd/apdu.c:1309:0 - buffer overflow
* scd: fix for 64-bit arch.NIIBE Yutaka2015-03-091-3/+3
| | | | | | | | | | * agent/pksign.c (agent_pksign_do): Use int. * scd/app-openpgp.c (get_public_key): Likewise. -- On 64-bit architecture, int and size_t might be different. For the first argument for '%b', int is expected.
* scd: Fix regression in 2.1.2 (due to commit 2183683)Werner Koch2015-02-121-2/+2
| | | | | | | | * scd/apdu.c (pcsc_vendor_specific_init): Replace use of bufNN_to_uint by direct code. -- Hey, that was little endian.
* Use inline functions to convert buffer data to scalars.Werner Koch2015-02-114-26/+22
| | | | | | | | | | | | | | | * 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]>
* Add a hook to be called right after main.Werner Koch2015-01-281-0/+1
| | | | | | * common/init.c (early_system_init): New stub function. Signed-off-by: Werner Koch <[email protected]>
* scd: Fix varargs call for 64-bit arch on ECC keys.NIIBE Yutaka2015-01-281-14/+12
| | | | | | | | | | | | | * scd/app-openpgp.c (store_fpr): Remove CARD_VERSION from the arguments. (rsa_writekey): Follow the change. (do_genkey): Likewise. (ecc_writekey): Likewise. Cast to size_t. -- KEYTOCARD caused SEGV of scdaemon on 64-bit arch. That's because int is 32-bit, but size_t is 64-bit.
* 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: Allow for certificates > 1024 with PC/SC.Andreas Schwier2015-01-131-1/+1
| | | | | | | | | | * scd/pcsc-wrapper.c (handle_transmit): Enlarge buffer to 4096 too allow for larger certificates. -- Cherry-pick from 5798673156a66f4c39e1d34e358b03539194d57c. Forward ported from 2.0.
* scd: fix get_public_key for OpenPGPcard v1.0.Joshua Rogers2015-01-081-1/+1
| | | | | | | | | | | * scd/app-openpgp.c (get_public_key): correctly close 'fp' upon use. -- Inside the get_public_key function, 'fp' was opened using popen, but incorrectly closed using fclose. Debian-Bug-Id: 773474
* scd: fix merge failure.NIIBE Yutaka2015-01-061-2/+0
| | | | | | | | | * scd/apdu.c (pcsc_pinpad_verify): Remove wrong lines inserted by merge. -- Thanks to Joshua Rogers for reviewing and reporting.
* scd: Avoid double-free on error condition in scdDaniel Kahn Gillmor2014-12-221-4/+2
| | | | | | | | | | | | * scd/command.c (cmd_readkey): avoid double-free of cert -- When ksba_cert_new() fails, cert will be double-freed. Debian-Bug-Id: 773471 Original patch changed by wk to do the free only at leave.
* scd: ECDH Support.NIIBE Yutaka2014-12-221-100/+69
| | | | | | | | | | | | | | | | * agent/divert-scd.c (divert_pkdecrypt): Support ECDH. * scd/app-openpgp.c (get_algo_byte, store_fpr): Support ECDH. (send_key_attr): Support ECDH. Fix EdDSA algorithm value. (retrieve_key_material): Initialize fields. (get_public_key, ecc_writekey, do_writekey): Support ECDH. (ecdh_writekey): Remove. (do_decipher): Support ECDH. (parse_algorithm_attribute): Support ECDH. Fix EdDSA. -- Following the gpg-agent protocol, SCDaemon's counter part is now implemented.
* gpg: Add sub-command "factory-reset" to --card-edit.Werner Koch2014-12-155-8/+10
| | | | | | | | | | | | | | | | | | * 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: Fix possibly inhibited checkpin of the admin pin.Werner Koch2014-12-121-1/+1
| | | | | | | * scd/app-openpgp.c (do_check_pin): Do not check a byte of a released buffer. Signed-off-by: Werner Koch <[email protected]>
* scd: Fix for EdDSA.NIIBE Yutaka2014-12-081-3/+5
| | | | | * scd/app-openpgp.c (get_algo_byte): It catches 22. (store_fpr): It's MPI usually, but it's opaque bytes for EdDSA.
* scd: Fix for NIST P-256.NIIBE Yutaka2014-12-051-6/+12
| | | | | | * g10/card-util.c (card_store_subkey): Error check. * scd/app-opengpg.c (ecc_writekey): Support NIST P-256. (do_writekey): Error check.
* scd: Implement socket redirection.Werner Koch2014-12-011-25/+67
| | | | | | | | | | | | * scd/scdaemon.c (ENAMETOOLONG): New. (redir_socket_name): New. (cleanup): Take care of a redirected socket. (main): Pass redir_socket_name to create_server_socket. (create_socket_name): Remove superfluous length check. (create_server_socket): Add arg r_redir_name and implement redirection. Replace assert for older Assuan by an error message. Signed-off-by: Werner Koch <[email protected]>
* Remove use of gnulib (part 1)Werner Koch2014-11-112-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gl/: Remove entire tree. * configure.ac: Remove gnulib tests and the gl/ Makefile. (setenv): Add to AC_CHECK_FUNCS. * autogen.rc (extra_aclocal_flags): Set to empty. * Makefile.am (ACLOCAL_AMFLAGS): Remove -I gl/m4 (SUBDIRS): Remove gl/. * agent/Makefile.am (common_libs): Remove ../gl/gnulib.a * common/Makefile.am (t_common_ldadd): Ditto. * dirmngr/Makefile.am (dirmngr_LDADD): Ditto. (dirmngr_ldap_LDADD, dirmngr_client_LDADD): Ditto. * g10/Makefile.am (needed_libs): Ditto. * g13/Makefile.am (g13_LDADD): Ditto. * kbx/Makefile.am (kbxutil_LDADD): Ditto. ($(PROGRAMS)): Ditto. * scd/Makefile.am (scdaemon_LDADD): Ditto. * sm/Makefile.am (common_libs): Ditto. * tools/Makefile.am (common_libs, commonpth_libs): Ditto. * agent/gpg-agent.c: Remove "mkdtemp.h" * g10/exec.c: Ditto. * scd/scdaemon.c: Ditto. * tools/symcryptrun.c: Ditto. * common/sysutils.c: Remove "setenv.h" * common/t-timestuff.c: Use putenv if setenv is not available. -- gnulib has always been a cause of trouble in GnuPG because we used only a very few functions and the complex include machinery of gnulib is quite complex and the cause for many build problems for example on OS X. This is not gnulib's fault but due to our limited use of gnulib and that we only rarely update the gnulib code to avoid regressions. In part two we will address the functions mkdtemp setenv unsetenv strpbrk which may bot be implemented on all platforms. They are not required on a libc based system. Signed-off-by: Werner Koch <[email protected]>
* Change a couple of files to use abbreviated copyright notes.Werner Koch2014-11-041-2/+2
| | | | | | | | | -- Also fixed some of my own copyright notices due to the termination of my assignment. The one displayed by --version is kept at FSF because we had contributors in 2014 with FSF assignments and it gives the FSF some visibility.
* Use a unique capitalization for "Note:".Werner Koch2014-10-101-2/+2
| | | | --
* Remove support for the GPG_AGENT_INFO envvar.Werner Koch2014-10-031-64/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (opt): Remove field use_standard_socket. * agent/command.c (cmd_killagent): Always allow killing. * agent/gpg-agent.c (main): Turn --{no,}use-standard-socket and --write-env-file into dummy options. Always return true for --use-standard-socket-p. Do not print the GPG_AGENT_INFO envvar setting or set that envvar. (create_socket_name): Simplify by removing non standard socket support. (check_for_running_agent): Ditto. * common/asshelp.c (start_new_gpg_agent): Remove GPG_AGENT_INFO use. * common/simple-pwquery.c (agent_open): Ditto. * configure.ac (GPG_AGENT_INFO_NAME): Remove. * g10/server.c (gpg_server): Do not print the AgentInfo comment. * g13/server.c (g13_server): Ditto. * sm/server.c (gpgsm_server): Ditto. * tools/gpgconf.c (main): Simplify by removing non standard socket support. -- The indented fix to allow using a different socket than the one in the gnupg home directory is to change Libassuan to check whether the socket files exists as a regualr file with a special keyword to redirect to another socket file name.
* scd: Fix int/short mismatch in format string of app-p15.cWerner Koch2014-09-181-4/+8
| | | | | | | * scd/app-p15.c (parse_certid): Use snprintf and cast value. (send_certinfo): Ditto. (send_keypairinfo): Ditto. (do_getattr): Ditto.
* Switch to the libgpg-error provided estream.Werner Koch2014-08-264-11/+10
| | | | | | | | | | * configure.ac (NEED_GPG_ERROR_VERSION): Reguire 1.14. (GPGRT_ENABLE_ES_MACROS): Define. (estream_INIT): Remove. * m4/estream.m4: Remove. * common/estream-printf.c, common/estream-printf.h: Remove. * common/estream.c, common/estream.h: Remove. * common/init.c (_init_common_subsystems): Call gpgrt initialization.