diff options
-rw-r--r-- | src/algo_factory/algo_factory.cpp | 6 | ||||
-rw-r--r-- | src/algo_factory/algo_factory.h | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/algo_factory/algo_factory.cpp b/src/algo_factory/algo_factory.cpp index 16ac589a1..6bd66d349 100644 --- a/src/algo_factory/algo_factory.cpp +++ b/src/algo_factory/algo_factory.cpp @@ -108,13 +108,17 @@ Algorithm_Factory::~Algorithm_Factory() std::for_each(engines.begin(), engines.end(), del_fun<Engine>()); } -void Algorithm_Factory::add_engine(Engine* engine) +void Algorithm_Factory::clear_caches() { block_cipher_cache->clear_cache(); stream_cipher_cache->clear_cache(); hash_cache->clear_cache(); mac_cache->clear_cache(); + } +void Algorithm_Factory::add_engine(Engine* engine) + { + clear_caches(); engines.push_back(engine); } diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h index 5e0e49f13..f7e85202b 100644 --- a/src/algo_factory/algo_factory.h +++ b/src/algo_factory/algo_factory.h @@ -50,6 +50,11 @@ class BOTAN_DLL Algorithm_Factory void add_engine(class Engine* engine); /** + * Clear out any cached objects + */ + void clear_caches(); + + /** * @param algo_spec the algorithm we are querying * @returns list of providers of this algorithm */ |