summaryrefslogtreecommitdiffstats
path: root/agent (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Remove support for the GPG_AGENT_INFO envvar.Werner Koch2014-10-033-188/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* agent: Init a local variable in the error case.Werner Koch2014-09-181-1/+3
| | | | * agent/pksign.c (do_encode_md): Init HASH on error.
* agent: Remove left over debug output.Werner Koch2014-09-181-2/+0
| | | | | * agent/command-ssh.c (ssh_signature_encoder_eddsa): Remove debug output.
* agent: Silence compiler warning for a debug message.Werner Koch2014-09-181-2/+2
| | | | | * agent/call-pinentry.c (agent_query_dump_state): Use %p for POPUP_TID.
* gpg: Improve passphrase caching.Werner Koch2014-09-173-1/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/cache.c (last_stored_cache_key): New. (agent_get_cache): Allow NULL for KEY. (agent_store_cache_hit): New. * agent/findkey.c (unprotect): Call new function and try to use the last stored key. * g10/revoke.c (create_revocation): Add arg CACHE_NONCE and pass to make_keysig_packet. (gen_standard_revoke): Add arg CACHE_NONCE and pass to create_revocation. * g10/keygen.c (do_generate_keypair): Call gen_standard_revoke with cache nonce. -- This patch adds two features: 1. The key for the last passphrase successfully used for unprotecting a key is stored away. On a cache miss the stored away passphrase is tried as well. This helps for the common GPG use case of having a signing and encryption (sub)key with the same passphrase. See the code for more comments. 2. The now auto-generated revocation certificate does not anymore popup a passphrase prompt. Thus for standard key generation the passphrase needs to be given only once (well, two with the confirmation).
* agent: Fix import of OpenPGP EdDSA keys.Werner Koch2014-09-021-18/+66
| | | | | | | | | | | | | | | | | | | | * agent/cvt-openpgp.c (get_keygrip): Special case EdDSA. (convert_secret_key): Ditto. (convert_transfer_key): Ditto. (apply_protection): Handle opaque MPIs. (do_unprotect): Check FLAG_OPAQUE instead of FLAG_USER1 before unpacking an opaque mpi. -- The key transfer protocol between gpg and gpg-agent uses gcrypt algorithm numbers which merge all ECC algorithms into one. Thus it is not possible to use the algorithm number to determine the EdDSA algorithm. We need to known that because Libgcrypt requires the "eddsa" flag with the curve "Ed25519" to actually use the Ed25519 signature specification. The last fix is for correctness; the first case won't be used anyway.
* agent: Allow key unprotection using AES-256.Werner Koch2014-09-011-29/+50
| | | | | | | | | | | | | | * agent/protect.c (PROT_CIPHER): Rename to GCRY_CIPHER_AES128 for clarity. (do_decryption): Add args prot_cipher and prot_cipher_keylen. USe them instead of the hardwired values. (agent_unprotect): Change to use a table of protection algorithms. Add AES-256 variant. -- This patch will make a possible future key protection algorithm changes smoother. AES-256 is also allowed although there is currently no way to encrypt using it.
* agent: Return NO_SECKEY instead of ENONET for PKSIGN and others.Werner Koch2014-08-183-5/+8
| | | | | | * agent/pksign.c (agent_pksign_do): Replace ENONET by NO_SECKEY. * agent/findkey.c (agent_key_from_file): No diagnostic for NO_SECKEY. * agent/pkdecrypt.c (agent_pkdecrypt): Replace checking for ENOENT.
* agent: Show just one warning with all failed passphrase constraints.Werner Koch2014-07-231-38/+74
| | | | | * agent/genkey.c (check_passphrase_constraints): Build a final warning after all checks.
* agent: Only one confirmation prompt for an empty passphrase.Werner Koch2014-07-231-21/+19
| | | | | * agent/genkey.c (check_passphrase_constraints): Moev empty passphrase check to the front.
* gpg: Spelling errorKristian Fiskerstrand2014-07-031-1/+1
|
* agent: Adjust for changed npth_eselect under W32.Werner Koch2014-06-271-2/+1
| | | | | * agent/gpg-agent.c (handle_connections) [W32]: Make events_set an unsigned int to match the changed prototype.
* Fix typos in messagesYuri Chornoivan2014-06-271-1/+1
|
* agent: Fix export of RSA keys to OpenPGP.Werner Koch2014-06-261-1/+1
| | | | | * agent/cvt-openpgp.c (convert_transfer_key): Fix sexp build format string.
* gpg: Make export of ECC keys work again.Werner Koch2014-06-201-9/+28
| | | | | | | | * agent/cvt-openpgp.c (convert_to_openpgp): Use the curve name instead of the curve parameters. * g10/export.c (canon_pubkey_algo): Rename to ... (canon_pk_algo): this. Support ECC. (transfer_format_to_openpgp): Expect curve name.
* agent: Fix import of non-protected gpg keys.Werner Koch2014-05-081-3/+9
| | | | | | | * agent/cvt-openpgp.c (do_unprotect): Return an s-exp also for non-protected keys. (convert_from_openpgp_main): Do not call agent_askpin for a non-protected key.
* Make more use of *_NAME macros.Werner Koch2014-05-081-4/+7
| | | | | | | | | * configure.ac (GPG_DISP_NAME, GPGSM_DISP_NAME): New. (GPG_AGENT_DISP_NAME, SCDAEMON_DISP_NAME): New. (DIRMNGR_DISP_NAME, G13_DISP_NAME): New. (GPGCONF_DISP_NAME): New. (SCDAEMON_SOCK_NAME): New. * common/argparse.c (show_help): Map description string.
* agent: Fix auth key comment handling.NIIBE Yutaka2014-05-081-1/+3
| | | | | * agent/command-ssh.c (ssh_send_key_public): Handle the case with no comment.
* gpg: Finish experimental support for Ed25519.Werner Koch2014-05-072-84/+102
| | | | | | | | | | | | | | | | | | | | | | | | * agent/cvt-openpgp.c (try_do_unprotect_arg_s): Add field "curve". (get_keygrip): Add and use arg CURVE. (convert_secret_key): Ditto. (convert_transfer_key): Ditto. (get_npkey_nskey): New. (prepare_unprotect): Replace gcrypt functions by get_npkey_nskey. Allow opaque MPIs. (do_unprotect): Use CURVE instead of parameters. (convert_from_openpgp_main): Ditto. (convert_to_openpgp): Simplify. * g10/import.c (one_mpi_from_pkey): Remove. (transfer_secret_keys): Rewrite to use the curve instead of the parameters. * g10/parse-packet.c (parse_key): Mark protected MPIs with USER1 flag. * common/openpgp-oid.c (openpgp_curve_to_oid): Allow the use of "NIST P-256" et al. * g10/keygen.c (ask_curve): Add arg ALGO. (generate_keypair): Rewrite the ECC key logic. * tests/openpgp/ecc.test: Provide the "ecc" passphrase.
* agent: Remove greeting message.Werner Koch2014-05-071-18/+1
| | | | | * agent/gpg-agent.c (main): Remove greeting. Make --no-greeting a dummy.
* ECC Fixes.NIIBE Yutaka2014-04-282-38/+8
| | | | | | | | | | | | | * agent/cvt-openpgp.c (get_keygrip, convert_secret_key) (convert_transfer_key): Follow newer (>= 1.6) libgcrypt API, which does not distinguish the detail. (do_unprotect, convert_from_openpgp_main): Don't call map_pk_openpgp_to_gcry, as it's the value of libgcrypt API already and not the value defined by OpenPGP. (convert_to_openpgp): It's "ecc". * agent/gpg-agent.c (map_pk_openpgp_to_gcry): Remove. * g10/call-agent.c (agent_pkdecrypt): Fix off-by-one error. * g10/pubkey-enc.c (get_it): Fix swapping the fields error.
* gpg: Pass --homedir to gpg-agent.Werner Koch2014-04-221-0/+4
| | | | | | | | | | | | | | | * agent/gpg-agent.c (main): Make sure homedir is absolute. * common/asshelp.c (lock_spawning): Create lock file with an absolute name. (start_new_gpg_agent): Use an absolute name for the socket and pass option --homedir to the agent. (start_new_dirmngr): Use an absolute name for the --homedir. -- This patch makes gpg's --homedir option behave again like in older versions. This is done by starting a new agent for each different home directory. Note that this assumes --use-standard-socket is used which is the default for 2.1.
* gpg: Fix regression in secret key export.Werner Koch2014-04-152-22/+28
| | | | | | | | | | * agent/cvt-openpgp.c (convert_to_openpgp): Fix use gcry_sexp_extract_param. * g10/export.c (do_export_stream): Provide a proper prompt to the agent. -- NB: The export needs more work, in particular the ECC algorithms.
* agent: Add command DELETE_KEY.Werner Koch2014-04-154-3/+184
| | | | | | | | | | | * agent/command.c (cmd_delete_key): New. * agent/findkey.c (modify_description): Add '%C' feature. (remove_key_file): New. (agent_delete_key): New. * agent/command-ssh.c (search_control_file): Make arg R_DISABLE optional. * configure.ac: Require libgpg-error 1.13.
* agent: Support EdDSA.NIIBE Yutaka2014-04-081-5/+16
| | | | * agent/pksign.c (agent_pksign_do): Handle EdDSA signature.
* agent: EdDSA support for SSH.NIIBE Yutaka2014-04-041-23/+7
| | | | | * agent/command-ssh.c (ssh_signature_encoder_eddsa): Signature is two 32-byte opaque data which should not be interpreted as number.
* agent: Replace es_mopen by es_fopenmem for ssh.Werner Koch2014-03-231-27/+15
| | | | | | | | | | | * agent/command-ssh.c (ssh_read_key_public_from_blob): Use es_fopenmem. (ssh_handler_request_identities): Ditto. (ssh_request_process): Ditto. -- es_fopenmem is easier to understand than the more general function es_mopen. Thus we better use the former for clarity.
* agent: Put ssh key type as comment into sshcontrol.Werner Koch2014-03-221-13/+20
| | | | | | | | * agent/command-ssh.c (ssh_key_type_spec): Add field name. (ssh_key_types): Add human readable names. (add_control_entry): Add arg SPEC and print key type as comment. (ssh_identity_register): Add arg SPEC. (ssh_handler_add_identity): Add var SPEC and pass ssh_receive_key.
* agent: Support the Ed25519 signature algorithm for ssh.Werner Koch2014-03-221-521/+761
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/command-ssh.c (SPEC_FLAG_IS_EdDSA): New. (ssh_key_types): Add entry for ssh-ed25519. (ssh_identifier_from_curve_name): Move to the top. (stream_read_skip): New. (stream_read_blob): New. (ssh_signature_encoder_rsa): Replace MPIS array by an s-exp and move the s-exp parsing to here. (ssh_signature_encoder_dsa): Ditto. (ssh_signature_encoder_ecdsa): Ditto. (ssh_signature_encoder_eddsa): New. (sexp_key_construct): Rewrite. (ssh_key_extract): Rename to ... (ssh_key_to_blob): .. this and rewrite most of it. (ssh_receive_key): Add case for EdDSA. (ssh_convert_key_to_blob, key_secret_to_public): Remove. (ssh_send_key_public): Rewrite. (ssh_handler_request_identities): Simplify. (data_sign): Add rename args. Add new args HASH and HASHLEN. Make use of es_fopenmen and es_fclose_snatch. Remove parsing into MPIs which is now doe in the sgnature encoder functions. (ssh_handler_sign_request): Take care of Ed25519. (ssh_key_extract_comment): Rewrite using gcry_sexp_nth_string. -- To make the code easier readable most of the Ed25591 work has been done using a new explicit code path. Warning: Libgcrypt 1.6.1 uses a non optimized implementation for Ed25519 and timing attacks might be possible. While working on the code I realized that it could need more rework; it is at some places quite baroque and more complicated than needed. Given that we require Libgcrypt 1.6 anyway, we should make more use of modern Libgcrypt functions.
* agent: Cleanups to prepare implementation of Ed25519.Werner Koch2014-03-226-80/+136
| | | | | | | | | | | | * agent/cvt-openpgp.c: Remove. (convert_to_openpgp): Use gcry_sexp_extract_param. * agent/findkey.c (is_eddsa): New. (agent_is_dsa_key, agent_is_eddsa_key): Check whether ecc means EdDSA. * agent/pksign.c (agent_pksign_do): Add args OVERRIDEDATA and OVERRIDEDATALEN. * common/ssh-utils.c (is_eddsa): New. (get_fingerprint): Take care or EdDSA.
* agent: API change of agent_key_from_file.NIIBE Yutaka2014-03-114-35/+30
| | | | | | | | | | | | * agent/findkey.c (agent_key_from_file): Always return S-expression. * agent/command.c (cmd_passwd): Distinguish by SHADOW_INFO. (cmd_export_key): Likewise. Free SHADOW_INFO. (cmd_keytocard): Likewise. Release S_SKEY. * agent/pkdecrypt.c (agent_pkdecrypt): Likewise. * agent/pksign.c (agent_pksign_do): Likewise. Use the S-expression to know the key type. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* w32: Silence warnings about unused vars.Werner Koch2014-03-071-0/+3
| | | | | | | | | | | | * agent/gpg-agent.c (main) [W32]: Mark unused vars. * sm/gpgsm.c (run_protect_tool) [W32]: Ditto. * g10/trustdb.c (check_regexp) [DISABLE_REGEX]: Ditto. * scd/scdaemon.c (main) [W32]: Ditto. (handle_connections) [W32]: Ditto. (handle_signal) [W32]: Do not build the function at all. * scd/apdu.c (pcsc_send_apdu_direct): Ditto. (connect_pcsc_card): s/long/pcsc_dword_t/. (open_pcsc_reader_direct): Remove var listlen.
* Silence several warnings when building under Windows.Werner Koch2014-03-072-4/+4
| | | | | | | | | | | | | | | | | | | | | | | * agent/call-scd.c (start_scd): Replace int by assuan_fd_t. (start_pinentry): Ditto. * common/asshelp.c (start_new_gpg_agent): Replace int by assuan_fd_t. * common/dotlock.c (GNUPG_MAJOR_VERSION): Include stringhelp.h for prototypes on Windows and some other platforms. * common/logging.c (fun_writer): Declare addrbuf only if needed. * g10/decrypt.c (decrypt_message_fd) [W32]: Return not_implemented. * g10/encrypt.c (encrypt_crypt) [W32]: Return error if used in server mode. * g10/dearmor.c (dearmor_file, enarmor_file): Replace GNUPG_INVALID_FD by -1 as temporary hack for Windows. * g10/export.c (do_export): Ditto. * g10/revoke.c (gen_desig_revoke, gen_revoke): Ditto. * g10/sign.c (sign_file, clearsign_file, sign_symencrypt_file): Ditto. * g10/server.c (cmd_verify, gpg_server) [W32]: Return an error. -- The gpg server mode is not actual working and thus we can avoid the warnings by explicitly disabling the mode. We keep it working under Unix, though.
* w32: Include winsock2.h to silence warnings.Werner Koch2014-03-072-1/+7
|
* agent: Fix UPDATESTARTUPTTY for ssh.Werner Koch2014-03-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/command-ssh.c (setup_ssh_env): Fix env setting. -- gniibe reported this to gnupg-devel on 2012-07-04: [...] (2) UPDATESTARTUPTTY doesn't work to switch TTY for pinentry for SSH. [...] Current implementation: In the function start_command_handler_ssh, the logic puts priority on ctrl->session_env which is initialized by agent_init_default_ctrl. There are always GPG_TTY and TERM defined, because lines around 968 in gpg-agent.c, it says: /* Make sure that we have a default ttyname. */ While UPDATESTARTUPTTY updates opt.startup_env, it doesn't affect at all. Here is a patch to point the issue. Tested and works for me. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 9f5578c29adba6d4f7d3650121d07322c2f8d254)
* agent: Make --allow-mark-trusted the default.Werner Koch2014-03-072-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (opts, main): Add option --no-allow-mark-trusted. Put this option into the gpgconf-list. (main): Enable opt.allow_mark_trusted by default. * tools/gpgconf-comp.c (gc_options_gpg_agent): Replace allow-mark-trusted by no-allow-mark-trusted. * agent/trustlist.c (agent_marktrusted): Always set the "relax" flag. -- These changes have been in effect for the Gpg4win Windows version since 2011-01-24 and thus first released with Gpg4win 2.1.0. Given the current state of PKIX it does not make any sense to lure the Unix user into false security by making it harder to trust self-signed or CAcert certificates. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 90b419f3e9d05e509348d047e05fcc79e87be6cf) Resolved conflicts: NEWS agent/gpg-agent.c
* ssh: Add support for Putty.Werner Koch2014-03-073-6/+405
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/gpg-agent.c [W32]: Include Several Windows header. (opts): Change help text for enable-ssh-support. (opts, main): Add option --enable-putty-support (putty_support, PUTTY_IPC_MAGIC, PUTTY_IPC_MAXLEN): New for W32. (agent_init_default_ctrl): Add and asssert call. (putty_message_proc, putty_message_thread): New. (handle_connections) [W32]: Start putty message thread. * common/sysutils.c (w32_get_user_sid): New for W32 only * tools/gpgconf-comp.c (gc_options_gpg_agent): Add --enable-ssh-support and --enable-putty-support. Make the configuration group visible at basic level. * agent/command-ssh.c (serve_mmapped_ssh_request): New for W32 only. -- This patch enables support for Putty. It has been tested with Putty 0.62 using an Unix created ssh key copied to the private-keys-v1.d directory on Windows and with a manually crafted sshcontrol file. It also works with a smartcard key. May thanks to gniibe who implemented a proxy in Python to test the putty/gpg-agent communication. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 9f32499f99a0817f63f7a73b09bdcebe60d4775d) Resolved conflicts: NEWS agent/agent.h agent/gpg-agent.c: Convert from pth to npth. common/sysutils.c common/sysutils.h
* agent: Fix binary vs. text mode problem in ssh.Werner Koch2014-03-071-32/+39
| | | | | | | | | | | | | | | | | | * agent/command-ssh.c (file_to_buffer) (ssh_handler_request_identities): Open streams in binary mode. (start_command_handler_ssh): Factor some code out to .. (setup_ssh_env): new function. -- This is for now a theoretical fix because there is no ssh client yet which uses the GnuPG style IPC. OpenSSL for Cygwin uses only a quite similar one. gniibe suggested to implement that IPC style in Libassuan so that a Cygwin version of OpenSSL may be used with GnuPG. Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit ed056d67c7c93306b68829f83a2565e978dcfd9b) Also fixed one typo.
* agent: Fixed unresolved symbol under Windows.Werner Koch2014-02-261-1/+1
| | | | | | | | | * agent/gpg-agent.c (main): s/ttyname/gnupg_ttyname/. -- This was not triggered by the latest mingw runtime but that has other problems and thus I reverted to the same we used for gpg4win 2.1 which is Debian Wheezy.
* gpg: Use only OpenPGP public key algo ids and add the EdDSA algo id.Werner Koch2014-01-301-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/sexputil.c (get_pk_algo_from_canon_sexp): Change to return a string. * g10/keygen.c (check_keygrip): Adjust for change. * sm/certreqgen-ui.c (check_keygrip): Likewise. * agent/pksign.c (do_encode_dsa): Remove bogus map_pk_openpgp_to_gcry. * g10/misc.c (map_pk_openpgp_to_gcry): Remove. (openpgp_pk_test_algo): Change to a wrapper for openpgp_pk_test_algo2. (openpgp_pk_test_algo2): Rewrite. (openpgp_pk_algo_usage, pubkey_nbits): Add support for EdDSA. (openpgp_pk_algo_name): Rewrite to remove need for gcry calls. (pubkey_get_npkey, pubkey_get_nskey): Ditto. (pubkey_get_nsig, pubkey_get_nenc): Ditto. * g10/keygen.c(do_create_from_keygrip): Support EdDSA. (common_gen, gen_ecc, ask_keysize, generate_keypair): Ditto. * g10/build-packet.c (do_key): Ditto. * g10/export.c (transfer_format_to_openpgp): Ditto. * g10/getkey.c (cache_public_key): Ditto. * g10/import.c (transfer_secret_keys): Ditto. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Ditto. * g10/mainproc.c (proc_pubkey_enc): Ditto. * g10/parse-packet.c (parse_key): Ditto, * g10/sign.c (hash_for, sign_file, make_keysig_packet): Ditto. * g10/keyserver.c (print_keyrec): Use openpgp_pk_algo_name. * g10/pkglue.c (pk_verify, pk_encrypt, pk_check_secret_key): Use only OpenPGP algo ids and support EdDSA. * g10/pubkey-enc.c (get_it): Use only OpenPGP algo ids. * g10/seskey.c (encode_md_value): Ditto. -- This patch separates Libgcrypt and OpenPGP public key algorithms ids and in most cases completely removes the Libgcrypt ones. This is useful because for Libgcrypt we specify the algorithm in the S-expressions and the public key ids are not anymore needed. This patch also adds some support for PUBKEY_ALGO_EDDSA which will eventually be used instead of merging EdDSA with ECDSA. As of now an experimental algorithm id is used but the plan is to write an I-D so that we can get a new id from the IETF. Note that EdDSA (Ed25519) does not yet work and that more changes are required. The ECC support is still broken right now. Needs to be fixed. Signed-off-by: Werner Koch <wk@gnupg.org>
* gpg: Remove cipher.h and put algo ids into a common file.Werner Koch2014-01-291-1/+1
| | | | | | | | | | | | | | | | | | * common/openpgpdefs.h (cipher_algo_t, pubkey_algo_t, digest_algo_t) (compress_algo_t): New. * agent/gpg-agent.c: Remove ../g10/cipher.h. Add openpgpdefs.h. * g10/cipher.h (DEK): Move to ... * g10/dek.h: new file. * g10/cipher.h (is_RSA, is_ELGAMAL, is_DSA) (PUBKEY_MAX_NPKEY, PUBKEY_MAX_NSKEY, PUBKEY_MAX_NSIG, PUBKEY_MAX_NENC) (PUBKEY_USAGE_SIG, PUBKEY_USAGE_ENC, PUBKEY_USAGE_CERT) (PUBKEY_USAGE_AUTH, PUBKEY_USAGE_NONE): Move to * g10/packet.h: here. * g10/cipher.h: Remove. Remove from all files. * g10/filter.h, g10/packet.h: Include dek.h. * g10/Makefile.am (common_source): Remove cipher.h. Add dek.h. Signed-off-by: Werner Koch <wk@gnupg.org>
* include: Remove this directory.Werner Koch2014-01-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/cipher.h: Move to ... * g10/cipher.h: here. * agent/gpg-agent.c: Adjust header file name. * include/host2net.h: Move to ... * common/host2net.h: here. Change license to LGPLv3/GPLv2. Adjust notices to reflect that only me worked on that file. * include/types.h: Remove. * common/types.h: Include inttypes.h. Add byte typedef and comments for __riscos__. * common/iobuf.h: Adjust header file name. * include/_regex.h: Remove this unused file. * include/Makefile.am: Remove. * Makefile.am (SUBDIRS): Remove "include". * configure.ac (AC_CONFIG_FILES): Remove include/Makefile. * include/ChangeLog-2011: Move to ... * common/ChangeLog-2011.include: here. * common/Makefile.am (EXTRA_DIST): Add file. * include/zlib-riscos.h: Move this repo only file to ... * g10/zlib-riscos.h: here. * include/: Remove. -- include/ was a leftover from GnuPG 1.x times. Signed-off-by: Werner Koch <wk@gnupg.org>
* agent: Not remove SSH socket when already running.NIIBE Yutaka2014-01-161-4/+5
| | | | | | | | * agent/gpg-agent.c (main): Defer setting of socket_name_ssh to avoid removal of the socket when it will die in create_server_socket for socket_name. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* agent: Fix agent_is_eddsa_key.NIIBE Yutaka2014-01-161-7/+3
| | | | | | * agent/findkey.c (agent_is_eddsa_key): Implemented. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
* Make use of the *_NAME etc macros.Werner Koch2013-11-185-23/+31
| | | | | | | | | Replace hardwired strings at many places with new macros from config.h and use the new strusage macro replacement feature. * common/asshelp.c (lock_spawning) [W32]: Change the names of the spawn sentinels. * agent/command.c (cmd_import_key): Use asprintf to create the prompt.
* gpg: Rework ECC support and add experimental support for Ed25519.Werner Koch2013-11-154-9/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/findkey.c (key_parms_from_sexp): Add algo name "ecc". (agent_is_dsa_key): Ditto. (agent_is_eddsa_key): New. Not finished, though. * agent/pksign.c (do_encode_eddsa): New. (agent_pksign_do): Use gcry_log_debug functions. * agent/protect.c (agent_protect): Parse a flags parameter. * g10/keygen.c (gpg_curve_to_oid): Move to ... * common/openpgp-oid.c (openpgp_curve_to_oid): here and rename. (oid_ed25519): New. (openpgp_oid_is_ed25519): New. (openpgp_oid_to_curve): New. * common/t-openpgp-oid.c (test_openpgp_oid_is_ed25519): New. * g10/build-packet.c (gpg_mpi_write): Write the length header also for opaque MPIs. (gpg_mpi_write_nohdr): New. (do_key): Use gpg_mpi_write_nohdr depending on algorithm. (do_pubkey_enc): Ditto. * g10/ecdh.c (pk_ecdh_encrypt_with_shared_point): Use gpg_mpi_write_nohdr. * g10/export.c (transfer_format_to_openpgp): * g10/keygen.c (ecckey_from_sexp): Return the error. (gen_ecc): Repalce arg NBITS by CURVE. (read_parameter_file): Add keywords "Key-Curve" and "Subkey-Curve". (ask_curve): New. (generate_keypair, generate_subkeypair): Use ask_curve. (do_generate_keypair): Also pass curve name. * g10/keylist.c (list_keyblock_print, list_keyblock_colon): Print curve name. * g10/parse-packet.c (mpi_read): Remove workaround for Libcgrypt < 1.5. (parse_key): Fix ECC case. Print the curve name. * g10/pkglue.c (mpi_from_sexp): Rename to get_mpi_from_sexp. (pk_verify, pk_check_secret_key): Add special case for Ed25519. * g10/seskey.c (encode_md_value): Ditto. * g10/sign.c (do_sign, hash_for, sign_file): Ditto. -- Be warned that this code is subject to further changes and that the format will very likely change before a release. There are also known bugs and missing code. Signed-off-by: Werner Koch <wk@gnupg.org>
* Require Libgcrypt 1.6Werner Koch2013-11-151-26/+5
| | | | | | | | | | * agent/pksign.c (do_encode_dsa): Remove Libgcrypt version check -- Now that we have decided on a release plan for Libgcrypt 1.6 and given all the improvements it makes more sense to make use of these improvements than to clutter the GnuPG code with workarounds for older Libgcrypt versions.
* Switch to deterministic DSA.Werner Koch2013-09-081-5/+35
| | | | | | | | | | | | | | | | | | * agent/pksign.c (rfc6979_hash_algo_string): New. (do_encode_dsa) [Libgcrypt >= 1.6]: Make use of RFC-6979. -- Now that we have a good (and not NSA/NIST demanded ;-) specification on how to use DSA without a random nonce, we take advantage of it and thus avoid pitfalls related to a misbehaving RNG during signature creation. Note that OpenPGP has the option of using a longer hash algorithm but truncated to what is suitable for the used DSA key size. The hash used as input to RFC-6979 will also be one with an appropriate digest length but not a truncated one. This is allowed by RFC-6979. Signed-off-by: Werner Koch <wk@gnupg.org>
* Fix commit 04e2c83f.Werner Koch2013-08-281-1/+2
| | | | | * agent/command-ssh.c (stream_read_string): Do not assign to a NULL ptr.
* gpg: Make decryption with the OpenPGP card work.Werner Koch2013-08-285-14/+53
| | | | | | | | | | | | | | | | | | | | | | | | * scd/app-common.h (APP_DECIPHER_INFO_NOPAD): New. * scd/app-openpgp.c (do_decipher): Add arg R_INFO. * scd/app-nks.c (do_decipher): Add arg R_INFO as a dummy. * scd/app.c (app_decipher): Add arg R_INFO. * scd/command.c (cmd_pkdecrypt): Print status line "PADDING". * agent/call-scd.c (padding_info_cb): New. (agent_card_pkdecrypt): Add arg R_PADDING. * agent/divert-scd.c (divert_pkdecrypt): Ditto. * agent/pkdecrypt.c (agent_pkdecrypt): Ditto. * agent/command.c (cmd_pkdecrypt): Print status line "PADDING". * g10/call-agent.c (padding_info_cb): New. (agent_pkdecrypt): Add arg R_PADDING. * g10/pubkey-enc.c (get_it): Use padding info. -- Decryption using a card never worked in gpg 2.1 because the information whether the pkcs#1 padding needs to be removed was not available. Gpg < 2.1 too this info from the secret sub key but that has gone in 2.1. Signed-off-by: Werner Koch <wk@gnupg.org>