aboutsummaryrefslogtreecommitdiffstats
path: root/agent/protect.c
diff options
context:
space:
mode:
Diffstat (limited to 'agent/protect.c')
-rw-r--r--agent/protect.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/agent/protect.c b/agent/protect.c
index ab26220f5..3073fc4de 100644
--- a/agent/protect.c
+++ b/agent/protect.c
@@ -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