Lines Matching refs:cache
616 static unsigned long decoder_cache_entry_hash(const DECODER_CACHE_ENTRY *cache) in decoder_cache_entry_hash() argument
621 + (cache->propquery == NULL in decoder_cache_entry_hash()
622 ? 0 : ossl_lh_strcasehash(cache->propquery)); in decoder_cache_entry_hash()
624 + (cache->input_structure == NULL in decoder_cache_entry_hash()
625 ? 0 : ossl_lh_strcasehash(cache->input_structure)); in decoder_cache_entry_hash()
627 + (cache->input_type == NULL in decoder_cache_entry_hash()
628 ? 0 : ossl_lh_strcasehash(cache->input_type)); in decoder_cache_entry_hash()
630 + (cache->keytype == NULL in decoder_cache_entry_hash()
631 ? 0 : ossl_lh_strcasehash(cache->keytype)); in decoder_cache_entry_hash()
633 hash ^= cache->selection; in decoder_cache_entry_hash()
684 DECODER_CACHE *cache = OPENSSL_malloc(sizeof(*cache)); in ossl_decoder_cache_new() local
686 if (cache == NULL) in ossl_decoder_cache_new()
689 cache->lock = CRYPTO_THREAD_lock_new(); in ossl_decoder_cache_new()
690 if (cache->lock == NULL) { in ossl_decoder_cache_new()
691 OPENSSL_free(cache); in ossl_decoder_cache_new()
694 cache->hashtable = lh_DECODER_CACHE_ENTRY_new(decoder_cache_entry_hash, in ossl_decoder_cache_new()
696 if (cache->hashtable == NULL) { in ossl_decoder_cache_new()
697 CRYPTO_THREAD_lock_free(cache->lock); in ossl_decoder_cache_new()
698 OPENSSL_free(cache); in ossl_decoder_cache_new()
702 return cache; in ossl_decoder_cache_new()
707 DECODER_CACHE *cache = (DECODER_CACHE *)vcache; in ossl_decoder_cache_free() local
709 lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free); in ossl_decoder_cache_free()
710 lh_DECODER_CACHE_ENTRY_free(cache->hashtable); in ossl_decoder_cache_free()
711 CRYPTO_THREAD_lock_free(cache->lock); in ossl_decoder_cache_free()
712 OPENSSL_free(cache); in ossl_decoder_cache_free()
721 DECODER_CACHE *cache in ossl_decoder_cache_flush() local
724 if (cache == NULL) in ossl_decoder_cache_flush()
728 if (!CRYPTO_THREAD_write_lock(cache->lock)) { in ossl_decoder_cache_flush()
733 lh_DECODER_CACHE_ENTRY_doall(cache->hashtable, decoder_cache_entry_free); in ossl_decoder_cache_flush()
734 lh_DECODER_CACHE_ENTRY_flush(cache->hashtable); in ossl_decoder_cache_flush()
736 CRYPTO_THREAD_unlock(cache->lock); in ossl_decoder_cache_flush()
752 DECODER_CACHE *cache in OSSL_DECODER_CTX_new_for_pkey() local
756 if (cache == NULL) { in OSSL_DECODER_CTX_new_for_pkey()
771 if (!CRYPTO_THREAD_read_lock(cache->lock)) { in OSSL_DECODER_CTX_new_for_pkey()
777 res = lh_DECODER_CACHE_ENTRY_retrieve(cache->hashtable, &cacheent); in OSSL_DECODER_CTX_new_for_pkey()
785 CRYPTO_THREAD_unlock(cache->lock); in OSSL_DECODER_CTX_new_for_pkey()
846 if (!CRYPTO_THREAD_write_lock(cache->lock)) { in OSSL_DECODER_CTX_new_for_pkey()
851 res = lh_DECODER_CACHE_ENTRY_retrieve(cache->hashtable, &cacheent); in OSSL_DECODER_CTX_new_for_pkey()
853 (void)lh_DECODER_CACHE_ENTRY_insert(cache->hashtable, newcache); in OSSL_DECODER_CTX_new_for_pkey()
854 if (lh_DECODER_CACHE_ENTRY_error(cache->hashtable)) { in OSSL_DECODER_CTX_new_for_pkey()
872 CRYPTO_THREAD_unlock(cache->lock); in OSSL_DECODER_CTX_new_for_pkey()