1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Added gpg-agent OPTION "s2k-count".

When unset or 0, the calibrated count will be used.
This commit is contained in:
Ben Kibbey 2011-06-28 20:35:13 -04:00 committed by Werner Koch
parent c9e473618f
commit 137e3a0fbc
8 changed files with 41 additions and 15 deletions

View file

@ -1866,7 +1866,8 @@ cmd_import_key (assuan_context_t ctx, char *line)
if (passphrase)
{
err = agent_protect (key, passphrase, &finalkey, &finalkeylen);
err = agent_protect (key, passphrase, &finalkey, &finalkeylen,
ctrl->s2k_count);
if (!err)
err = agent_write_private_key (grip, finalkey, finalkeylen, 0);
}
@ -2474,6 +2475,14 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
{
ctrl->cache_ttl_opt_preset = *value? atoi (value) : 0;
}
else if (!strcmp (key, "s2k-count"))
{
ctrl->s2k_count = *value? strtoul(value, NULL, 10) : 0;
if (ctrl->s2k_count && ctrl->s2k_count < 65536) {
ctrl->s2k_count = 0;
err = gpg_error (GPG_ERR_INV_VALUE);
}
}
else
err = gpg_error (GPG_ERR_UNKNOWN_OPTION);