aboutsummaryrefslogtreecommitdiffstats
path: root/agent (follow)
Commit message (Collapse)AuthorAgeFilesLines
* gpg: default to 3072-bit RSA keys.Daniel Kahn Gillmor2019-07-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | * agent/command.c (hlp_genkey): update help text to suggest the use of 3072 bits. * doc/wks.texi: Make example match default generation. * g10/keygen.c (DEFAULT_STD_KEY_PARAM): update to rsa3072/cert,sign+rsa3072/encr, and fix neighboring comment, (gen_rsa, get_keysize_range): update default from 2048 to 3072). * g10/keyid.c (pubkey_string): update comment so that first example is the default 3072-bit RSA. -- 3072-bit RSA is widely considered to be 128-bit-equivalent security. This is a sensible default in 2017. Signed-off-by: Daniel Kahn Gillmor <[email protected]> (cherry picked from commit 909fbca19678e6e36968607e8a2348381da39d8c) Gbp-Pq: Topic from-master Gbp-Pq: Name gpg-default-to-3072-bit-RSA-keys.patch
* agent: Avoid scheduled checks on socket when inotify is working.Daniel Kahn Gillmor2019-07-201-0/+2
| | | | | | | | | | * agent/gpg-agent.c (handle_connections): When inotify is working, we do not need to schedule a timer to evaluate whether we control our own socket or not. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic gpg-agent-idling Gbp-Pq: Name agent-Avoid-scheduled-checks-on-socket-when-inotify-.patch
* agent: Avoid tight timer tick when possible.Daniel Kahn Gillmor2019-07-202-2/+29
| | | | | | | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (need_tick): Evaluate whether the short-phase handle_tick() is needed. (handle_connections): On each cycle of the select loop, adjust whether we should call handle_tick() or not. (start_connection_thread_ssh, do_start_connection_thread): Signal the main loop when the child terminates. * agent/call-scd.c (start_scd): Call interrupt_main_thread_loop() once the scdaemon thread context has started up. -- With this change, an idle gpg-agent that has no scdaemon running only wakes up once a minute (to check_own_socket). Thanks to Ian Jackson and NIIBE Yutaka who helped me improve some of the blocking and corner cases. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic gpg-agent-idling Gbp-Pq: Name agent-Avoid-tight-timer-tick-when-possible.patch
* agent: Allow threads to interrupt main select loop with SIGCONT.Daniel Kahn Gillmor2019-07-202-0/+17
| | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (interrupt_main_thread_loop): New function on non-windows platforms, allows other threads to interrupt the main loop if there's something that the main loop might be interested in. -- For example, the main loop might be interested in changes in program state that affect the timers it expects to see. I don't know how to do this on Windows platforms, but i welcome any proposed improvements. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic gpg-agent-idling Gbp-Pq: Name agent-Allow-threads-to-interrupt-main-select-loop-wi.patch
* agent: Create framework of scheduled timers.Daniel Kahn Gillmor2019-07-201-27/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | agent/gpg-agent.c (handle_tick): Remove intermittent call to check_own_socket. (tv_is_set): Add inline helper function for readability. (handle_connections) Create general table of pending scheduled timeouts. -- handle_tick() does fine-grained, rapid activity. check_own_socket() is supposed to happen at a different interval. Mixing the two of them makes it a requirement that one interval be a multiple of the other, which isn't ideal if there are different delay strategies that we might want in the future. Creating an extensible regular timer framework in handle_connections should make it possible to have any number of cadenced timers fire regularly, without requiring that they happen in cadences related to each other. It should also make it possible to dynamically change the cadence of any regularly-scheduled timeout. Signed-off-by: Daniel Kahn Gillmor <[email protected]> Gbp-Pq: Topic gpg-agent-idling Gbp-Pq: Name agent-Create-framework-of-scheduled-timers.patch
* Avoid simple memory dumps via ptraceDaniel Kahn Gillmor2019-07-201-0/+8
| | | | | | | | | | | | | | | | | | This avoids needing to setgid gpg-agent. It probably doesn't defend against all possible attacks, but it defends against one specific (and easy) one. If there are other protections we should do them too. This will make it slightly harder to debug the agent because the normal user won't be able to attach gdb to it directly while it runs. The remaining options for debugging are: * launch the agent from gdb directly * connect gdb to a running agent as the superuser Upstream bug: https://dev.gnupg.org/T1211 Gbp-Pq: Topic block-ptrace-on-secret-daemons Gbp-Pq: Name Avoid-simple-memory-dumps-via-ptrace.patch
* spelling: Fix "synchronize"Daniel Kahn Gillmor2019-06-241-1/+1
| | | | Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Return better error code for some getinfo IPC commands.Werner Koch2019-06-031-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]>
* agent: Stop scdaemon after reload when disable_scdaemon.NIIBE Yutaka2019-05-273-0/+13
| | | | | | | | | | * agent/call-scd.c (agent_card_killscd): New. * agent/gpg-agent.c (agent_sighup_action): Call agent_card_killscd. -- GnuPG-bug-id: 4326 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: For SSH key, don't put NUL-byte at the end.NIIBE Yutaka2019-05-211-2/+2
| | | | | | | | | | * agent/command-ssh.c (ssh_key_to_protected_buffer): Update the length by the second call of gcry_sexp_sprint. -- GnuPG-bug-id: 4502 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: correct length for uri and comment on 64-bit big-endian platformsDaniel Kahn Gillmor2019-05-141-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | * agent/findkey.c (agent_public_key_from_file): pass size_t as int to gcry_sexp_build_array's %b. -- This is only a problem on big-endian systems where size_t is not the same size as an int. It was causing failures on debian's s390x, powerpc64, and sparc64 platforms. There may well be other failures with %b on those platforms in the codebase, and it probably needs an audit. Once you have a key in private-keys-v1.d/$KEYGRIP.key with a comment or a uri of reasonable length associated with it, this fix can be tested with: gpg-agent --server <<<"READKEY $KEYGRIP" On the failing platforms, the printed comment will be of length 0. Gnupg-bug-id: 4501 Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* dirmngr: Add a CSRF expection for pm.meWerner Koch2019-05-091-2/+2
| | | | | | -- Also comment typo fix.
* agent: Allow other ssh fingerprint algos in KEYINFO.Werner Koch2019-03-261-4/+20
| | | | | | | * agent/command.c (cmd_keyinfo): Allow for --ssh-fpr=ALGO. Default to the standard algo. Signed-off-by: Werner Koch <[email protected]>
* agent: Support --mode=ssh option for CLEAR_PASSPHRASE.NIIBE Yutaka2019-03-071-8/+10
| | | | | | | | | | * agent/command.c (cmd_clear_passphrase): Add support for SSH. -- GnuPG-bug-id: 4340 Signed-off-by: NIIBE Yutaka <[email protected]> (cherry picked from commit ae966bbe9b16ed68a51391afdde615339755e22d)
* agent: Fix for suggested Libgcrypt use.Werner Koch2019-02-251-1/+16
| | | | | | | | | | | | | * agent/divert-scd.c (divert_pkdecrypt): Skip a flags parameter. -- The libgcrypt docs say that a "flags" parameter should always be used in the input of pkdecrypt. Thus we should allow that parameter also when parsing an s-expression to figure out the algorithm for use with scdaemon. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit a12c3a566e2e4b10bc02976a2819070877ee895c)
* agent: Fix cancellation handling for scdaemon.NIIBE Yutaka2019-02-191-41/+0
| | | | | | | | | | | | | | | | | * agent/call-scd.c (cancel_inquire): Remove. (agent_card_pksign, agent_card_pkdecrypt, agent_card_writekey) (agent_card_scd): Don't call cancel_inquire. -- Cherry-picked master commit of: 9f5e50e7c85aa8b847d38010241ed570ac114fc3 Since libassuan 2.1.0, cancellation command "CAN" is handled within the library, by assuan_transact. So, cancel_inquire just caused spurious "CAN" command to scdaemon which resulted an error. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Clear bogus pinentry cache, when it causes an error.NIIBE Yutaka2019-02-063-21/+39
| | | | | | | | | | | | | | | | | | | | * agent/agent.h (PINENTRY_STATUS_*): Expose to public. (struct pin_entry_info_s): Add status. * agent/call-pinentry.c (agent_askpin): Clearing the ->status before the loop, let the assuan_transact set ->status. When failure with PINENTRY_STATUS_PASSWORD_FROM_CACHE, it returns soon. * agent/findkey.c (unprotect): Clear the pinentry cache, when it causes an error. -- Cherry-picked from master commit of: 02a2633a7f0b7d91aa48ea615fb3a0edfd6ed6bb Debian-bug-id: 919856 GnuPG-bug-id: 4348 Signed-off-by: NIIBE Yutaka <[email protected]>
* ssh: Simplify the curve name lookup.Werner Koch2019-01-221-84/+54
| | | | | | | | | | | | | | | | | | | | | | * agent/command-ssh.c (struct ssh_key_type_spec): Add field alt_curve_name. (ssh_key_types): Add some alternate curve names. (ssh_identifier_from_curve_name): Lookup also bey alternative names and return the canonical name. (ssh_key_to_blob): Simplify the ECDSA case by using gcry_pk_get_curve instead of the explicit mapping. (ssh_receive_key): Likewise. Use ssh_identifier_from_curve_name to validate the curve name. Remove the reverse mapping because since GnuPG-2.2 Libgcrypt 1.7 is required. (ssh_handler_request_identities): Log an error message. -- This change will make it easier to support other curves, in particular those from tokens. Libgcrypt has a large list of alias names which we now use to to make the mapping more flexible. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit d93797c8a7892fe26672c551017468e9f8099ef6)
* agent: Fix message for ACK button.NIIBE Yutaka2018-12-191-13/+35
| | | | | | | | | | | * agent/divert-scd.c (getpin_cb): Display correct message. -- Cherry-picked master commit of: 4ed941ff26783c4fabfe2079029f8e436eb7e340 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Support --ack option for POPUPPINPADPROMPT.NIIBE Yutaka2018-12-181-1/+1
| | | | | | | | | | | | | | | | | | * agent/divert-scd.c (getpin_cb): Support --ack option. -- Cherry-picked master commit of: 827529339a4854886dbb5625238e7e01013efdcd We are now introducing "acknowledge button" feature to scdaemon, so that we can support OpenPGPcard User Interaction Flag. We will (re)use the mechanism of POPUPPINPADPROMPT for this. Perhaps, we will change the name of POPUPPINPADPROMPT, since it will be no longer for PINPAD only. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Make the S2K calibration time runtime configurable.Werner Koch2018-12-113-7/+34
| | | | | | | | | | | | | | | | | | | * agent/protect.c (s2k_calibration_time): New file global var. (calibrate_s2k_count): Use it here. (get_calibrated_s2k_count): Replace function static var by ... (s2k_calibrated_count): new file global var. (set_s2k_calibration_time): New function. * agent/gpg-agent.c (oS2KCalibration): New const. (opts): New option --s2k-calibration. (parse_rereadable_options): Parse that option. -- Note that using an unrelistic high value (like 60000) takes quite some time for calibration. GnuPG-bug-id: 3399 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit cbcc8c19541fe8407f3b6588fce1535c64cf6b25)
* agent: compile-time configuration of s2k calibration.Daniel Kahn Gillmor2018-12-111-3/+3
| | | | | | | | | | | * configure.ac: add --with-agent-s2k-calibration=MSEC, introduces AGENT_S2K_CALIBRATION (measured in milliseconds) * agent/protect.c (calibrate_s2k_count): Calibrate based on AGENT_S2K_CALIBRATION. Signed-off-by: Daniel Kahn Gillmor <[email protected]> GnuPG-bug-id: 3399 (cherry picked from commit 926d07c5fa05de05caef3a72b6fe156606ac0549)
* agent: Fix possible release of unitialize var in a genkey error case.Werner Koch2018-10-241-1/+1
| | | | | | | | | * agent/command.c (cmd_genkey): Initialize 'value'. -- GnuPG-bug-id: 4222 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 2bdc4b6ed97770ed15ec6c5afa02c2e44568a3bc)
* ssh: Fix possible infinite loop in case of an read error.Werner Koch2018-10-241-3/+4
| | | | | | | | | | * agent/command-ssh.c (ssh_handler_add_identity): Handle other errors than EOF. -- GnuPG-bug-id: 4221 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 7385e1babf6eef586c79ad23f8e541aaf608c4e5)
* agent: Fix error code check from npth_mutex_init.NIIBE Yutaka2018-09-101-2/+6
| | | | | | | | | | | | | | | | * agent/call-pinentry.c (initialize_module_call_pinentry): It's an error when npth_mutex_init returns non-zero. -- Cherry-pick from master commit of: adce73b86fd49d5bbb8884231a26cc7533d400e2 Actually, initialize_module_call_pinentry is only called once from main. So, this bug had no harm and having the static variable INITIALIZED is not needed. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Add DBUS_SESSION_BUS_ADDRESS et al. to the startup list.Werner Koch2018-06-061-7/+7
| | | | | | | | | | | | | | | | * agent/gpg-agent.c (agent_copy_startup_env): Replace explicit list with the standard list. -- Although the function agent_copy_startup_env is newer than session_env_list_stdenvnames the latter was not used. When DBUS_SESSION_BUS_ADDRESS was added to the latter it was forgotten to add it to the former as well. Having all stdnames here seems to be the Right Thing (tm) to do. GnuPG-bug-id: 3947 Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 7ffc1ac7dd95d4cc1897a4c36d5cd628741c12f2)
* agent,dirmngr: Add "getenv" to the getinfo command.Werner Koch2018-04-121-0/+18
| | | | | | | | | | | * agent/command.c (cmd_getinfo): Add sub-command getenv. * dirmngr/server.c (cmd_getinfo): Ditto. -- It is sometimes helpful to be able to inspect certain envvars in a running agent. For example "http_proxy". Signed-off-by: Werner Koch <[email protected]>
* agent: Improve the unknown ssh flag detection.Werner Koch2018-04-101-24/+31
| | | | | | | | * agent/command-ssh.c (ssh_handler_sign_request): Simplify detection of flags. -- Signed-off-by: Werner Koch <[email protected]>
* agent: unknown flags on ssh signing requests cause an error.T3880-fixT3880Daniel Kahn Gillmor2018-04-091-1/+9
| | | | | | | | | | | | | | | | | | * agent/command-ssh.c (ssh_handler_sign_request): if a flag is passed during an signature request that we do not know how to apply, return GPG_ERR_UNKNOWN_OPTION. -- https://tools.ietf.org/html/draft-miller-ssh-agent-02#section-4.5 says: If the agent does not support the requested flags, or is otherwise unable or unwilling to generate the signature (e.g. because it doesn't have the specified key, or the user refused confirmation of a constrained key), it must reply with a SSH_AGENT_FAILURE message. Signed-off-by: Daniel Kahn Gillmor <[email protected]> GnuPG-bug-id: 3880
* agent: change documentation reference for ssh-agent protocol.Daniel Kahn Gillmor2018-04-091-2/+4
| | | | | | | | | | * agent/command-ssh.c: repoint documentation reference. -- Damien Miller is now documenting the ssh-agent protocol via the IETF. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* agent: Support SSH signature flags.NIIBE Yutaka2018-04-061-1/+16
| | | | | | | | | | | | | * agent/command-ssh.c (SSH_AGENT_RSA_SHA2_256): New. (SSH_AGENT_RSA_SHA2_512): New. (ssh_handler_sign_request): Override SPEC when FLAGS is specified. -- GnuPG-bug-id: 3880 Reported-by: Daniel Kahn Gillmor <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
* agent,scd: Use pointer to represent HANDLE.NIIBE Yutaka2018-03-271-2/+2
| | | | | | | * agent/call-scd.c [HAVE_W32_SYSTEM] (start_scd): Format with %p. * scd/command.c [HAVE_W32_SYSTEM] (option_handler): Use void *. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Make the request origin a part of the cache items.Werner Koch2018-03-278-43/+51
| | | | | | | | | | | | | | | | | | | | * 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: New OPTION pretend-request-originWerner Koch2018-03-231-0/+15
| | | | | | | | | | | | | * common/shareddefs.h (request_origin_t): New. * common/agent-opt.c (parse_request_origin): New. (str_request_origin): New. * agent/command.c (option_handler): Implement new option. -- This allows to pretend that a request originated from the extra or browser socket. Signed-off-by: Werner Koch <[email protected]>
* agent: Also evict cached items via a timer.Werner Koch2018-03-063-0/+24
| | | | | | | | | | | | * agent/cache.c (agent_cache_housekeeping): New func. * agent/gpg-agent.c (handle_tick): Call it. -- This change mitigates the risk of having cached items in a post mortem dump. GnuPG-bug-id: 3829 Signed-off-by: Werner Koch <[email protected]>
* agent: Avoid appending a '\0' byte to the response of READKEYKatsuhiro Ueno2018-02-141-1/+2
| | | | | * agent/command.c (cmd_readkey): Set pkbuflen to the length of the output without an extra '\0' byte.
* common: Use new function to print status strings.Werner Koch2018-02-141-37/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | * common/asshelp2.c (vprint_assuan_status_strings): New. (print_assuan_status_strings): New. * agent/command.c (agent_write_status): Replace by call to new function. * dirmngr/server.c (dirmngr_status): Ditto. * g13/server.c (g13_status): Ditto. * g13/sh-cmd.c (g13_status): Ditto. * sm/server.c (gpgsm_status2): Ditto. * scd/command.c (send_status_info): Bump up N. -- This fixes a potential overflow if LFs are passed to the status string functions. This is actually not the case and would be wrong because neither the truncating in libassuan or our escaping is not the Right Thing. In any case the functions need to be more robust and comply to the promised interface. Thus the code has been factored out to a helper function and N has been bumped up correctly and checked in all cases. For some uses this changes the behaviour in the error case (i.e. CR or LF passed): It will now always be C-escaped and not passed to libassuan which would truncate the line at the first LF. Reported-by: private_pers
* agent: Fix last commit.NIIBE Yutaka2018-01-261-0/+3
| | | | | | | | | | | | * configure.ac: Check ucred.h as well as sys/ucred.h. * agent/command-ssh.c: Add inclusion of ucred.h. -- It was T2981, adding ucred.h for Solaris. We also need sys/ucred.h for FreeBSD and macOS. Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: More fix for get_client_pid for portability.NIIBE Yutaka2018-01-261-2/+2
| | | | | | | | | | | | * configure.ac: Check sys/ucred.h instead of ucred.h. * agent/command-ssh.c: Include sys/ucred.h. -- It's *BSD and macOS thing. Fixes-commit: f7f806afa5083617f4aba02fc3b285b06a7d73d4 Signed-off-by: NIIBE Yutaka <[email protected]>
* Change backlog from 5 to 64 and provide option --listen-backlog.Werner Koch2017-12-121-2/+14
| | | | | | | | | | | | | | * agent/gpg-agent.c (oListenBacklog): New const. (opts): New option --listen-backlog. (listen_backlog): New var. (main): Parse new options. (create_server_socket): Use var instead of 5. * dirmngr/dirmngr.c: Likewise. * scd/scdaemon.c: Likewise. -- GnuPG-bug-id: 3473 Signed-off-by: Werner Koch <[email protected]>
* doc: Fix DijkstraWerner Koch2017-12-081-2/+2
| | | | | | | -- Edsger Wybe Dijkstra (1930 --2002) - Dutch computer scientist
* agent: Fix description of shadow format.NIIBE Yutaka2017-12-083-3/+3
| | | | | | | | | | * agent/keyformat.txt, agent/protect.c, agent/t-protect.c: Fix. -- https://lists.gnupg.org/pipermail/gnupg-devel/2015-April/029680.html Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: Change intialization of assuan socket system hooks.NIIBE Yutaka2017-12-071-1/+2
| | | | | | | | | | | | | | | | * agent/gpg-agent.c (initialize_modules): Add hook again. (main): Remove setting of the system houk but add scoket system hook setting after assuan initialization. -- Thread initialization is better to be deferred after fork (in case of UNIX). assuan_sock_init should be earlier. Thus, we need to change system hooks for assuan_sock_* interface. Or else, on Windows, it may cause hang on server. Updates-commit: 1524ba9656f0205d8c6ef504f773b832a7a12ab9 GnuPG-bug-id: 3378 Signed-off-by: Werner Koch <[email protected]>
* agent: Set assuan system hooks before call of assuan_sock_init.NIIBE Yutaka2017-12-061-1/+1
| | | | | | | | | | | | | | | * agent/gpg-agent.c (initialize_modules): Move assuan_set_system_hooks. (main): ... here, just before assuan_sock_init. -- In Assuan, global variable SOCK_CTX is used internally, which is initialized by assuan_sock_init. When initialized, system hooks are copied into SOCK_CTX structure. Thus, system hooks should be set, before the call of assuan_sock_init. GnuPG-bug-id: 3378 Signed-off-by: NIIBE Yutaka <[email protected]>
* agent: New option --auto-expand-secmem.Werner Koch2017-11-241-0/+11
| | | | | | | | | | | | * agent/gpg-agent.c (oAutoExpandSecmem): New enum value. (opts): New option --auto-expand-secmem. (main): Implement that option. -- Note that this option has an effect only if Libgcrypt >= 1.8.2 is used. GnuPG-bug-id: 3530
* gpg-agent: Avoid getting stuck in shutdown pending state.Werner Koch2017-11-201-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | * agent/gpg-agent.c (handle_connections): Always check inotify fds. -- I noticed a gpg-agent processed, probably in shutdown_pending state, which was selecting on only these two inotify fds. The select returned immediately but because we did not handle the fds in shutdown_pending state they were not read and the next select call returned one of them immediately again. Actually that should not hanppen because the if (active_connections == 0) break; /* ready */ should have terminated the loop. For unknown reasons (maybe be just a connection thread terminated in a gdb session) that did not happen. By moving the check outside of the shutdown_pending condition and closing the fd after they have been triggered the code should be more robust. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 5d83eb9226c0ce608ec284d8c9bc22ce84a00c25)
* agent: Use clock or clock_gettime for calibration.NIIBE Yutaka2017-11-202-6/+10
| | | | | | | | | | | | | | | | | | * agent/protect.c (calibrate_get_time): Use clock or clock_gettime. -- For calibration, clock(3) is better than times(3) among UNIXen. Tested on NetBSD 7.1 and FreeBSD 11.1, using QEMU. Thanks to Damien Goutte-Gattat for the information of use of CLOCKS_PER_SEC; The old code with times(3) is not 100% correct, in terms of POSIX. It should have used sysconf (_SC_CLK_TCK) instead of CLOCKS_PER_SEC. CLOCKS_PER_SEC is specifically for clock(3). GnuPG-bug-id: 3056, 3276, 3472 Signed-off-by: NIIBE Yutaka <[email protected]> (cherry picked from commit 380bce13d94ff03c96e39ac1d834f382c5c730a1)
* agent: New GETINFO sub-commands "s2k_count_cal" and "s2k_time".Werner Koch2017-11-063-16/+51
| | | | | | | | | | * agent/command.c (cmd_getinfo): New sub-commands. * agent/protect.c (get_standard_s2k_count): Factor some code out to ... (get_calibrated_s2k_count): new. (get_standard_s2k_time): New. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit 52d41c8b0f4af6278d18d8935399ddad16a26856)
* agent: New option --s2k-count.Werner Koch2017-11-063-0/+16
| | | | | | | | | | | | | | | * agent/agent.h (opt): New field 's2k_count'. * agent/gpg-agent.c (oS2KCount): New enum value. (opts): New option --s2k-count. (parse_rereadable_options): Set opt.s2k_count. -- This option is useful to speed up the starting of gpg-agent and in cases where the auto-calibration runs into problems due to a broken time measurement facility. Signed-off-by: Werner Koch <[email protected]> (cherry picked from commit f7212f1d11aad5d910d2c77b2e5c6ab31a0e786e)
* agent: Fix returning GPG_ERR_NOT_FOUND wrongly.NIIBE Yutaka2017-11-021-7/+5
| | | | | | | | | | | | * agent/learncard.c (agent_handle_learn): Find SERIALNO. -- Bug is: "gpg-connect-agent learn /bye" just fails wrongly. Fixes-commit: 8c8ce8711d9c938fcb982b0341e6b052742cb887 Signed-off-by: NIIBE Yutaka <[email protected]> (cherry picked from commit 5e96fe72e477d09e35ccee48af0fd9ab2b3ae409)