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.
Stef Walter [Tue, 12 Mar 2013 17:03:25 +0000 (18:03 +0100)]
trust: Refactor to include concept of the index
* The index holds PKCS#11 objects whether for the token or for the session.
* The index provides hook for a builder to expand or validate objects
being added to the index.
* In addition theres a change hook so that a builder can maintain state
between objects, such as the compat NSS trust objects.
Stef Walter [Thu, 14 Mar 2013 10:14:52 +0000 (11:14 +0100)]
asn1: Implement a parsed ASN.1 tree cache
In order to unmarry the parser from the future builder, but still retain
efficiency, we need to be able to cache parsed ASN.1 trees. The ASN.1
cache provides this. In addition it carries around the loaded ASN.1
definitions.
Stef Walter [Fri, 15 Mar 2013 08:22:57 +0000 (09:22 +0100)]
extract: Combine trust policy when extracting
* Collapse multiple identical certificates coming from different
tokens. Note that if a certificate should not be placed multiple
times on a token. We cannot know which one to respect.
* Add a new extract filter: --trust-policy
This extracts all anchor and blacklist information
Stef Walter [Fri, 15 Mar 2013 07:23:43 +0000 (08:23 +0100)]
extract: --comment option adds comments to PEM bundles
* Placed before the certificate, simple one liner
* No need to put comments in PEM files extracted into
directories, as the file names are already descriptive.
Stef Walter [Thu, 7 Mar 2013 17:53:50 +0000 (18:53 +0100)]
p11-kit: New priority option and change trust-policy option
* Sort loaded modules appropriately using the 'priority' option. This
allows us to have a predictable order for callers, when callers
iterate through modules.
* Modules default to having an 'priority' option of '0'.
* If modules have the same order value, then sort by name.
* The above assumes the role of ordering trust-policy sources.
* Change the trust-policy option to a boolean
* Some of this code will be rearranged when the managed branch
is merged.
Stef Walter [Wed, 6 Mar 2013 18:16:09 +0000 (19:16 +0100)]
trust: Make each configured path its own token
* Each source directory or file configured into the module or passed
in as an initialization argument becomes its own token.
Previously there was one token that contained certificates from
all the configured paths.
* These tokens are clearly labeled in the token info as
to the directory or file that they represent.
* Update PKCS#11 module logic to deal with multiple tokens, validate
the slot ids and so on.
* The order in which the paths are configured will become the
order of trust priority. This is the same order in which they
are listed through 'p11-kit list-modules' and C_GetSlotList.
* Update the frob-token internal tool to only play with one path
* Adjust tests where necessary to reflect the new state of things
and add tests for modified trust module code
Stef Walter [Thu, 14 Mar 2013 09:05:17 +0000 (10:05 +0100)]
trust: Rework input path treatment
* Accept a single --with-trust-paths argument to ./configure
which cotnains all the input paths.
* The --with-system-anchors and --with-system-certificates
./configure arguments are no longer supported. Since they were
only present briefly, no provision is made for backwards
compatibility.
* Each input file is treated as containing anchors by default
unless an input certificate contains detailed trust information.
* The files in each input directory are not automatically treated
as anchors unless a certificate contains detailed trust information.
* The files in anchors/ subdirectory of each input directory are
automatically marked as anchors.
* The files in the blacklist/ subdirectory of each input directory
are automatically marked as blacklisted.
* Update tests and move around test certificates so we can
test these changes.
Stef Walter [Sun, 10 Mar 2013 20:42:49 +0000 (21:42 +0100)]
Fix up the system anchors/certificates configure arguments
Double check various combinations, and make sure we don't fail
needlessly when --disable-trust-module. Also check that actual
paths are passed into the arguments.
Stef Walter [Fri, 8 Mar 2013 07:32:50 +0000 (08:32 +0100)]
extract: Fix regression in --purpose option
The --purpose option would only match certificates that had no
purposes marked on them. Fix it so that it correctly matches
certificates with the given purpose.
Stef Walter [Sun, 3 Mar 2013 09:03:40 +0000 (10:03 +0100)]
Windows doesn't support symlinks, chmod, or atomic renames
* Don't create symlinks on windows
* No atomic renames, so delete and then rename
* Make sure to close files before unlinking on windows
* No chmod permissions on windows
Stef Walter [Sun, 3 Mar 2013 09:02:06 +0000 (10:02 +0100)]
Use mingw compatible coverage flags
The way that coverage is built and linked is different with mingw
so just use the --coverage flag to represent the correct behavior
when cross compiling.