From 9a44fc51420a873e2a42b57cd9b0bdf6e3a204b6 Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 28 Aug 2017 11:05:51 +0000 Subject: [PATCH] - Small fixes for the shared secret cache patch. git-svn-id: file:///svn/unbound/trunk@4313 be551aaa-1e26-0410-a405-d3ace91eadb9 --- dnscrypt/dnscrypt.c | 7 ++++--- doc/Changelog | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dnscrypt/dnscrypt.c b/dnscrypt/dnscrypt.c index 3bf89475a..4d6518d0d 100644 --- a/dnscrypt/dnscrypt.c +++ b/dnscrypt/dnscrypt.c @@ -55,7 +55,7 @@ struct shared_secret_cache_key { /** the hash table key */ uint8_t key[DNSCRYPT_SHARED_SECRET_KEY_LENGTH]; - /** the hash table entry, data is struct reply_info* */ + /** the hash table entry, data is uint8_t pointer of size crypto_box_BEFORENMBYTES which contains the shared secret. */ struct lruhash_entry entry; }; @@ -786,7 +786,7 @@ dnsc_apply_cfg(struct dnsc_env *env, struct config_file *cfg) env->shared_secrets_cache = slabhash_create( cfg->msg_cache_slabs, HASH_DEFAULT_STARTARRAY, - cfg->msg_cache_size, + 4000000, dnsc_shared_secrets_sizefunc, dnsc_shared_secrets_compfunc, dnsc_shared_secrets_delkeyfunc, @@ -820,12 +820,13 @@ dnsc_delete(struct dnsc_env *env) */ size_t -dnsc_shared_secrets_sizefunc(void *k, void *d) +dnsc_shared_secrets_sizefunc(void *k, void* ATTR_UNUSED(d)) { struct shared_secret_cache_key* ssk = (struct shared_secret_cache_key*)k; size_t key_size = sizeof(struct shared_secret_cache_key) + lock_get_mem(&ssk->entry.lock); size_t data_size = crypto_box_BEFORENMBYTES; + (void)ssk; /* otherwise ssk is unused if no threading, or fixed locksize */ return key_size + data_size; } diff --git a/doc/Changelog b/doc/Changelog index 89602d30d..1946a94a4 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -3,6 +3,7 @@ - iana portlist update - Fix #1415: [dnscrypt] shared secret cache, patch from Manu Bretelle. + - Small fixes for the shared secret cache patch. 23 August 2017: Wouter - Fix #1407: Add ECS options check to unbound-checkconf. -- 2.47.3