| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
but might as well keep it up to date. And it's easier to do it once with
a 'perl -pi' command than to update each file over time.
Apologies to anyone looking at diffs.
|
|
|
|
|
|
|
|
|
|
|
| |
needing this functionality probably already have a preexisting configuration
system that they would rather use.
Also remove the documentation about this feature, and the example
configuration (which was pretty out of date, anyway).
RFC on this change sent to the mailing list on 11-13-2007, no responses
after 24 hours. It seems quite likely this code is not in use anywhere.
|
|
|
|
|
| |
Library_State::initialize: now the LibraryInitializer is just a simple
wrapper to create/destroy the state with no other operations.
|
|
|
|
|
|
|
|
| |
that called global_state(), which cased an infinite recursion.
Make creating a Library_State a two-phase operation, first an empty constructor
(just sets all pointers to NULL), then an initializer that sets up everything
needed to start up the library.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
LibraryInitializer::initialize(), which will set it for us (or fail by
throwing an exception, which will be propogated to the caller). So any
instances of creating a LibraryInitializer where no option arguments
are passed can be removed; instead that initialization will run when
or if you execute an operation where Botan requires the services
provided in the state. Because no options are passed, the library will
be using the default (debug and not thread safe) mutex type: so
hopefully you'll quickly get an exception when the debug mutex
realizes it is being used in a threaded application, but there is risk
of operations silently failing before that happens.
You can call LibraryInitializer::deinitialize() at the end of your
main function (or whenever you think you won't need Botan anymore), to
free the global state; if not a number of cleanup destructors will not
run (including the final scrub of memory).
You can even shut down Botan speculatively; if it turns out you need
it again, it just means you'll have to take the cost of another
initialization. However in applications that use Botan only in small
bursts, or in rarely taken codepaths, you can remove the state
entirely and suffer zero memory overhead. This probably only makes
sense in memory constrained systems, but it's reasonable to do now.
Speculatively deallocating the state is probably not thread safe
without extra work. One thread calling deinitialize() would invalidate
pointers that would have been visible to other threads. One (untested)
idea: have an atomic integer with the number of current threads using
Botan. If any thread decrements and hits zero, it could deinitialize
Botan safely. This might cause too many repeated startup/shutdowns,
which would depend on the app use pattern.
In addition, since you can't pass arguments to the new Library_State,
you can't specify the use of real mutexes (or anything else): so for
right now, this only works in applications that are fine with the
standard options. I want to find a way to get that working, though,
since it's very inelegant. Currently a Default_Mutex (not at all
thread safe but somewhat error checking) will be used. And self test
will always be run (more on that below).
I wrote a program that just initializes and shuts down in a tight
loop. Running on my Gentoo box (Core2 E6400, gcc 4.1.2):
thread_safe? selftest? time (ms)
------------ --------- ---------
no yes 6.1
no no 3.8
yes yes 6.7
yes no 3.8
If you're actually worried that the library might start up OK but then
start failing basic self tests, what you actually want to do is have a
thread that runs diagnostics on your entire process state (including
calling Botan's self test code) every N seconds.
The question is how to get arguments from the outside world to the
constructor of the Library_State that is created inside of
global_state(): avoiding many self tests to save a bit of time (many
applications won't care about the extra cost but sometimes 2 or 3 ms
is important), and thread safety (beacuse you can't specify to use a
real mutex).
|
| |
|
|
|
|
|
| |
global state pointer was set. Presumably I put that there for debugging
at some point and let it escape.
|
| |
|
|
|
|
|
| |
as I can tell) the last of the global data, with the exception of the single
global_lib_state pointer in libstate.cpp
|
|
|
|
|
| |
of the list. The only time when the other behavior was desired was inside
the load() function, which now simply appends to the engines vector itself.
|
|
|
|
|
|
|
|
|
|
| |
handle the case where an allocator is added that has the same name as one
already registered.
Flush the cached allocator pointer when the default is changed.
Mark comparison operations in Pooling_Allocator::Memory_Block as inline;
this seems to help the STL sort and binary search algorithms tremendously.
|
| |
|
|
|
|
|
|
| |
otherwise any Engines added after startup (eg, application-specific
ones) would only be used for new algorithm - it wouldn't be possible
for them to override existing implementations.
|
| |
|
|
|
|
|
|
|
|
| |
mutex_factory argument is NULL.
Have Init::initialize() pass either a new Mutex_Factory (the
default no-op version), or the result of modules.mutex_factory(),
depending on the value of args.thread_safe()
|
|
|
|
| |
Use for_each + the delete wrappers in libstate.cpp
|
|
|
|
| |
like iconv may be useful there...)
|
|
|
|
|
| |
of stand-alone functions. Store the configuration in a distinct
object, rather than just a map inside the library state.
|
| |
|
|
|
|
| |
not completely happy with it.
|
|
|
|
|
|
| |
Alter the AEP engine to use one in favor of a static Mutex pointer.
Fix a stupid typo in an exception message.
|
| |
|
|
|
|
| |
of initialization in the constructor.
|
|
|
|
| |
around as ancillary strings.
|
| |
|
|
|
|
|
|
| |
Initialize the X.509 global state object lazily, on first access
Alter the order that global objects are deleted.
|
|
|
|
|
| |
the return value of swap_global_state rather than manipulate the
state object directly.
|
|
|
|
|
| |
Initialize the X509_GlobalState pointer during Library_State
construction.
|
|
|
|
| |
Initial implementation of a factory for extension objects
|
|
|
|
| |
simultaneous library states.
|
|
|
|
| |
set conversions, to replace the current hardcoded stuff.
|
|
|
|
|
| |
that uses them. These changes are not backwards compatible, this commit
updates all uses of the APIs within the library.
|
|
|