aboutsummaryrefslogtreecommitdiffstats
path: root/agent/genkey.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use gpgrt_process_spawn API from libgpg-error.NIIBE Yutaka2024-07-091-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/genkey.c (do_check_passphrase_pattern): Use the gpgrt API. * common/asshelp.c (start_new_service): Ditto. * common/exechelp.h: Remove gnupg_process_spawn API. * common/exechelp-posix.c: Remove gnupg_process_spawn implementation. * common/exechelp-w32.c: Likewise. * common/exectool.c (gnupg_exec_tool_stream): Use the gpgrt API. * common/t-exechelp.c (test_pipe_stream): Remove. * dirmngr/ldap-wrapper.c (destroy_wrapper, ldap_reaper_thread): Use the gpgrt API. (ldap_wrapper_connection_cleanup, ldap_wrapper): Ditto. * dirmngr/ldap.c, g10/call-keyboxd.c: No need to include exechelp.h. * g10/photoid.c (run_with_pipe, show_photo): Use the gpgrt API. * g13/be-encfs.c (run_umount_helper, run_encfs_tool): Ditto. * g13/g13.c, g13/mount.c, g13/runner.c: No need to include exechelp.h. * scd/apdu.c: No need to include exechelp.h. * scd/app.c (report_change): Use the gpgrt API. * sm/export.c, sm/import.c: No need to include exechelp.h. * tests/gpgscm/ffi.c (proc_object_finalize, proc_wrap) (do_process_spawn_io, do_process_spawn_fd, do_process_wait): Use the gpgrt API. * tools/gpg-auth.c: No need to include exechelp.h. * tools/gpg-card.c (cmd_gpg): Use the gpgrt API. * tools/gpg-connect-agent.c: No need to include exechelp.h. * tools/gpg-mail-tube.c (mail_tube_encrypt, prepare_for_appimage) (start_gpg_encrypt): Use the gpgrt API. * tools/gpgconf-comp.c (gpg_agent_runtime_change) (scdaemon_runtime_change, tpm2daemon_runtime_change) (dirmngr_runtime_change, keyboxd_runtime_change) (gc_component_launch, gc_component_check_options) (retrieve_options_from_program): Ditto. * tools/gpgconf.c (show_versions_via_dirmngr): Ditto. * tools/gpgtar-create.c (gpgtar_create): Ditto. * tools/gpgtar-extract.c (gpgtar_extract): Ditto. * tools/gpgtar-list.c (gpgtar_list): Ditto. -- GnuPG-bug-id: 7192 Signed-off-by: NIIBE Yutaka <[email protected]>
* spawn: Remove spawn callback, introduce gnupg_spawn_actions.NIIBE Yutaka2024-05-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/exechelp-posix.c (call_spawn_cb): Remove. (gnupg_spawn_actions_new, gnupg_spawn_actions_release) (gnupg_spawn_actions_set_environ, gnupg_spawn_actions_set_atfork) (gnupg_spawn_actions_set_redirect) (gnupg_spawn_actions_set_inherit_fds): New. (my_exec, spawn_detached): Use spawn actions. (gnupg_spawn_helper): Remove. (gnupg_process_spawn): Remove callback, introduce gnupg_spawn_actions. * common/exechelp-w32.c: Ditto. * common/exechelp.h: Ditto. * agent/genkey.c (do_check_passphrase_pattern): Follow the change of gnupg_process_spawn API. * common/asshelp.c (start_new_service): Likewise. * common/exectool.c (gnupg_exec_tool_stream): Likewise. * common/t-exechelp.c (test_pipe_stream): Likewise. * dirmngr/ldap-wrapper.c (ldap_wrapper): Likewise. * g10/photoid.c (run_with_pipe): Likewise. * scd/app.c (report_change): Likewise. * tests/gpgscm/ffi.c (do_process_spawn_io, do_process_spawn_fd): Likewise. * tools/gpg-card.c (cmd_gpg): Likewise. * tools/gpgconf-comp.c (gpg_agent_runtime_change): Likewise. (scdaemon_runtime_change, tpm2daemon_runtime_change) (dirmngr_runtime_change, keyboxd_runtime_change) (gc_component_launch, gc_component_check_options) (retrieve_options_from_program): Likewise. * tools/gpgconf.c (show_versions_via_dirmngr): Likewise. * tools/gpgtar-create.c (gpgtar_create): Likewise. * tools/gpgtar-extract.c (gpgtar_extract): Likewise. * tools/gpgtar-list.c (gpgtar_list): Likewise. -- Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Make sure to return success in ephemeral store mode.Werner Koch2024-05-281-0/+1
| | | | | | | | | | | | * agent/genkey.c (store_key): Clear ERR on success. -- This fixes a real problem which might let ephemeral store mode fail randomly. This is part of GnuPG-bug-id: 7129 Co-authored-by: Jakub Jelen <[email protected]>
* Merge branch 'STABLE-BRANCH-2-4'Werner Koch2024-01-261-43/+113
|\ | | | | | | | | | | | | | | -- Fixed conflicts: NEWS configure.ac doc/gpg.texi
| * agent: Add "ephemeral" Assuan option.Werner Koch2024-01-221-43/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (struct ephemeral_private_key_s): New. (struct server_control_s): Add ephemeral_mode and ephemeral_keys. (GENKEY_FLAG_NO_PROTECTION, GENKEY_FLAG_PRESET): New. * agent/genkey.c (clear_ephemeral_keys): New. (store_key): Add arg ctrl and implement ephemeral_mode. Change all callers. (agent_genkey): Replace args no_protection and preset by a generic new flags arg. * agent/findkey.c (wipe_and_fclose): New. (agent_write_private_key): Add arg ctrl and implement ephemeral_mode. Change all callers. (agent_update_private_key): Ditto (read_key_file): Ditto. (agent_key_available): Ditto. * agent/command-ssh.c (card_key_available): Do not update display s/n in ephemeral mode. This is however enver triggred. * agent/gpg-agent.c (agent_deinit_default_ctrl): Cleanup ephemeral keys. * agent/command.c (cmd_genkey): Use the new flags instead of separate vars. (cmd_readkey): Create a shadow key only in non-ephemeral_mode. (cmd_getinfo): Add sub-command "ephemeral". (option_handler): Add option "ephemeral". -- The idea here that a session can be switched in an ephemeral mode which does not store or read keys from disk but keeps them local to the session. GnuPG-bug-id: 6944
| * agent: Create and use Token entries to track the display s/n.Werner Koch2023-05-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | * agent/findkey.c (agent_write_private_key): Add arg dispserialno and update the token. (agent_write_shadow_key): Add arg dispserialno and adjust all callers. -- GnuPG-bug-id: 6135 Note that this has been forward ported from 2.2
* | agent: Create and use Token entries to track the display s/n.Werner Koch2023-05-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | * agent/findkey.c (agent_write_private_key): Add arg dispserialno and update the token. (agent_write_shadow_key): Add arg dispserialno and adjust all callers. -- GnuPG-bug-id: 6135 Note that this has been forward ported from 2.2
* | common,agent,gpg,dirmngr,g13,scd,tests,tools: New spawn function.NIIBE Yutaka2023-05-111-5/+13
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * common/exechelp-posix.c (do_exec, gnupg_spawn_process): Remove. (check_syscall_func, pre_syscall, post_syscall) : New. (do_create_socketpair, posix_open_null, call_spawn_cb): New. (my_exec, spawn_detached, gnupg_spawn_helper): New. (gnupg_process_spawn, process_kill, gnupg_process_terminate): New. (gnupg_process_get_fds, gnupg_process_get_streams): New. (process_vctl, gnupg_process_ctl): New. (gnupg_process_wait, gnupg_process_release): New. (gnupg_process_wait_list): New. * common/exechelp-w32.c: Add definition of _WIN32_WINNT as 0x600. (check_syscall_func, pre_syscall, post_syscall): New. (gnupg_spawn_process): Remove. (check_windows_version): New. (spawn_detached, gnupg_spawn_helper, gnupg_process_spawn): New. (gnupg_process_get_fds, gnupg_process_get_streams): New. (process_kill, process_vctl, gnupg_process_ctl): New. (gnupg_process_wait, gnupg_process_terminate): New. (gnupg_process_release, gnupg_process_wait_list): New. * common/exechelp.h: Re-write for new API. * common/exectool.c (gnupg_exec_tool_stream): Follow the change. * common/asshelp.c (start_new_service): Likewise. * agent/genkey.c (do_check_passphrase_pattern): Likewise. * dirmngr/ldap-wrapper.c (struct wrapper_context_s): Use PROC. (destroy_wrapper): Follow the change of API. (read_log_data): Follow the change of API, use printable_pid. (ldap_reaper_thread, ldap_wrapper_release_context): Likewise. (ldap_wrapper_connection_cleanup, ldap_wrapper): Likewise. * g10/photoid.c (run_with_pipe): Follow the change of API. (show_photo): Likewise. * g13/be-encfs.c (run_umount_helper): Likewise. (run_encfs_tool): Likewise. * g13/g13.c: Add including ./common/exechelp.h. * g13/mount.c: Likewise. * g13/runner.c: Follow the change of API. * g13/runner.h: Follow the change of API. * scd/app.c (setup_env): New. (report_change): Follow the change of API. * tests/gpgscm/ffi.c (proc_object_finalize): New. (proc_object_to_string): New. (proc_wrap, proc_unwrap): New. (do_spawn_process): Remove. (do_process_spawn): New. (setup_std_fds): New. (do_spawn_process_fd): Remove. (do_process_spawn_fd): New. (do_wait_process): Remove. (do_process_wait): New. (do_wait_processes): Remove. * tests/gpgscm/t-child.scm: Follow the change of API. * tests/gpgscm/tests.scm: Likewise. * tests/openpgp/defs.scm: Likewise. * tests/tpm2dtests/defs.scm: Likewise. * tools/gpg-card.c: Likewise. * tools/gpgconf-comp.c: Likewise. * tools/gpgconf.c: Likewise. * tools/gpgtar-create.c: Likewise. * tools/gpgtar-extract.c: Likewise. * tools/gpgtar-list.c: Likewise. -- GnuPG-bug-id: 6275 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Make --disable-extended-key-format a dummy option.Werner Koch2023-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | * agent/agent.h (opt): Remove enable_extended_key_format. * agent/gpg-agent.c (enum cmd_and_opt_values): Turn oDisableExtendedKeyFormat and oEnableExtendedKeyFormat into dummy options. * agent/protect.c (do_encryption): Remove arg use_ocb and corresponding code. (agent_protect): Ditto. Change all callers. * agent/findkey.c (agent_write_private_key): Simplify due to the removal of disable-extended-key-format. (write_extended_private_key): Fold into agent_write_private_key. -- This change is related to GnuPG-bug-id: 6386 but should have no visible effect except for the removal of option --disable-extended-key-format.
* agent,common,dirmngr,tests,tools: Remove spawn PREEXEC argument.NIIBE Yutaka2022-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | * common/exechelp-posix.c (do_exec): Remove PREEXEC argument. (gnupg_spawn_process): Likewise. (gnupg_spawn_process_fd): Follow the change of do_exec. (gnupg_spawn_process_detached): Likewise. * common/exechelp-w32.c (gnupg_spawn_process): Remove PREEXEC. * common/exechelp.h (gnupg_spawn_process): Remove PREEXEC. * agent/genkey.c (do_check_passphrase_pattern): Follow the change. * common/exectool.c (gnupg_exec_tool_stream): Likewise. * dirmngr/ldap-wrapper.c (ldap_wrapper): Likewise. * tests/gpgscm/ffi.c (do_spawn_process): Likewise. * tools/gpgconf-comp.c (gc_component_check_options): Likewise. (retrieve_options_from_program): Likewise. * tools/gpgconf.c (show_versions_via_dirmngr): Likewise. * tools/gpgtar-create.c (gpgtar_create): Likewise. * tools/gpgtar-extract.c (gpgtar_extract): Likewise. * tools/gpgtar-list.c (gpgtar_list): Likewise. -- PREEXEC is not portable feature and it's not used. GnuPG-bug-id: 6249 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Not writing password into file.NIIBE Yutaka2022-04-221-35/+20
| | | | | | | | | | * agent/genkey.c (do_check_passphrase_pattern): Use stream to invoke pattern check program. -- GnuPG-bug-id: 5917 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Use the sysconfdir for a pattern file.Werner Koch2021-08-181-1/+28
| | | | * agent/genkey.c (do_check_passphrase_pattern): Use make_filename.
* agent: New option --check-sym-passphrase-pattern.Werner Koch2021-08-131-10/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (oCheckSymPassphrasePattern): New. (opts): Add --check-sym-passphrase-pattern. (parse_rereadable_options): Set option. (main): Return option info. * tools/gpgconf-comp.c: Add new option. * agent/agent.h (opt): Add var check_sym_passphrase_pattern. (struct pin_entry_info_s): Add var constraints_flags. (CHECK_CONSTRAINTS_NOT_EMPTY): New to replace a hardwired 1. (CHECK_CONSTRAINTS_NEW_SYMKEY): New. * agent/genkey.c (check_passphrase_pattern): Rename to ... (do_check_passphrase_pattern): this to make code reading easier. Handle the --check-sym-passphrase-pattern option. (check_passphrase_constraints): Replace arg no_empty by a generic flags arg. Also handle --check-sym-passphrase-pattern here. * agent/command.c (cmd_get_passphrase): In --newsymkey mode pass CHECK_CONSTRAINTS_NEW_SYMKEY flag. * agent/call-pinentry.c (struct entry_parm_s): Add constraints_flags. (struct inq_cb_parm_s): New. (inq_cb): Use new struct for parameter passing. Pass flags to teh constraints checking. (do_getpin): Pass constraints flag down. (agent_askpin): Take constrainst flag from the supplied pinentry struct. -- Requirements for a passphrase to protect a private key and for a passphrase used for symmetric encryption are different. Thus a the use of a different pattern file will be useful. Note that a pattern file can be used to replace the other passphrase constraints options and thus we don't need to duplicate them for symmetric encryption. GnuPG-bug-id: 5517 Signed-off-by: Werner Koch <[email protected]>
* agent: Avoid memory leaks in error code paths.Jakub Jelen2021-05-201-2/+5
| | | | | | | | | | | | | | | | | | | | * agent/command.c (cmd_genkey): Use goto instead of return. * agent/cvt-openpgp.c (convert_from_openpgp_main): Ditto. * agent/genkey.c (agent_ask_new_passphrase): Fix typo to free correct pointer (agent_genkey): Release memory * agent/gpg-agent.c (check_own_socket): Free sockname * agent/protect-tool.c (read_key): Free buf. (agent_askpin): Free passphrase -- Signed-off-by: Jakub Jelen <[email protected]> Changed original patch to not add a free before a GPG_ERR_BUG. Signed-off-by: Werner Koch <[email protected]> GnuPG-bug-id: 5393
* agent: Allow to pass a timestamp to genkey and import.Werner Koch2020-08-171-7/+9
| | | | | | | | | | | | | | * agent/command.c (cmd_genkey): Add option --timestamp. (cmd_import_key): Ditto. * agent/genkey.c (store_key): Add arg timestamp and change callers. (agent_genkey): Ditto. * agent/findkey.c (write_extended_private_key): Add args timestamp and new key to write a Created line. (agent_write_private_key): Add arg timestamp. (agent_write_shadow_key): Ditto. agent/protect-tool.c (agent_write_private_key): Ditto as dummy arg. Signed-off-by: Werner Koch <[email protected]>
* Do not use the pinentry's qualitybarWerner Koch2020-07-081-1/+1
| | | | | | | | | | | | | | | | * agent/genkey.c (agent_ask_new_passphrase): No qualitybar. * g10/call-agent.c (agent_get_passphrase): Ditto. * sm/call-agent.c (gpgsm_agent_ask_passphrase): Ditto. -- The concept of a passphrase quality indicator is anyway questionable because user are smart enough to trick them out and they also tend to limit the actually used entropy. Except for the red/green switching (to show whether constraints are fulfilled) our qualitybar is pretty bad and thus worse than none. Signed-off-by: Werner Koch <[email protected]>
* agent: New option --newsymkey for GET_PASSPHRASEWerner Koch2020-07-081-4/+4
| | | | | | | | | | | | | * agent/call-pinentry.c (agent_get_passphrase): Add arg pininfo. * agent/genkey.c (check_passphrase_constraints): New arg no_empty. * agent/command.c (reenter_passphrase_cmp_cb): New. (cmd_get_passphrase): Add option --newsymkey. -- This new option allows to present a passphrase with the usual repeat box as it is used by gpg-agent's internal key generation. Signed-off-by: Werner Koch <[email protected]>
* agent: Remove unused agent_show_message.NIIBE Yutaka2019-05-281-23/+6
| | | | | | | | | | | | * agent/call-pinentry.c (agent_show_message): Remove. * agent/genkey.c (take_this_one_anyway): Rename from take_this_one_anyway2. Remove a dead path calling agent_show_message. (check_passphrase_constraints): Use take_this_one_anyway. -- Fixes-commit: 2778c6f8f40d73272075ce04c07097f65c94054e Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Replace most assert by log_assert.Werner Koch2019-05-141-6/+5
| | | | --
* agent: Put Token lines into the key files.Werner Koch2019-05-031-1/+1
| | | | | | | | | | | | | | | * agent/findkey.c (write_extended_private_key): Add args serialno and keyref. Write a Token line if that does not yet exist. (agent_write_private_key): Add args serialno and keyref and change all callers. (agent_write_shadow_key): Skip leading spaces. * agent/keyformat.txt: Improve extended key format docs. -- Noet that the extended key forma is the defaqult in 2.3. This patch is a first step to better handle tokens which carray the same key. Signed-off-by: Werner Koch <[email protected]>
* agent: Make the request origin a part of the cache items.Werner Koch2018-03-271-3/+3
| | | | | | | | | | | | | | | | | | | | * agent/cache.c (agent_put_cache): Add arg 'ctrl' and change all callers to pass it. (agent_get_cache): Ditto. * agent/cache.c (struct cache_items_s): Add field 'restricted'. (housekeeping): Adjust debug output. (agent_flush_cache): Ditto. (agent_put_cache): Ditto. Take RESTRICTED into account. (agent_get_cache): Ditto. -- If requests are coming from different sources they should not share the same cache. This way we make sure that a Pinentry pops up for a remote request to a key we have already used locally. GnuPG-bug-id: 3858 Signed-off-by: Werner Koch <[email protected]>
* agent: Use MAX_PASSPHRASE_LEN (255) also for the loopback.Werner Koch2017-07-051-2/+2
| | | | | | | | | | | | | | | * agent/call-pinentry.c (agent_get_passphrase): Reduce maximum passphrase length as conveyed to the loopback to MAX_PASSPHRASE_LEN. * agent/genkey.c (agent_ask_new_passphrase): Extend the maximum passphrase as conveyed to the loopback to MAX_PASSPHRASE_LEN. -- Note that in genkey() max_length is set to MAX_PASSPHRASE_LEN + 1 because in agent_askpin() decrements that value before conveying it to the loopback. GnuPG-bug-id: 3254 Signed-off-by: Werner Koch <[email protected]>
* agent: Resolve conflict of util.h.NIIBE Yutaka2017-03-071-3/+3
| | | | | | | | | | | | | | | | | * agent/Makefile.am (AM_CPPFLAGS): Remove -I$(top_srcdir)/common. * agent/call-pinentry.c, agent/call-scd.c: Follow the change. * agent/command-ssh.c, agent/command.c, agent/cvt-openpgp.c: Ditto. * agent/divert-scd.c, agent/findkey.c, agent/genkey.c: Ditto. * agent/gpg-agent.c, agent/pksign.c, agent/preset-passphrase.c: Ditto. * agent/protect-tool.c, agent/protect.c, agent/trustlist.c: Ditto. * agent/w32main.c: Ditto. -- For openpty function, we need to include util.h on some OS. We also have util.h in common/, so this change is needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* Clean up word replication.Yuri Chornoivan2017-02-211-1/+1
| | | | | | | | | -- This fixes extra word repetitions (like "the the" or "is is") in the code and docs. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Change all http://www.gnu.org in license notices to https://Werner Koch2016-11-051-1/+1
| | | | --
* agent: Implement new protection mode openpgp-s2k3-ocb-aes.Werner Koch2016-04-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/protect.c (agent_protect): Add arg use_ocb. Change all caller to pass -1 for default. * agent/protect-tool.c: New option --debug-use-ocb. (oDebugUseOCB): New. (opt_debug_use_ocb): New. (main): Set option. (read_and_protect): Implement option. * agent/protect.c (OCB_MODE_SUPPORTED): New macro. (PROT_DEFAULT_TO_OCB): New macro. (do_encryption): Add args use_ocb, hashbegin, hashlen, timestamp_exp, and timestamp_exp_len. Implement OCB. (agent_protect): Change to support OCB. (do_decryption): Add new args is_ocb, aadhole_begin, and aadhole_len. Implement OCB. (merge_lists): Allow NULL for sha1hash. (agent_unprotect): Change to support OCB. (agent_private_key_type): Remove debug output. -- Instead of using the old OpenPGP way of appending a hash of the plaintext and encrypt that along with the plaintext, the new scheme uses a proper authenticated encryption mode. See keyformat.txt for a description. Libgcrypt 1.7 is required. This mode is not yet enabled because there would be no way to return to an older GnuPG version. To test the new scheme use gpg-protect-tool: ./gpg-protect-tool -av -P abc -p --debug-use-ocb <plain.key >prot.key ./gpg-protect-tool -av -P abc -u <prot.key Any key from the private key storage should work. Signed-off-by: Werner Koch <[email protected]>
* common: Extend utf8_charcount to include the string's length.Neal H. Walfield2015-11-231-1/+1
| | | | | | | | * common/stringhelp.c (utf8_charcount): Take additional parameter, len. Process at most LEN bytes. -- Signed-off-by: Neal H. Walfield <[email protected]>
* agent: Fix function return type for check_cb and agent_askpin.NIIBE Yutaka2015-10-091-3/+3
| | | | | | | | | | | | * agent/call-pinentry.c (unlock_pinentry): Return gpg_error_t. (start_pinentry, setup_qualitybar): Likewise. (agent_askpin): Fix return value check of check_cb. * agent/command-ssh.c (reenter_compare_cb): Return gpg_error_t. (ssh_identity_register): Fix return value check of agent_askpin. * agent/cvt-openpgp.c (try_do_unprotect_cb): Return gpg_error_t. * agent/findkey.c (try_unprotect_cb): Likewise. * agent/genkey.c (reenter_compare_cb): Return gpg_error_t. (agent_ask_new_passphrase): Fix return value check of agent_askpin.
* agent: Fix alignment problem with the second passphrase struct.Werner Koch2015-10-021-2/+11
| | | | | | | | | | | | | | | | | | | | * agent/genkey.c (agent_ask_new_passphrase): Use a separate malloc for PI2. Check return value of the malloc function. * agent/command-ssh.c (ssh_identity_register): Use a separate malloc for PI2. Wipe PI2. -- For whatever stupid reasons I once allocated only one memory area and split that into PI and PI2. This is actually a common pattern with malloc but here we used a made up object size and do not take the extra alignment required into account. One of these not yet hit by a (sig)bus PC/VAX hacker bugs. Instead of trying to fix the alignment, it is better to use a second calloc for the second struct. GnuPG-bug-id: 2112 Signed-off-by: Werner Koch <[email protected]>
* agent: Raise the maximum password length. Don't hard code it.Neal H. Walfield2015-08-241-4/+4
| | | | | | | | | | | | | * agent/agent.h (MAX_PASSPHRASE_LEN): Define. * agent/command-ssh.c (ssh_identity_register): Use it instead of a hard-coded literal. * agent/cvt-openpgp.c (convert_from_openpgp_main): Likewise. * agent/findkey.c (unprotect): Likewise. * agent/genkey.c (agent_ask_new_passphrase): Likewise. -- Signed-off-by: Neal H. Walfield <[email protected]>. GnuPG-bug-id: 2038
* Fix pinentry loopback and passphrase contraints.Ben Kibbey2015-08-161-0/+3
| | | | | | | | | | | * agent/command.c (cmd_get_passphrase): Don't repeat passphrase for pinentry loopback mode. * agent/genkey.c (check_passphrase_constraints): Immediately return when pinentry mode is loopback. -- Fixes endless loop when inquiring a passphrase with pinentry-mode=loopback that may not satisfy passphrase contraints.
* Flag the L_() function with attribute format_arg.Werner Koch2015-06-301-2/+3
| | | | | | | | | | | | * agent/agent.h (LunderscorePROTO): New. * common/util.h (GNUPG_GCC_ATTR_FORMAT_ARG): New. * common/i18n.h (GNUPG_GCC_ATTR_FORMAT_ARG): New. Use for i18n_localegettext. Expand LunderscorePROTO. * agent/genkey.c (check_passphrase_constraints): Use xtryasprintf again to keep the old translations. -- Signed-off-by: Werner Koch <[email protected]>
* agent: Use different translation func for Pinentry strings.Werner Koch2015-06-301-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * po/Makevars (XGETTEXT_OPTIONS): Add keyword "L_". * common/i18n.c (i18n_localegettext): New stub. * common/i18n.h: Expand the LunderscoreIMPL macro. * agent/agent.h (L_): New. (LunderscoreIMPL): New. * agent/call-pinentry.c (setup_qualitybar): Add arg ctrl anc change caller. * agent/findkey.c (try_unprotect_cb): Add local var ctrl. * agent/genkey.c (check_passphrase_constraints): Replace xtryasprintf by xtrystrdup to avoid gcc warning. Unfortinately this changes the string. (agent_ask_new_passphrase): Cleanup the use of initial_errtext. -- Static strings in gpg-agent need to be translated according to the locale set by the caller. This is required so that a gpg-agent can be started in one locale and a gpg can be run in another. If we don't do this the static strings (prompt, buttons) are not or in the wrong locale translated while dynamic strings (e.g. key description) uses the locale of gpg. This is only the first part of the change the actual local switching still needs to be implemented. Debian-bug-id: 788983 Signed-off-by: Werner Koch <[email protected]>
* Show passphrase constraints errors as password prompt errorsNeal H. Walfield2015-06-291-16/+36
| | | | | | | | | | | | | | | | | | | | * agent/agent.h (check_passphrase_constraints): Add parameter failed_constraint and remove parameter silent. Update callers. * agent/genkey.c (check_passphrase_constraints): Add parameter failed_constraint and remove parameter silent. If FAILED_CONSTRAINT is not NULL and OPT.ENFORCE_PASSPHRASE_CONSTRAINTS is FALSE, save the error text in *FAILED_CONSTRAINT and don't call take_this_one_anyway or take_this_one_anyway2. If FAILED_CONSTRAINT is NULL, act as if SILENT was set. (agent_ask_new_passphrase): Change initial_errtext's type from a const char * to a char *. Pass it to check_passphrase_constraints. If it contains malloc's memory, free it. -- Signed-off-by: Neal H. Walfield <[email protected]> Based on a patch provided by Watson Yuuma Sato <[email protected]> in issue 2018.
* agent: Send the new SETKEYINFO command to the Pinentry.Werner Koch2015-04-141-2/+2
| | | | | | | | | | * agent/call-pinentry.c (agent_askpin): Add args keyinfo and cache_mode. Change all callers to pass (NULL,0) for them. Send SETKEYINFO command. * agent/findkey.c (unprotect): Pass the keygrip and the cache_mode for the new args. Signed-off-by: Werner Koch <[email protected]>
* agent: Remove useless conditions.Werner Koch2015-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * agent/genkey.c (agent_ask_new_passphrase): Remove useless condition. * agent/command-ssh.c (ssh_identity_register): Ditto. -- Detected by Stack 0.3: bug: anti-simplify model: | %tobool22 = icmp ne i8* %arraydecay21, null, !dbg !717 --> true stack: - /home/wk/s/gnupg/agent/genkey.c:385:0 ncore: 1 core: - /home/wk/s/gnupg/agent/genkey.c:362:0 - pointer overflow bug: anti-simplify model: | %tobool35 = icmp ne i8* %arraydecay34, null, !dbg !1053 --> true stack: - /home/wk/s/gnupg/agent/command-ssh.c:3120:0 ncore: 1 core: - /home/wk/s/gnupg/agent/command-ssh.c:3103:0 - pointer overflow
* gpg: Re-enable the "Passphrase" parameter for batch key generation.Werner Koch2015-01-211-16/+27
| | | | | | | | | | | | | * agent/command.c (cmd_genkey): Add option --inq-passwd. * agent/genkey.c (agent_genkey): Add new arg override_passphrase. * g10/call-agent.c (inq_genkey_parms): Handle NEWPASSWD keyword. (agent_genkey): Add arg optional arg "passphrase". * g10/keygen.c (common_gen, gen_elg, gen_dsa, gen_ecc) (gen_rsa, do_create): Add arg "passphrase" and pass it through. (do_generate_keypair): Make use of pPASSPHRASE. (release_parameter_list): Wipe out a passphrase parameter. Signed-off-by: Werner Koch <[email protected]>
* agent: Support pinentries with integrated repeat passphrase feature.Werner Koch2014-10-241-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | * agent/agent.h (struct pin_entry_info_s): Add fields repeat_okay and with_repeat. * agent/call-pinentry.c (close_button_status_cb): Rewrite and check for PIN_REPEAT. Change users to check only the relevant bit. (agent_askpin): Support repeat logic of new Pinentries. * agent/command-ssh.c (ssh_identity_register): Use the new repeat feature. * agent/genkey.c (agent_ask_new_passphrase): Ditto. -- If we need to confirm a passphrase entry (e.g. for new passphrase) we set a flag into the pinentry info block. The we try to use the new pinentry command SETREPEATERROR; if that fails, we continue as usual. If that succeeds we ask the pinentry to show the repeat (confirmation) prompt and on successful return we set another flag in the pinentry info block so that the caller can skip its own confirmation check. A new status line from the pinentry indicates that the feature is actually supported (it may not be supported on certain systems for example when using the ncurses backend). Signed-off-by: Werner Koch <[email protected]>
* 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.
* Fix typos spotted during translationsDavid Prévot2012-08-241-1/+1
| | | | | | | | | | | | | | | * agent/genkey.c: s/to to/to/ * sm/*.c: s/failed to allocated/failed to allocate/ * sm/certlist.c, ./dirmngr/validate.c: s/should have not/should not have/ * g10/seskey.c: missing closing parenthesis * dirmngr/crlcache.c: s/may has/may have/ Consistency fix: * g10/gpg.c, kbx/kbxutil.c, sm/gpgsm.c: uppercase after Syntax * dirmngr/dirmngr_ldap: no period in Syntax * dirmngr/dirmngr-client.c: infinitive for option description: s/certificates are expected/expect certificates/
* Allow no protection in pinentry-mode=loopback.Ben Kibbey2011-09-131-2/+7
| | | | | When the inquired passphrase has a 0 length then treat it as no protection.
* Fixed invalid free.Ben Kibbey2011-09-131-3/+1
|
* Handle pinentry-mode=loopback.Ben Kibbey2011-09-121-0/+17
| | | | | | When this mode is set an inquire will be sent to the client to retrieve the passphrase. This adds a new inquire keyword "NEW_PASSPHRASE" that the GENKEY and PASSWD commands use when generating a new key.
* Fixed set but unused variable bugsWerner Koch2011-08-101-2/+2
|
* Added gpg-agent OPTION "s2k-count".Ben Kibbey2011-06-291-5/+7
| | | | When unset or 0, the calibrated count will be used.
* Add OPTION:cache-ttl-opt-preset to gpg-agent.Werner Koch2011-04-211-2/+2
| | | | | This option may be used to change the default ttl values use with the --preset option of GENKEY and PASSWD.
* Use macros for the 120 and 900s cache TTLs.Werner Koch2011-04-121-2/+3
|
* Added GENKEY --preset to add the passphrase of the generated key to the cache.Ben Kibbey2011-04-121-1/+11
|
* Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch2011-02-041-21/+21
| | | | | | | | 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.