aboutsummaryrefslogtreecommitdiffstats
path: root/agent (unfollow)
Commit message (Collapse)AuthorFilesLines
2020-06-04ecc-sos,gpg: Use sexp_extract_param_sos to get MPI.NIIBE Yutaka1-2/+2
* g10/export.c (sexp_extract_param_sos): Expose. * g10/keygen.c (ecckey_from_sexp): Use it. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-06-04ecc-sos, agent: More fixes for fixup of ECC private key.NIIBE Yutaka4-19/+27
Signed-off-by: NIIBE Yutaka <[email protected]>
2020-06-03ecc-sos,agent: Fix sexp parsing of private key.NIIBE Yutaka1-5/+8
* agent/sexp-secret.c (fixup_when_ecc_private_key): Correctly parse SEXP. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-06-03ecc-sos, agent: Add fixing up private key part for leading zero.NIIBE Yutaka5-10/+128
GnuPG-bug-id: 4956 Signed-off-by: NIIBE Yutaka <[email protected]>
2020-06-01Revert "ecc-sos: Add special leading zero octet removal."NIIBE Yutaka1-41/+9
This reverts commit 1c4291c3951dc73db1511f6198555c2a7642bf12.
2020-05-27ecc-sos: Add special leading zero octet removal.NIIBE Yutaka1-9/+41
* agent/cvt-openpgp.c (extract_private_key): Remove leading zeros. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-26ecc-sos: Fix SOS handling and revert change of cvt protocol.NIIBE Yutaka1-15/+25
Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-26ecc-sos: Unsigned integer for SSH, more.NIIBE Yutaka1-1/+1
Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-26ecc-sos: Use unsigned integer format for SSH.NIIBE Yutaka1-3/+1
Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-26ecc-sos: When reading private key, it's unsigned.NIIBE Yutaka1-1/+1
* agent/findkey.c (agent_public_key_from_file): Use 'M' format. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-26agent: SSH clean up.NIIBE Yutaka1-30/+9
* agent/command-ssh.c (ssh_receive_key): Use sexp_key_construct for EdDSA. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-25Revert "ecc-sos: Fix SOS handling in do_unprotect."NIIBE Yutaka1-10/+9
This reverts commit 43c0c19fcae57529ea57079e034827372ed0b2b7.
2020-05-20ecc-sos: Fix SOS handling in do_unprotect.NIIBE Yutaka1-9/+10
* agent/cvt-openpgp.c (do_unprotect): Exclude the case when the first byte is zero. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-19agent: Don't use gcry_mpi_scan when not needed.NIIBE Yutaka1-13/+3
* agent/pksign.c (do_encode_md): Use %b to build sexp. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-18ecc-sos: Fix gpg-agent for SOS handling.NIIBE Yutaka1-25/+63
* agent/cvt-openpgp.c (scan_pgp_format): New. (do_unprotect): Fix NBITS in SOS. Use scan_pgp_format. (convert_from_openpgp_main): Always use opaque MPI. Use GCRYMPI_FLAG_USER1 for encrypted data. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-14ecc-sos: gpg-agent access ECC public key as opaque string.NIIBE Yutaka1-6/+7
* agent/cvt-openpgp.c (extract_private_key): Use "/q" for public key. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-04ecc-sos: public key is MPI with the prefix 0x40.NIIBE Yutaka1-1/+1
Signed-off-by: NIIBE Yutaka <[email protected]>
2020-05-04agent: Fix converting to OpenPGP.NIIBE Yutaka1-2/+5
Signed-off-by: NIIBE Yutaka <[email protected]>
2020-03-30agent: Print an error if gpg-protect reads the extended key format.Werner Koch1-0/+5
* agent/protect-tool.c (read_key): Detect simple extended key format. -- This is a quick hack to get a useful error messages. The real fix is to replace the protect tool by a more useful new tool. Signed-off-by: Werner Koch <[email protected]>
2020-03-14gpgconf: Further simplify the gpgconf option processing.Werner Koch1-55/+12
* common/gc-opt-flags.h (GC_OPT_FLAG_RUNTIME): Move to ... * tools/gpgconf-comp.c: here. (known_options_scdaemon): Remove "options". (known_options_dirmngr): Remove "options". (known_options_gpgsm): Remove "options". (known_options_gpg): Remove "options" and "keyserver". (struct gc_option_s): Rename active t gpgconf_list. (gc_component_list_options): Do not act upon active. (option_check_validity): Ditto. (is_known_option): Make it work correctly for unknown options. (retrieve_options_from_program): Use renamed flag gpgconf_list only to detect duplicated items from --gpgconf-list. Do not set runtime. Only e set the options if set by --gpgconf-list; never clear them. * agent/gpg-agent.c: Simplify the --gpgconf-list output. * dirmngr/dirmngr.c: Ditto. * g10/gpg.c: Ditto. * kbx/keyboxd.c: Ditto. * scd/scdaemon.c: Ditto. * sm/gpgsm.c: Ditto. * tests/openpgp/gpgconf.scm: Use "compliance" instead of "keyserver" for the string arg test. -- There is no need to read the list of options from the components unless they convey a default value. It is better to consult only the list we have in gpgconf-comp.c to decide on whether an option should be displayed. Right, this might mess up thing if a newer gpgconf version is used with an older component, but we already print warnings in this case and in general we do not want to support this anymore - the times of gpg 1.4. and 2.0 are long over now. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
2020-03-06agent: Fix todays --re-group commit.Werner Koch1-0/+1
-- Fixes-commit: c693b7f4ade97357c33b410728bb741674255487
2020-03-06agent: Re-group the options in the --help output.Werner Koch1-64/+71
* agent/gpg-agent.c (oGreeting): Remove non existant dummy option. -- This looks better and is also required for further simplifications of gpgconf. Signed-off-by: Werner Koch <[email protected]>
2020-03-06gpgconf: Support reading global options (part 2).Werner Koch1-13/+22
* tools/gpgconf-comp.c: Remove all regular option descriptions. They are now read in from the component. Also remove a few meanwhile obsolete options. * agent/gpg-agent.c: Add option description which were only set in gpgconf-comp.c. * dirmngr/dirmngr.c: Ditto. * scd/scdaemon.c: Ditto. * sm/gpgsm.c: Ditto. * g10/gpg.c: Ditto. -- This second part removes all regular option descriptions because they can be read from the components. A few were missing in the components and thus moved to there. Signed-off-by: Werner Koch <[email protected]>
2020-02-22agent,dirmngr: Re-read the user specified config file.Werner Koch1-2/+8
* agent/gpg-agent.c (reread_configuration): Use a two-part config file. * dirmngr/dirmngr.c (reread_configuration): Ditto. -- If --options is used to to set a specific options file, this file and not the default file needs to be re-read on SIGHUP. GnuPG-bug-id: 4788
2020-02-21Use gpgrt's new option parser for the tools.Werner Koch2-20/+22
* agent/preset-passphrase.c: Switch to the new option parser. * agent/protect-tool.c: Ditto. * kbx/kbxutil.c: Ditto. * tools/gpg-card.c: Ditto. * tools/gpg-check-pattern.c: Ditto. * tools/gpg-connect-agent.c: Ditto. * tools/gpg-pair-tool.c: Ditto. * tools/gpg-wks-client.c: Ditto. * tools/gpg-wks-server.c: Ditto. * tools/gpgconf.c: Ditto. * tools/gpgsplit.c: Ditto. * tools/gpgtar.c: Ditto. -- This is another part of changes. A followup patch will address the remaining daemons. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
2020-02-20Use gpgrt's new option parser for gpgc, gpgsm, and gpg-agent.Werner Koch1-130/+104
* g10/gpgv.c: Use new option parser. * sm/gpgsm.c: Ditto. * agent/gpg-agent.c: Ditto. (opts): Add option --no-options. -- This is the next part of changes. The latest libgpg-error is required so that that re-reading options (SIGHUP) works. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
2020-02-20gpg: Use gpgrt's new option parser to provide a global conf file.Werner Koch3-0/+12
* common/util.h: Remove argparse.h. * common/argparse.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS. * configure.ac (GPGRT_ENABLE_ARGPARSE_MACROS): Define. * agent/gpg-agent.c: Undef GPGRT_ENABLE_ARGPARSE_MACROS and include argparse.h. Do this also for all main modules which use our option parser except for gpg. Replace calls to strusage by calls to gpgrt_strusage everywhere. * g10/gpg.c (opts): Change type to gpgrt_opt_t. Flag oOptions and oNoOptions with ARGPARSE_conffile and ARGPARSE_no_conffile. (main): Change type of pargs to gpgrt_argparse_t. Rework the option parser to make use of the new gpgrt_argparser. -- This is not yet finished but a make check works. gpg has the most complex and oldest option handling and thus this is the first migration target. SE-Linux checks and version-ed config files are missing and will be added later. GnuPG-bug-id: 4788 Signed-off-by: Werner Koch <[email protected]>
2020-02-18Spelling cleanup.Daniel Kahn Gillmor8-11/+11
No functional changes, just fixing minor spelling issues. --- Most of these were identified from the command line by running: codespell \ --ignore-words-list fpr,stati,keyserver,keyservers,asign,cas,iff,ifset \ --skip '*.po,ChangeLog*,help.*.txt,*.jpg,*.eps,*.pdf,*.png,*.gpg,*.asc' \ doc g13 g10 kbx agent artwork scd tests tools am common dirmngr sm \ NEWS README README.maint TODO Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2020-02-13agent: Allow signing with card key even without a stub key.Werner Koch8-32/+172
* agent/call-scd.c (agent_card_serialno): Allow NULL for R_SERIAL. (struct readkey_status_parm_s): New. (readkey_status_cb): New. (agent_card_readkey): Add optional arg R_KEYREF and change all callers. * agent/findkey.c (key_parms_from_sexp): Allow also a "public-key". * agent/divert-scd.c (ask_for_card): Allow for SHADOW_INFO being NULL. * agent/pksign.c (agent_pksign_do): Fallback to sign with an on-card if there is no stub key yet. Create the stub key. Also fixed a misnaming between s_pkey and s_skey. -- This change allows to create OpenPGP keys directly from a card without first making sure that a stub key exists. It is also the less surprising behaviour. Signed-off-by: Werner Koch <[email protected]>
2020-02-10build: Always use EXTERN_UNLESS_MAIN_MODULE pattern.Werner Koch5-0/+5
* common/util.h (EXTERN_UNLESS_MAIN_MODULE): Add the definion only here but now without the Norcroft-C. Change all other places where it gets defined. * common/iobuf.h (iobuf_debug_mode): Declare unconditionally as extern. * common/iobuf.c (iobuf_debug_mode): Define it here. * agent/gpg-agent.c (INCLUDED_BY_MAIN_MODULE): Define here and also in all main modules of all other programs. * g10/main.h: Put util.h before the local header files. -- This change is required for use with gcc/ld's LTO feature which does not allow common blocks. Further gcc 10 will make -fno-common the default and thus this chnage is always needed. What a pitty. Co-authored-by: Tomáš Mráz GnuPG-bug-id: 4831 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 21d9bd8b87a9f793a106095e3838eb71825189d7) - Applied respective chnages also to gpg-card and keyboxd. Signed-off-by: Werner Koch <[email protected]>
2020-01-13agent: Avoid multiple calls to scd for KEYINFO.Werner Koch1-2/+45
* agent/command.c (struct server_local_s): Add last_card_keyinfo. (eventcounter): Add maybe_key_change. (cmd_genkey, cmd_scd, cmd_import_key, cmd_delete_key): Bump new counter. (cmd_keyinfo): Cache the keyinfo from the card. (start_command_handler): Release the cache. -- This cache speeds up processing of commands like "gpg -K" because scdaemon does not need to be asked for each key as long as nothing changed with the card. We should have a better notification service from scdaemon to make sure that we get only the relevant events. What we do right now is a bit course but sufficient. Signed-off-by: Werner Koch <[email protected]>
2020-01-13agent: Replace free by xfree in recently added code.Werner Koch1-3/+3
* agent/call-scd.c (agent_card_free_keyinfo): Use xfree. Signed-off-by: Werner Koch <[email protected]>
2020-01-13scd: Make SERIALNO --all work correctly and use it.Werner Koch1-1/+1
* scd/app.c (maybe_switch_app): Factor reselect code out to ... (run_reselect): new. (app_write_learn_status): Tweak diagnostics. (app_do_with_keygrip): Run reselect if a card has more than one switchable application. * agent/call-scd.c (agent_card_serialno): Ditto. * tools/card-call-scd.c (start_agent): Use option --all with SERIALNO. (scd_serialno): Ditto. Signed-off-by: Werner Koch <[email protected]>
2020-01-13agent: handle SSH operation by KEYGRIP.NIIBE Yutaka1-86/+15
* agent/command-ssh.c (card_key_available): Supply KEYINFO argument. Call agent_card_readkey by KEYGRIP of KEYINFO. Don't use $AUTHKEYID, but IDSTR of KEYINFO. (ssh_handler_request_identities): Follow the change of card_key_available. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-01-13agent: Extend agent_card_getattr with KEYGRIP.NIIBE Yutaka3-5/+11
* agent/agent.h (struct card_key_info_s): KEYGRIP null terminated. (agent_card_getattr): Add KEYGRIP argument. * agent/call-scd.c (agent_card_getattr): Handle KEYGRIP argument. (card_keyinfo_cb): Make KEYGRIP null terminated. * agent/command.c (cmd_readkey): Follow the change. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-01-09scd: Use a scdaemon internal key to protect the PIN cache IPC.Werner Koch2-65/+49
* agent/call-scd.c (handle_pincache_put): Do not decrypt. (handle_pincache_get): New. (inq_needpin): Call it. * scd/command.c (set_key_for_pincache): New. (pincache_put): Restructure and set key. (pincache_get): Ditto. -- This change does away with encrypting and decrypting the cached PIN in the agent. There is no need for this we can simply cache the cryptogram and let scdaemon decrypt after retrieving it from the agent. This way we do not need to share a key between gpg-agent and scdaemon and further the cached content is invalid after the scdaemon process has been replaced. Signed-off-by: Werner Koch <[email protected]>
2020-01-09agent: SSH: SCD KEYINFO to list available keys.NIIBE Yutaka5-116/+39
* agent/agent.h (agent_card_cardlist): Remove. (agent_card_keyinfo): Add CAP argument. * agent/call-scd.c (card_cardlist_cb): Remove. (agent_card_cardlist): Remove. (agent_card_keyinfo): Support CAP constraint. * agent/command-ssh.c (card_key_list): Remove. (ssh_handler_request_identities): Use SCD KEYINFO command. * agent/command.c (cmd_keyinfo): Follow the API change. * agent/divert-scd.c (ask_for_card): Likewise. Signed-off-by: NIIBE Yutaka <[email protected]>
2020-01-07agent: First changes to support a PIN cache for scdaemon.Werner Koch4-29/+217
* agent/agent.h (CACHE_MODE_PIN): New. * agent/cache.c (housekeeping): Special handling of new new mode. (agent_flush_cache): Ditto. Add arg 'pincache_only' and change caller. (agent_put_cache): Support new mode. (agent_get_cache): Ditto. * agent/call-scd.c (wait_child_thread): Flush the entire PIN cache. (start_scd): Ditto. (agent_card_killscd): Ditto. (handle_pincache_put): New. Uses a dummy encryption key for now. (pincache_put_cb): New. (inq_needpin): Prepare for PINCACHE_GET inquiry. (learn_status_cb): Handle the PINENTRY_PUT status line. (get_serialno_cb): Ditto (agent_card_pksign): Ditto. (padding_info_cb): Ditto. (agent_card_readcert): Ditto. (agent_card_readkey): Ditto. (agent_card_writekey): Ditto. (card_getattr_cb): Ditto. (card_cardlist_cb): Ditto. (card_keyinfo_cb): Ditto. (pass_status_thru): Ditto. -- Take care: This is not finished. Signed-off-by: Werner Koch <[email protected]>
2019-11-25agent: Improve --debug-pinentry diagnosticsWerner Koch1-19/+35
* agent/call-pinentry.c (atfork_cb): Factor code out to ... (atfork_core): new. -- We convey certain envvars directly via the environment to Pinentry and thus they don't show up in the Assuan logging. Because we better don't call a logging function in an atfork handle, this patch splits the code up and uses the same code to display what was done in at fork after the connection has been established. Signed-off-by: Werner Koch <[email protected]>
2019-11-18dirmngr: Fixed typo in recently added diagnostic.Werner Koch1-1/+1
--
2019-09-05agent: Fix ask_for_card to allow a key on multiple cards.NIIBE Yutaka1-83/+36
* agent/divert-scd.c (ask_for_card): Don't use SERIALNO to select card, but use KEYGRIP. GnuPG-bug-id: 4695 Signed-off-by: NIIBE Yutaka <[email protected]>
2019-08-06agent: Fix an error path of agent_get_confirmation.NIIBE Yutaka1-8/+9
* agent/call-pinentry.c (agent_get_confirmation): Make sure unlock_pinentry is always called. Signed-off-by: NIIBE Yutaka <[email protected]>
2019-07-11agent: Relax the handling of pinentry error for keyboard grab.NIIBE Yutaka1-1/+11
* agent/call-pinentry.c (start_pinentry): It's not fatal when pinentry doesn't support no-grab/grab option. GnuPG-bug-id: 4587 Signed-off-by: NIIBE Yutaka <[email protected]>
2019-06-28agent: Close a dialog cleanly when gpg/ssh is killed for CONFIRM.NIIBE Yutaka1-22/+60
* agent/call-pinentry.c (watch_sock_start): Factor out from do_getpin. (watch_sock_end): Likewise. (do_getpin): Use those functions. (agent_get_confirmation): Likewise. (popup_message_thread): Likewise. -- Pinentry's dialog for confirmation should be also closed cleanly, as well as the dialog for pin-input. Signed-off-by: NIIBE Yutaka <[email protected]>
2019-06-04agent: Allow TERM="".NIIBE Yutaka1-1/+1
* agent/call-pinentry.c (start_pinentry): When TERM is none, don't send OPTION ttytype to pinentry. -- GnuPG-bug-id: 4137 Signed-off-by: NIIBE Yutaka <[email protected]>
2019-06-04agent: Add pinentry_loopback_confirm declaration.NIIBE Yutaka1-2/+5
* agent/agent.h (pinentry_loopback_confirm): New. Signed-off-by: NIIBE Yutaka <[email protected]>
2019-06-04g10,agent: Support CONFIRM for --delete-key.NIIBE Yutaka2-1/+38
* agent/call-pinentry.c (agent_get_confirmation): Add call of pinentry_loopback_confirm. (agent_popup_message_start): Likewise. (agent_popup_message_stop): Return if it's loopback mode. * agent/command.c (pinentry_loopback_confirm): New. * g10/call-agent.c (default_inq_cb): Support "CONFIRM" inquery when PINENTRY_MODE_LOOPBACK mode. (confirm_status_cb): New. (agent_delete_key): Supply confirm_status_cb to set the description string for confirmation. -- In the Assuan communication, we introduce new interaction: [gpg] [gpg-agent] --- CMD: PKDECRYPT --> <-- STATUS: SETDESC "..." <-- STATUS: SETOK "..." <-- STATUS: SETNOTOK "..." <-- INQUERY: CONFIRM 0/1 (0 for display, 1 for user query) --- INQUERY-result: --> <-- RESULT: ... GnuPG-bug-id: 3465 Signed-off-by: NIIBE Yutaka <[email protected]>
2019-06-03Return better error code for some getinfo IPC commands.Werner Koch1-3/+3
* agent/command.c (cmd_getinfo): Return GPG_ERR_FALSE as boolean False. * g13/server.c (cmd_getinfo): Ditto. * sm/server.c (cmd_getinfo): Ditto. -- GPG_ERR_FALSE was introduced with libgpg-error 1.21 and we now require a later version for gnupg 2. Thus we can switch to this more descriptive code. Signed-off-by: Werner Koch <[email protected]>
2019-05-29agent: Add A-flag for KEYINFO output for card.NIIBE Yutaka1-4/+29
* agent/command.c (do_one_keyinfo): Add ON_CARD argument to put A-flag. (cmd_keyinfo): Call agent_card_keyinfo to offer additional information if it's on card. -- This is a modification in gpg-agent, intended for better enum_secret_keys in gpg frontend. GnuPG-bug-id: 4244 Signed-off-by: NIIBE Yutaka <[email protected]>
2019-05-28agent: Make an MD encoding function more robust.Werner Koch1-7/+12
* agent/pksign.c (do_encode_md): Use ascii_tolower and avoid uninitalized TMP in the error case. -- This is just in case libgcrypt ever returns an algorithm name longer than 15 bytes. Signed-off-by: Werner Koch <[email protected]>