summaryrefslogtreecommitdiffstats
path: root/agent/protect.c
diff options
context:
space:
mode:
authorDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-09-08 23:08:57 +0200
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>2017-09-08 23:08:57 +0200
commit926d07c5fa05de05caef3a72b6fe156606ac0549 (patch)
tree2d3fc8fff8e5fbbb7f94c2a4548d2390536e55fd /agent/protect.c
parentgpg: default to AES-256. (diff)
downloadgnupg2-926d07c5fa05de05caef3a72b6fe156606ac0549.tar.xz
gnupg2-926d07c5fa05de05caef3a72b6fe156606ac0549.zip
agent: compile-time configuration of s2k calibration.
* 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 <dkg@fifthhorseman.net> GnuPG-bug-id: 3399
Diffstat (limited to 'agent/protect.c')
-rw-r--r--agent/protect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/agent/protect.c b/agent/protect.c
index c257861e2..9b262a978 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -159,7 +159,7 @@ calibrate_s2k_count_one (unsigned long count)
/* Measure the time we need to do the hash operations and deduce an
- S2K count which requires about 100ms of time. */
+ S2K count which requires roughly some targeted amount of time. */
static unsigned long
calibrate_s2k_count (void)
{
@@ -171,11 +171,11 @@ calibrate_s2k_count (void)
ms = calibrate_s2k_count_one (count);
if (opt.verbose > 1)
log_info ("S2K calibration: %lu -> %lums\n", count, ms);
- if (ms > 100)
+ if (ms > AGENT_S2K_CALIBRATION)
break;
}
- count = (unsigned long)(((double)count / ms) * 100);
+ count = (unsigned long)(((double)count / ms) * AGENT_S2K_CALIBRATION);
count /= 1024;
count *= 1024;
if (count < 65536)