aboutsummaryrefslogtreecommitdiffstats
path: root/agent/gpg-agent.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-12-11 17:12:51 +0000
committerWerner Koch <[email protected]>2018-12-11 17:14:38 +0000
commitde29a50e7c8a779ac0832a149bcf3eb2c4191dc9 (patch)
treebe070ca7882119e6266df00d28bd4f229937102b /agent/gpg-agent.c
parentagent: compile-time configuration of s2k calibration. (diff)
downloadgnupg-de29a50e7c8a779ac0832a149bcf3eb2c4191dc9.tar.gz
gnupg-de29a50e7c8a779ac0832a149bcf3eb2c4191dc9.zip
agent: Make the S2K calibration time runtime configurable.
* 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)
Diffstat (limited to 'agent/gpg-agent.c')
-rw-r--r--agent/gpg-agent.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c
index 1fdc94d0f..ffd85d196 100644
--- a/agent/gpg-agent.c
+++ b/agent/gpg-agent.c
@@ -135,6 +135,7 @@ enum cmd_and_opt_values
oDisableScdaemon,
oDisableCheckOwnSocket,
oS2KCount,
+ oS2KCalibration,
oAutoExpandSecmem,
oListenBacklog,
@@ -253,6 +254,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oEnableExtendedKeyFormat, "enable-extended-key-format", "@"),
ARGPARSE_s_u (oS2KCount, "s2k-count", "@"),
+ ARGPARSE_s_u (oS2KCalibration, "s2k-calibration", "@"),
ARGPARSE_op_u (oAutoExpandSecmem, "auto-expand-secmem", "@"),
@@ -834,6 +836,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
/* Note: When changing the next line, change also gpgconf_list. */
opt.ssh_fingerprint_digest = GCRY_MD_MD5;
opt.s2k_count = 0;
+ set_s2k_calibration_time (0); /* Set to default. */
return 1;
}
@@ -929,6 +932,10 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
opt.s2k_count = pargs->r.ret_ulong;
break;
+ case oS2KCalibration:
+ set_s2k_calibration_time (pargs->r.ret_ulong);
+ break;
+
default:
return 0; /* not handled */
}