Stef Walter [Fri, 28 Jun 2013 11:27:42 +0000 (13:27 +0200)]
trust: Implement reloading of token data
* Reload token data whenever a new session is opened.
* Only reload files/directories that have changed.
* Move duplicate anchor/blacklist detection logic into
the extract code. This is in line with the approach
being discussed on the mailing lists and spec document.
* New internal attribute CKA_X_ORIGIN set on all objects
so we can track where an object came from, and replace
it when reloaded.
In general this is a prerequisite for modification of objects
reload before modify is necessary to prevent multiple callers
clobbering each other's changes.
Stef Walter [Fri, 28 Jun 2013 11:00:02 +0000 (13:00 +0200)]
iter: Add iteration mode where session is not busy
In order to use the session we are iterating on for other tasks
such as other C_FindObject() calls, we need to make sure that
it's not in the middle of a find operation. Finish up the
complete find operation in advance of returning objects from
a session.
Make this the default mode. The previous behavior remains
as an option. Add tests.
Stef Walter [Mon, 24 Jun 2013 11:34:30 +0000 (13:34 +0200)]
Reorganize various components
* p11-kit library and tool in the p11-kit/ subdirectory
* trust module and new trust tool in trust/ subdirectory
* No more tools/ subdirectory
* Lots less in the common/ subdirectory
Stef Walter [Fri, 14 Jun 2013 20:00:42 +0000 (22:00 +0200)]
trust: Writable module PKCS#11 token functions
Although we don't actually write anything out yet, make the
various PKCS#11 functions behave properly when faced with
requests to write to token objects
Stef Walter [Mon, 17 Jun 2013 12:36:37 +0000 (14:36 +0200)]
tools: Only use our private path when looking for external commands
Instead of looking for external commands in the path, just look
for them in our private directory.
We want to be conservative early on, and limit what sorta things
we have to maintain later. We can later remove this restriction
if a real use case presents itself.
Stef Walter [Fri, 5 Apr 2013 21:52:39 +0000 (23:52 +0200)]
Our own unit testing framework
* Support the TAP protocol
* Much cleaner without having to carry around state
* First class support for setup/teardown
* Port the common tests
* Wait on porting other tests until we've merged outstanding code
Stef Walter [Sat, 6 Apr 2013 14:42:01 +0000 (16:42 +0200)]
Further reorganization of the core module tracking
* Keep the module ownership apart from the tracking of module
function pointers, since these are only relevant for unmanaged
modules.
* Less assumptions that each module has a raw unmanaged module
function pointer.
* More clarity in the naming of dictionaries tracking the modules.
Stef Walter [Fri, 15 Feb 2013 20:34:20 +0000 (21:34 +0100)]
Update the proxy module to use managed PKCS#11 modules
Each time C_GetFunctionList is called on the proxy module, a new
managed PKCS#11 set of functions is returned. These are all cleaned
up when the module is unloaded.
We want the proxy module to continue to work even without the highly
recommended libffi. For that reason we still keep the old behavior of
sharing state in the proxy module.
Stef Walter [Wed, 6 Feb 2013 20:57:45 +0000 (21:57 +0100)]
p11-kit: Managed PKCS#11 module loading
Support a new managed style module loading for PKCS#11 modules. This
allows us to better coordinate between multiple callers of the same
PKCS#11 modules and provide hooks into their behavior.
This meant redoing the public facing API. The old methods are now
deprecated, marked and documented as such.
Stef Walter [Thu, 14 Feb 2013 14:41:45 +0000 (15:41 +0100)]
Add subclassable CK_X_FUNCTION_LIST
One of the flaws in PKCS#11 for our usage is that each PKCS#11 module
is not passed the pointer to the function list, ie: the vtable
Here we define a new function list vtable, where each PKCS#11 function
takes the vtable itself as the first argument. We use this new
list internally to represent subclassable PKCS#11 modules for
various features.
Stef Walter [Wed, 15 May 2013 09:51:22 +0000 (11:51 +0200)]
Implement valgrind's hellgrind checks for threading problems
And cleanup our locks/locking model. There's no need to use
recursive locks, especially since we can't use them on all
platforms. In addition adjust taking of locks during initialization
so that there's no chance of deadlocking here.
Stef Walter [Fri, 29 Mar 2013 12:40:44 +0000 (13:40 +0100)]
trust: Fix logic for matching invalid NSS serial numbers
Sometimes NSS queries for trust objects using invalid serial numbers
that do not have their DER decoding. We fixed this earlier, but want
to make sure there are no corner cases, accidentally not matching
serial numbers that happen to start with the same bytes as a DER
TLV would.
Stef Walter [Wed, 3 Apr 2013 08:50:59 +0000 (10:50 +0200)]
More compatible path munging and handling code
Centralize the path handling code, so we can remove unixy assumptions
and have a chance of running on Windows. The current goal is to run
all the tests on Windows.
Stef Walter [Wed, 27 Mar 2013 16:54:38 +0000 (17:54 +0100)]
Don't try to guess at overflowing time values on 32-bit systems
Since CKA_START_DATE and CKA_END_DATE are the only places
where we want to parse out times, and these are optional, just
leave blank if the time overflows what libc can handle on
a 32-bit system.
Stef Walter [Wed, 20 Mar 2013 14:53:43 +0000 (15:53 +0100)]
trust: Predictable behavior with duplicate certificates in token
If duplicate certificates are present in a token, we warn about this,
and don't really recommend it. However we have predictable behavior
where blacklist is prefered to anchor is preferred to unknown trust.
Stef Walter [Wed, 20 Mar 2013 13:35:27 +0000 (14:35 +0100)]
trust: Rework index to be faster and more usable
The index now uses a sort of cross between a hash table and a bloom
filter internally to select matching items. This is needed for the
massive amount of lookups we want to do during loading.
In addition make p11_index_find() and p11_index_replace() easier
to use.
Stef Walter [Wed, 20 Mar 2013 08:33:04 +0000 (09:33 +0100)]
hash: Add the murmur2 hash and start using it
Add implementation of the murmur2 hash function, and start using
it for our dictionaries. Our implementation is incremental
like our other hash functions.
Also remove p11_oid_hash() which wasn't being used.
In addition fix several tests whose success was based on the
way that the dictionary hashed. This was a hidden testing bug.
Andreas Metzler [Tue, 19 Mar 2013 11:58:32 +0000 (12:58 +0100)]
Do not export (de)constructor
Rename p11_kit_init and p11_kit_fini to _p11_kit_init and _p11_kit_fini
respectively to stop them from being exported in the ABI. It does not seem
to be necessary.
Stef Walter [Mon, 18 Mar 2013 15:00:55 +0000 (16:00 +0100)]
trust: Better generation of nss objects and assertions for serial+issuer
In many cases certficates are distrusted by serial+issuer. Make sure
this works, and fix various cases where we weren't generating
compat NSS objects and compat trust assertions for these types
of input.