summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-11-06 13:57:30 +0100
committerWerner Koch <wk@gnupg.org>2017-11-06 15:11:13 +0100
commit78a6d0ce88ae14d8324fbab3aee3286b17e49259 (patch)
treeaf30466ae0ed4def46b81b679a7a4e26c6d3569f /agent
parentg10: Unattended key generation "Key-Grip" and "Subkey-Grip". (diff)
downloadgnupg2-78a6d0ce88ae14d8324fbab3aee3286b17e49259.tar.xz
gnupg2-78a6d0ce88ae14d8324fbab3aee3286b17e49259.zip
agent: New option --s2k-count.
* 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 <wk@gnupg.org> (cherry picked from commit f7212f1d11aad5d910d2c77b2e5c6ab31a0e786e)
Diffstat (limited to 'agent')
-rw-r--r--agent/agent.h4
-rw-r--r--agent/gpg-agent.c9
-rw-r--r--agent/protect.c3
3 files changed, 16 insertions, 0 deletions
diff --git a/agent/agent.h b/agent/agent.h
index 7bb46faa1..19f9f4997 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -171,6 +171,10 @@ struct
/* The digest algorithm to use for ssh fingerprints when
* communicating with the user. */
int ssh_fingerprint_digest;
+
+ /* The value of the option --s2k-count. If this option is not given
+ * or 0 an auto-calibrated value is used. */
+ unsigned long s2k_count;
} opt;
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 030d1da83..2e19d19c1 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -134,6 +134,8 @@ enum cmd_and_opt_values
oPuttySupport,
oDisableScdaemon,
oDisableCheckOwnSocket,
+ oS2KCount,
+
oWriteEnvFile
};
@@ -248,6 +250,8 @@ static ARGPARSE_OPTS opts[] = {
),
ARGPARSE_s_n (oEnableExtendedKeyFormat, "enable-extended-key-format", "@"),
+ ARGPARSE_s_u (oS2KCount, "s2k-count", "@"),
+
/* Dummy options for backward compatibility. */
ARGPARSE_o_s (oWriteEnvFile, "write-env-file", "@"),
ARGPARSE_s_n (oUseStandardSocket, "use-standard-socket", "@"),
@@ -819,6 +823,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
disable_check_own_socket = 0;
/* Note: When changing the next line, change also gpgconf_list. */
opt.ssh_fingerprint_digest = GCRY_MD_MD5;
+ opt.s2k_count = 0;
return 1;
}
@@ -910,6 +915,10 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
opt.ssh_fingerprint_digest = i;
break;
+ case oS2KCount:
+ opt.s2k_count = pargs->r.ret_ulong;
+ break;
+
default:
return 0; /* not handled */
}
diff --git a/agent/protect.c b/agent/protect.c
index c257861e2..ab26220f5 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -198,6 +198,9 @@ get_standard_s2k_count (void)
{
static unsigned long count;
+ if (opt.s2k_count)
+ return opt.s2k_count < 65536 ? 65536 : opt.s2k_count;
+
if (!count)
count = calibrate_s2k_count ();