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

agent: New GETINFO sub-commands "s2k_count_cal" and "s2k_time".

* 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 <wk@gnupg.org>
(cherry picked from commit 52d41c8b0f)
This commit is contained in:
Werner Koch 2017-11-06 14:20:03 +01:00
parent 78a6d0ce88
commit 3607ab2cf3
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 69 additions and 24 deletions

View file

@ -191,16 +191,13 @@ calibrate_s2k_count (void)
}
/* Return the standard S2K count. */
/* Return the calibrated S2K count. This is only public for the use
* of the Assuan getinfo s2k_count_cal command. */
unsigned long
get_standard_s2k_count (void)
get_calibrated_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 ();
@ -209,6 +206,26 @@ get_standard_s2k_count (void)
}
/* Return the standard S2K count. */
unsigned long
get_standard_s2k_count (void)
{
if (opt.s2k_count)
return opt.s2k_count < 65536 ? 65536 : opt.s2k_count;
return get_calibrated_s2k_count ();
}
/* Return the milliseconds required for the standard S2K
* operation. */
unsigned long
get_standard_s2k_time (void)
{
return calibrate_s2k_count_one (get_standard_s2k_count ());
}
/* Same as get_standard_s2k_count but return the count in the encoding
as described by rfc4880. */
unsigned char