Stef Walter [Tue, 17 Jul 2012 06:06:28 +0000 (08:06 +0200)]
Use Windows thread ids instead of handles for comparisons
* It seems that the HANDLE's returned from GetCurrentThread
are often equal for two threads. GetCurrentThreadID doesn't
have this problem.
* Separate our cross platform thread_t and thread_id_t types
even though on unix they're the same thing.
Stef Walter [Mon, 16 Jul 2012 15:56:24 +0000 (17:56 +0200)]
Use '.module' extension on module configs
* And want alphanumeric/_.- filenames
* Currently this is just a warning, soon it will be enforced
* The name of a module does not include the extension
Andreas Metzler and Ubuntu both worked on this patch, and I've made
some more changes.
See https://bugs.launchpad.net/ubuntu/+source/p11-kit/+bug/911436
Stef Walter [Fri, 8 Jun 2012 07:29:59 +0000 (09:29 +0200)]
Fix the flags in pin.h
* Due to a brain fart the P11_KIT_PIN_* flags were not
bit flags but decimal numbers.
* This necessarily breaks API/ABI for users of the
P11_KIT_PIN_FLAGS_RETRY, P11_KIT_PIN_FLAGS_MANY_TRIES and
P11_KIT_PIN_FLAGS_FINAL_TRY flags. But those wouldn't have
worked anyway.
Stef Walter [Sun, 13 May 2012 20:27:07 +0000 (22:27 +0200)]
Preconditions to check for input probs and out of memory
* We don't try to guarantee completely robust and problem
free behavior in cases where the caller or process isn't
behaving. We consider these to be outside of our control.
Stef Walter [Sun, 1 Apr 2012 19:53:04 +0000 (21:53 +0200)]
Add enable-in and disable-in options to module config
* These can be used to load certain modules in certain
programs, or prevent loading in others.
* Useful for a key manager like seahorse, so we can load
extra modules (think NSS) that other modules shouldn't
load.
Stef Walter [Tue, 27 Mar 2012 10:14:56 +0000 (12:14 +0200)]
Fix broken hashmap behavior
* We were relying on undefined gcc behavior related to the &
operator.
* This would show up as a test failure when running with -O2 on
certain GCC versions, as well as failure on clang 3.1
Stef Walter [Mon, 23 Jan 2012 08:09:31 +0000 (09:09 +0100)]
Remove automatic reinitialization of PKCS#11 after fork
* First of all one should only call async-signal-safe functions
from the callbacks of pthread_atfork(), and so we cannot
reinitialize directly.
* Some modules use pthread_atfork() to detect forking and setup
their internal state. If we call into them in our pthread_atfork()
callback then this is inherently racy.
* There was danger of endless loops and deadlocks which are caused
by handlers which fork in their C_Initialize
* Many processes do fork/exec, reinitializing PKCS#11 for these
forks is quite resourc intensive when the child process won't use
PKCS#11 at all.
Stef Walter [Tue, 20 Dec 2011 14:18:37 +0000 (15:18 +0100)]
Reorganize tests, work around optimization bug
* Encountered a gcc optimization bug in gcc 4.6.1 which seems to
be reordering related function calls eroneously. This bug seems
to be fixed in 4.6.2.
* Reorganize test code to get around this bug building on mingw,
and ubuntu 11.10, both of which use gcc 4.6.1
Stef Walter [Sat, 29 Oct 2011 07:46:02 +0000 (00:46 -0700)]
Make build not depend on gtk-doc or pkg-config
* If enabled, gtk-doc can be used, but we no longer expect the
gtkdoc autoconf/automake macro files to be installed.
* pkg-config is no longer used for checks.
* We still do install pkg-config files, and this is the preferred
way to build against and link to p11-kit.
Stef Walter [Mon, 17 Oct 2011 12:51:31 +0000 (14:51 +0200)]
Initial port to win32
* Tests do not all yet pass, at least not on wine
* Added abstraction of some non-portable functions in compat.h/c
* Build with an argument like this for win32 support:
./autogen.sh --host=i586-mingw32msvc
* This win32 port needs more work from interested parties
Stef Walter [Mon, 10 Oct 2011 15:32:34 +0000 (17:32 +0200)]
Only call C_Initialize and C_Finalize once per module
* Do not concurretnly call C_Initialize or C_Finalize in a module
* The PKCS#11 spec indicates that mone thread should call those functions.
* It's reasonable for a module to expect to only be initialized or
finalized in one thread.
* In particular NSS does not lock its C_Initialize or C_Finalize.
Kalev Lember [Wed, 14 Sep 2011 05:10:46 +0000 (08:10 +0300)]
When a module has a relative path, load it from $libdir/pkcs11
So far we have only supported full paths to the pkcs11 modules in config
files. This change adds relative path support, so that for modules
installed under the standard $libdir/pkcs11, the config file won't have
to spell out the full path.
Stef Walter [Sun, 14 Aug 2011 16:45:19 +0000 (18:45 +0200)]
Safer initialization of individually initialized module.
* More checks for out of memory.
* Take more of the same code paths when initializing a single
module as when initializing registered, or loading from file.
* Cleanup halfway initialized globals if fail during init.
Stef Walter [Wed, 3 Aug 2011 09:37:40 +0000 (11:37 +0200)]
Don't fail when duplicate modules are configured.
* Duplicate modules may be caused by editor backups, misconfigurations
or a multitude of other sources. Failing dead is a bit harsh.
* After discussing gnutls needs with Nikos
Stef Walter [Wed, 27 Jul 2011 10:02:25 +0000 (12:02 +0200)]
Create a link for the proxy module.
* Install proxy module at its own path which is not prefixed by 'lib'
* Since the proxy module is the same as the library, and actually
needs to be loaded as the same library in memory (due to resource
tracking per process), use a symlink for proxy.
* Add a variable to the pkg-config file which shows the path
to the proxy module. ie:
$ pkg-config --variable=proxy_module p11-kit-1
Stef Walter [Wed, 27 Jul 2011 09:24:55 +0000 (11:24 +0200)]
Reimplement and remove apache licensed bits of code.
* Reimplement the various bits of the hash table that were
still based on the apache apr code. Use different algorithms
for hashing, lookup and other stuff.
* Use this as an opportunity to cleanup that code and make
it more legible.
Colin Walters [Mon, 18 Jul 2011 14:59:54 +0000 (10:59 -0400)]
build: Make autogen.sh work
* We were missing a call to gettextize, which is what copies in config.rpath
* Delete ABOUT-NLS, it is copied in by gettextize
* While we're here, take a page from gtk+'s autogen.sh and just use autoreconf,
instead of specifying everything.
* We need to always have an m4/ directory, so that gettextize works,
so we make a dummy empty file
* Apparently gettextize is totally insane, requiring user input etc. Copy
in some hacks from Avahi's autogen.sh to work around this.