aboutsummaryrefslogtreecommitdiffstats
path: root/agent/genkey.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-03-27agent: Make the request origin a part of the cache items.Werner Koch1-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]>
2017-07-05agent: Use MAX_PASSPHRASE_LEN (255) also for the loopback.Werner Koch1-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]>
2017-03-07agent: Resolve conflict of util.h.NIIBE Yutaka1-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]>
2017-02-21Clean up word replication.Yuri Chornoivan1-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]>
2016-11-05Change all http://www.gnu.org in license notices to https://Werner Koch1-1/+1
--
2016-04-12agent: Implement new protection mode openpgp-s2k3-ocb-aes.Werner Koch1-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]>
2015-11-23common: Extend utf8_charcount to include the string's length.Neal H. Walfield1-1/+1
* common/stringhelp.c (utf8_charcount): Take additional parameter, len. Process at most LEN bytes. -- Signed-off-by: Neal H. Walfield <[email protected]>
2015-10-09agent: Fix function return type for check_cb and agent_askpin.NIIBE Yutaka1-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.
2015-10-02agent: Fix alignment problem with the second passphrase struct.Werner Koch1-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]>
2015-08-24agent: Raise the maximum password length. Don't hard code it.Neal H. Walfield1-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
2015-08-16Fix pinentry loopback and passphrase contraints.Ben Kibbey1-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.
2015-06-30Flag the L_() function with attribute format_arg.Werner Koch1-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]>
2015-06-30agent: Use different translation func for Pinentry strings.Werner Koch1-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]>
2015-06-29Show passphrase constraints errors as password prompt errorsNeal H. Walfield1-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.
2015-04-14agent: Send the new SETKEYINFO command to the Pinentry.Werner Koch1-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]>
2015-03-15agent: Remove useless conditions.Werner Koch1-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
2015-01-21gpg: Re-enable the "Passphrase" parameter for batch key generation.Werner Koch1-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]>
2014-10-24agent: Support pinentries with integrated repeat passphrase feature.Werner Koch1-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]>
2014-07-23agent: Show just one warning with all failed passphrase constraints.Werner Koch1-38/+74
* agent/genkey.c (check_passphrase_constraints): Build a final warning after all checks.
2014-07-23agent: Only one confirmation prompt for an empty passphrase.Werner Koch1-21/+19
* agent/genkey.c (check_passphrase_constraints): Moev empty passphrase check to the front.
2012-08-24Fix typos spotted during translationsDavid Prévot1-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/
2011-09-13Allow no protection in pinentry-mode=loopback.Ben Kibbey1-2/+7
When the inquired passphrase has a 0 length then treat it as no protection.
2011-09-13Fixed invalid free.Ben Kibbey1-3/+1
2011-09-12Handle pinentry-mode=loopback.Ben Kibbey1-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.
2011-08-10Fixed set but unused variable bugsWerner Koch1-2/+2
2011-06-29Added gpg-agent OPTION "s2k-count".Ben Kibbey1-5/+7
When unset or 0, the calibrated count will be used.
2011-04-21Add OPTION:cache-ttl-opt-preset to gpg-agent.Werner Koch1-2/+2
This option may be used to change the default ttl values use with the --preset option of GENKEY and PASSWD.
2011-04-12Use macros for the 120 and 900s cache TTLs.Werner Koch1-2/+3
2011-04-12Added GENKEY --preset to add the passphrase of the generated key to the cache.Ben Kibbey1-1/+11
2011-02-04Nuked almost all trailing white space.post-nuke-of-trailing-wsWerner Koch1-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.
2010-10-26Re-implemented GPG's --passwd command and improved it.Werner Koch1-12/+32
2010-10-14All tests work are again workingWerner Koch1-5/+11
2010-10-13More agent support for gpg.Werner Koch1-8/+6
2010-10-01Exporting secret keys via gpg-agent is now basically supported.Werner Koch1-6/+8
A couple of forward ported changes. Doc updates.
2010-09-02Obscure the cached passphrases.Werner Koch1-16/+2
2010-09-01s/CACHE_MODE_IMPGEN/CACHE_MODE_NONCE/.Werner Koch1-2/+2
Prepare for more use cases of the cache nonce.
2010-09-01Use passphrase caching for import and genkey.Werner Koch1-6/+39
2010-06-24Fix a regression from 2010-06-09.Werner Koch1-1/+1
2010-06-17Avoid using the protect-tool to import pkcs#12.Werner Koch1-112/+87
2010-06-09Merged Dirmngr with GnuPG.Werner Koch1-1/+2
A few code changes to support dirmngr.
2010-04-14Whole lot of changes to support CE.Werner Koch1-2/+4
2009-06-24Fixed a bunch of little bugs as reported by Fabian Keil.Werner Koch1-1/+1
Still one problem left; marked with a gcc #warning.
2009-06-17Use cancel button in confirmation only if requested.Werner Koch1-1/+1
2008-10-20Marked all unused args on non-W32 platforms.Werner Koch1-0/+2
2007-11-19Started to implement the audit log feature.Werner Koch1-1/+1
Pass PINENTRY_USER_DATA and XAUTHORITY to Pinentry. Improved support for the quality bar. Minor internal restructuring. Translation fixes.
2007-10-24Changed wording of passphrase checking messages.Werner Koch1-15/+14
Fixed a segv in gpg-connect-agent.
2007-09-18Support the SETQUALITYBAR command of recent pinentries.Werner Koch1-6/+25
2007-08-29New command --check-programs for gpgconf.Werner Koch1-1/+1
2007-08-28Add more passphrase policy rules.Werner Koch1-1/+1
(--max-passphrase-days).
2007-08-27Implemented more gpg-agen options to support certain passphrase policies.Werner Koch1-12/+144
New tool gpg-check-pattern.