aboutsummaryrefslogtreecommitdiffstats
path: root/sm/gpgsm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sm/gpgsm.c')
-rw-r--r--sm/gpgsm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sm/gpgsm.c b/sm/gpgsm.c
index 400479b1b..ac80fadde 100644
--- a/sm/gpgsm.c
+++ b/sm/gpgsm.c
@@ -500,6 +500,7 @@ static struct debug_flags_s debug_flags [] =
static struct compatibility_flags_s compatibility_flags [] =
{
{ COMPAT_ALLOW_KA_TO_ENCR, "allow-ka-to-encr" },
+ { COMPAT_NO_CHAIN_CACHE, "no-chain-cache" },
{ 0, NULL }
};
@@ -536,6 +537,9 @@ static int default_include_certs = DEFAULT_INCLUDE_CERTS;
/* Whether the chain mode shall be used for validation. */
static int default_validation_model;
+/* Counter used to convey data from deinit_ctrl to gpgsm_exit. */
+static unsigned int parent_cache_stats;
+
/* The default cipher algo. */
#define DEFAULT_CIPHER_ALGO "AES256"
@@ -2354,6 +2358,7 @@ gpgsm_exit (int rc)
gcry_control (GCRYCTL_UPDATE_RANDOM_SEED_FILE);
if (opt.debug & DBG_MEMSTAT_VALUE)
{
+ log_info ("cert_chain_cache: cached=%u\n", parent_cache_stats);
gcry_control( GCRYCTL_DUMP_MEMORY_STATS );
gcry_control( GCRYCTL_DUMP_RANDOM_STATS );
}
@@ -2381,9 +2386,22 @@ gpgsm_init_default_ctrl (struct server_control_s *ctrl)
void
gpgsm_deinit_default_ctrl (ctrl_t ctrl)
{
+ unsigned int n;
+
gpgsm_keydb_deinit_session_data (ctrl);
xfree (ctrl->revocation_reason);
ctrl->revocation_reason = NULL;
+ n = 0;
+ while (ctrl->parent_cert_cache)
+ {
+ cert_cache_item_t next = ctrl->parent_cert_cache->next;
+ ksba_cert_release (ctrl->parent_cert_cache->result);
+ xfree (ctrl->parent_cert_cache);
+ ctrl->parent_cert_cache = next;
+ n++;
+ }
+ if (n > parent_cache_stats)
+ parent_cache_stats = n;
}