aboutsummaryrefslogtreecommitdiffstats
path: root/src/algo_factory
Commit message (Collapse)AuthorAgeFilesLines
* The Algorithm_Factory has this logic on looking for an object:lloyd2011-07-051-4/+6
| | | | | | | | | | | | | | | | | | | | - Check the cache; if found, return value - Populate cache, if the value is already there, delete the old object and save the new one. - Recheck the cache value Raja <[email protected]> pointed out on the list that this could race if multiple threads called a lookup function in close succession while the cache was cold. All of them would fail the lookup, then each of them would add it, but the values returned would be deleted by other threads. Instead, declare that first write wins. Then, the cache stays consistent even if there is a race, the only issue is an extra search and delete. Modify GOST and Skein, as their name() function did not roundtrip properly which caused failures otherwise.
* Move PBKDF lookups to enginelloyd2010-11-042-0/+71
|
* Add a BOTAN_DEPRECATED macro which can provide compile-timelloyd2010-11-021-2/+3
| | | | deprecation warnings (at least for GCC and VC++). Use in some places.
* s/u32bit/size_t/lloyd2010-10-124-12/+12
|
* merge of '28d57385c0f1a9a2665288ce728e8b3231634f59'lloyd2010-08-031-0/+4
|\ | | | | | | and 'a4d88442d5f6b8554234c7f7468856868919b614'
| * Forbid copying an Algorithm_Factory; could easily cause double-delete,lloyd2010-07-301-0/+4
| | | | | | | | | | | | | | | | | | | | especially in a multithreaded environment, and doesn't seem like a useful operation to support. (In principle, we could support this by adding a clone() call to Algorithm_Cache, which would in turn call clone on each of it's held prototype objects, plus adding a clone to Engine. Doesn't seem worth the bother, though.
* | We've already predeclared Engine at the start of the header, so nolloyd2010-07-291-4/+4
|/ | | | reason to say `class Engine*` later on.
* Expose Algorithm_Factory::clear_caches which clears out all of thelloyd2010-07-272-1/+10
| | | | | caches; this might be useful for applications which are, say, particularly sensitive to memory usage.
* There was an interesting bug affecting dynamically loaded engines.lloyd2010-07-272-4/+14
| | | | | | | | | | | | | | | | | | | | | | | The library initializer runs some self tests; this brings objects for a few select types (AES, SHA-1, etc) into the caches. Later on, when we add a dynamic engine, the engines aren't requeried because the cache has hits. So, for instance an dlopen'ed engine that provided AES-128 would not actually be used unless you called on the algo factory with a provider of "blah" - even using set_preferred_provider would have no effect, because that's just a request. Add a new function to Algorithm_Cache, clear_cache, which just deletes everything that is currently loaded (this is 90% of the destructor). Then call this on each cache in Algorithm_Factory when a new Engine is loaded. In normal use, this should be very fast because on init the engines are loaded one after another so clear_cache() won't do much work at all, but it ensures that if you load an engine later on in runtime it will always be found. It does have the downside that the app will then requery each Engine for each new algo after this point, but I think typically loading a dynamic engine will happen very early on so this won't be too much of a hassle. (And even if it happens in the middle of execution, everything still works, it just means some overhead the first time you ask for algo X).
* In Algorithm_Factory, delete the Engines after deleting the cacheslloyd2010-07-271-2/+2
| | | | | | | | rather than before. Otherwise, we run into a problem with dynamically loaded engines: the engine will be deleted (and thus, the external library unloaded), before calling the destructors on any objects which may have been cached, so we jump to a now invalid address instead of the destructor code.
* Consolidate the two engines that provided assembler implementationslloyd2010-07-131-2/+1
| | | | | | (amd64_eng and ia32_eng) into a new asm_engine. This same engine could also be used in the event that asm code for other CPUs was added later on.
* Replace "@return a blah" and "@return the blah" with just "@return blah"lloyd2010-06-161-1/+1
|
* Yet more Doxygen commentslloyd2010-06-161-6/+18
|
* More Doxygen commentslloyd2010-06-161-0/+7
|
* More Doxygen fixeslloyd2010-06-152-2/+7
|
* Fix a few hundred Doxygen warningslloyd2010-06-151-18/+18
|
* Use "/*" instead of "/**" in starting comments at the begining of a file.lloyd2010-06-072-2/+2
| | | | | This caused Doxygen to think this was markup meant for it, which really caused some clutter in the namespace page.
* Add a couple of small patches from Thomas Capricelli <[email protected]>lloyd2010-05-211-6/+10
| | | | that enable botan to be built under the clang C++ compiler.
* Allow adding engines dynamicallylloyd2010-03-242-7/+12
|
* Minor tweak, save a line and more readable IMOlloyd2010-02-141-2/+1
|
* Doxygen commentslloyd2010-01-071-14/+63
|
* Recognize aes_isa engine, set as high prioritylloyd2010-01-061-4/+6
|
* Make many more headers internal-only.lloyd2009-12-163-4/+5
| | | | | | | | | | | | | Fixes for the amalgamation generator for internal headers. Remove BOTAN_DLL exporting macros from all internal-only headers; the classes/functions there don't need to be exported, and avoiding the PIC/GOT indirection can be a big win. Add missing BOTAN_DLLs where necessary, mostly gfpmath and cvc For GCC, use -fvisibility=hidden and set BOTAN_DLL to the visibility __attribute__ to export those classes/functions.
* Full working amalgamation build, plus internal-only headers concept.lloyd2009-12-163-5/+11
|
* Rename sse2 engine to simdlloyd2009-10-291-1/+1
|
* Remove the 'realname' attribute on all modules and cc/cpu/os info files.lloyd2009-10-291-2/+0
| | | | | Pretty much useless and unused, except for listing the module names in build.h and the short versions totally suffice for that.
* Check for cipher_mode() being set; if it is, not an algo_factory algolloyd2009-10-131-0/+4
|
* Add 'Distributed under...' text to files missing it. Some format cleanupslloyd2009-10-071-1/+4
|
* Add *s before comment lines in file headerslloyd2009-09-081-2/+2
|
* Add a script that reads the output of print_deps.py and rewriteslloyd2009-07-151-4/+9
| | | | | | the info.txt files with the right module dependencies. Apply it across the codebase.
* Thomas Moschny passed along a request from the Fedora packagers which camelloyd2009-03-303-0/+6
| | | | | | | | | | | | | | | up during the Fedora submission review, that each source file include some text about the license. One handy Perl script later and each file now has the line Distributed under the terms of the Botan license after the copyright notices. While I was in there modifying every file anyway, I also stripped out the remainder of the block comments (lots of astericks before and after the text); this is stylistic thing I picked up when I was first learning C++ but in retrospect it is not a good style as the structure makes it harder to modify comments (with the result that comments become fewer, shorter and are less likely to be updated, which are not good things).
* Fix misspelled words in algo_factory.{cpp,h}, from Charles Brockman in bug 40lloyd2009-03-022-12/+13
|
* In Algorithm_Factory, create the Algorithm_Cache<> objects dynamicallylloyd2008-11-122-30/+40
| | | | | so that algo_cache.h does not have to be visible in the source of all callers who include libstate.h/algo_factory.h
* Add comment about non-obvious but vital side effectlloyd2008-11-121-0/+5
|
* Implement the guts of Algorithm_Factory::prototoype_X using a functionlloyd2008-11-121-65/+80
| | | | template to share the search and cache management logic across all types
* Remove Library_State::add_engine and Algorithm_Factory::add_engine,lloyd2008-11-121-14/+25
| | | | | | | | replacing with an updated constructor to Algorithm_Factory taking a vector of Engine*. The semantics of adding engines at runtime were not defined nor very clear, it seems best to prohibit this unless and until it is explicitly thought through (and until a need for it presents itself).
* Add missing prov_weight.cpplloyd2008-11-121-0/+31
|
* Revert 2707eb68cb91e0633815a6d6c68d22b9f41227a4 - I had forgotten thatlloyd2008-11-121-1/+1
| | | | | | | | Engine_Iterator (and thus the public key engine code) still processes in order of first engine to last in the list. Benchmarking confirmed that GNU MP is still faster than both OpenSSL and Botan for public key operations (at least on my machine).
* Remove support for provider identifiers from SCAN_Name - it turns out thislloyd2008-11-124-152/+242
| | | | | | | | | | | | was not the right place to keep track of this information. Also modify all Algorithm_Factory constructor functions to take instead of a SCAN_Name a pair of std::strings - the SCAN name and an optional provider name. If a provider is specified, either that provider will be used or the request will fail. Otherwise, the library will attempt best effort, based on user-set algorithm implementation settings (combine with benchmark.h for choosing the fastest implementation at runtime) or if not set, a static ordering (preset in static_provider_weight in prov_weight.cpp, though it would be nice to make this easier to toggle).
* Process engines in order of addition instead of backwardslloyd2008-11-111-3/+5
|
* Wrap at 80 columnslloyd2008-11-112-4/+10
|
* Make a change in how providers are requiested in Algorithm_Factory tolloyd2008-11-111-8/+24
| | | | | | | | | | | | | | | the engines. Unfortunately right now Botan doesn't understand that a construction like HMAC, while the basic HMAC class lives only in core, can use any of a variety of implementations as the underlying algorithm. The previous version got this completely wrong (basically the first time a particular HMAC was requested, one hash provider would be chosen at random). Now instead we always use the same subprovider. This means HMAC(SHA-1) won't see a speedup even if there is an asm version available (similarly, CMAC(AES) wouldn't see a speedup with OpenSSL's AES or an engine that provided AES using VIA's or Intel's extensions). Certainly a major deficiency, but I haven't worked out how to fix it yet.
* Move most of the remaining libstate code to pk_engine.cpp, move engineslloyd2008-11-113-8/+4
| | | | | back to the toplevel since most othe dependencies have been removed now (except get_cipher which still needs changes)
* Use cache in Algorithm_Factory for cipherslloyd2008-11-113-129/+124
|
* Fix algo_cache to track aliases, all tests passlloyd2008-11-112-31/+27
|
* Add a new cache at the level of Algorithm_Factory. Intent is to replacelloyd2008-11-114-1/+149
| | | | | | | the caches included in the Engines, allowing faster search/query along and making the Engine implementations mostly or entirely stateless, also removing the need for a two-phase initialization there. Stil buggy + incomplete.
* Split asm_engine into three engines (ia32, amd64, sse2). This allowslloyd2008-11-111-1/+1
| | | | them to be individually requested as providers on lookup.
* Remove a global_state() dependency on Engine without breaking Monotonelloyd2008-11-112-0/+4
| | | | via two-stage initialization.
* Add a function to query algorithm providerslloyd2008-11-112-0/+27
|
* Move Algorithm_Factory from libstate (which it did not depend on) to ↵lloyd2008-11-113-0/+332
algo_factory/