]> granicus.if.org Git - p11-kit/log
p11-kit
11 years agoFix uninitialized p11_library_once
manphiz@gmail.com [Wed, 24 Apr 2013 01:01:00 +0000 (01:01 +0000)]
Fix uninitialized p11_library_once

https://bugs.freedesktop.org/show_bug.cgi?id=57714

11 years agoForce Mac OS shared library extension to .so
Stef Walter [Fri, 5 Apr 2013 17:17:25 +0000 (19:17 +0200)]
Force Mac OS shared library extension to .so

Darwin and libtool seem confused about what shared library
extension they actually use.

https://bugs.freedesktop.org/show_bug.cgi?id=57714

11 years agopersist: Support for writing out p11-kit persist files
Stef Walter [Tue, 21 May 2013 19:46:27 +0000 (21:46 +0200)]
persist: Support for writing out p11-kit persist files

11 years agoconstants: Tweaks and add mechanisms
Stef Walter [Tue, 21 May 2013 19:44:22 +0000 (21:44 +0200)]
constants: Tweaks and add mechanisms

11 years agopem: Write PEM data directly to a buffer
Stef Walter [Tue, 21 May 2013 15:33:22 +0000 (17:33 +0200)]
pem: Write PEM data directly to a buffer

11 years agourl: Encode directly to a buffer
Stef Walter [Tue, 21 May 2013 14:41:09 +0000 (16:41 +0200)]
url: Encode directly to a buffer

11 years agoRelease version 0.19.1 0.19.1
Stef Walter [Mon, 27 May 2013 08:36:23 +0000 (10:36 +0200)]
Release version 0.19.1

11 years agoMark p11_kit_message() as a stable function
Stef Walter [Tue, 21 May 2013 10:38:14 +0000 (12:38 +0200)]
Mark p11_kit_message() as a stable function

11 years agoFix building of applications using CRYPTOKI_GNU style
Stef Walter [Tue, 21 May 2013 10:37:14 +0000 (12:37 +0200)]
Fix building of applications using CRYPTOKI_GNU style

11 years agoBump the version for deprecated function documentation
Stef Walter [Tue, 21 May 2013 09:35:07 +0000 (11:35 +0200)]
Bump the version for deprecated function documentation

11 years agoFix up Makefile.am files for automake 1.13 warnings
Stef Walter [Tue, 9 Apr 2013 06:34:44 +0000 (08:34 +0200)]
Fix up Makefile.am files for automake 1.13 warnings

11 years agoOur own unit testing framework
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

11 years agoFurther reorganization of the core module tracking
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.

11 years agoPull the argv parsing code into its own file
Stef Walter [Sun, 7 Apr 2013 17:39:22 +0000 (19:39 +0200)]
Pull the argv parsing code into its own file

So it can be used from multiple code paths

11 years agoSupport /xxx/yyy as an absolute path with Win32
Stef Walter [Sat, 6 Apr 2013 14:41:08 +0000 (16:41 +0200)]
Support /xxx/yyy as an absolute path with Win32

Because win32 code doesn't just run on windows, wine runs
with unix style paths.

11 years agoBump the version number to unstable
Stef Walter [Tue, 21 May 2013 08:50:53 +0000 (10:50 +0200)]
Bump the version number to unstable

11 years agoAdd the log-calls module config option
Stef Walter [Tue, 19 Feb 2013 13:05:34 +0000 (14:05 +0100)]
Add the log-calls module config option

If 'log-calls = yes' is set then all the PKCS#11 modules are logged
to stderr.

11 years agoManage C_CloseAllSessions function for multiple callers
Stef Walter [Tue, 19 Feb 2013 12:51:32 +0000 (13:51 +0100)]
Manage C_CloseAllSessions function for multiple callers

Make C_CloseAllSessions work for different callers. Track the sessions
that each caller opens and close just those when C_CloseAllSessiosn is
called.

11 years agoUpdate the proxy module to use managed PKCS#11 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.

11 years agop11-kit: Managed PKCS#11 module loading
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.

11 years agoUse libffi to implement mixins for managed code
Stef Walter [Thu, 10 Jan 2013 15:51:31 +0000 (16:51 +0100)]
Use libffi to implement mixins for managed code

 * This allows us to call into subclassed PKCS#11 modules as if
   they were plain old PKCS#11 modules
 * libffi is an optional dependency

11 years agoAdd subclassable CK_X_FUNCTION_LIST
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.

11 years agoFail early when running automaint.sh
Stef Walter [Wed, 15 May 2013 09:52:52 +0000 (11:52 +0200)]
Fail early when running automaint.sh

11 years agoImplement valgrind's hellgrind checks for threading problems
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.

11 years agoRelease version 0.18.2 0.18.2
Stef Walter [Tue, 14 May 2013 09:29:25 +0000 (11:29 +0200)]
Release version 0.18.2

11 years agoPatch to make test-lexer depend on ASN.1
manphiz@gmail.com [Thu, 9 May 2013 05:40:00 +0000 (05:40 +0000)]
Patch to make test-lexer depend on ASN.1

https://bugs.freedesktop.org/show_bug.cgi?id=64378

11 years agoReduce libtasn1 dependency to 2.3
Stef Walter [Fri, 3 May 2013 10:03:58 +0000 (12:03 +0200)]
Reduce libtasn1 dependency to 2.3

 * This passes all checks and is compatible

11 years agoRelease version 0.18.1 0.18.1
Stef Walter [Mon, 15 Apr 2013 14:09:47 +0000 (16:09 +0200)]
Release version 0.18.1

11 years agodoc: Use gtk-doc in the no-tmpl flavor
Stef Walter [Thu, 4 Apr 2013 09:11:49 +0000 (11:11 +0200)]
doc: Use gtk-doc in the no-tmpl flavor

11 years agomanual: Use a consistent docbook version
Stef Walter [Thu, 4 Apr 2013 09:10:28 +0000 (11:10 +0200)]
manual: Use a consistent docbook version

11 years agoPut the external tools in $libdir/p11-kit
Stef Walter [Thu, 4 Apr 2013 07:34:21 +0000 (09:34 +0200)]
Put the external tools in $libdir/p11-kit

These are possibly architecture specific binaries, so they should be
in $libdir/p11-kit and not in $datadir/p11-kit

11 years agoRelease version 0.18.0 0.18.0
Stef Walter [Thu, 4 Apr 2013 06:41:27 +0000 (08:41 +0200)]
Release version 0.18.0

11 years agoFix off by one in date parsing code
Stef Walter [Thu, 4 Apr 2013 06:04:51 +0000 (08:04 +0200)]
Fix off by one in date parsing code

We didn't treat the two digit year 00 as a valid year, whereas it
actually represents the year 2000. This is in a non-critical code path.

11 years agoDon't print erroneous debug messages when skipping files
Stef Walter [Thu, 4 Apr 2013 06:04:10 +0000 (08:04 +0200)]
Don't print erroneous debug messages when skipping files

The parser automatically skips over files that it cannot parse. Don't
print confusing debug messages about DER parse failures when it does so.

11 years agoUpdate to MurmurHash3
Stef Walter [Tue, 2 Apr 2013 14:33:24 +0000 (16:33 +0200)]
Update to MurmurHash3

This should also fix problems with accessing memory in a non-aligned
fashion on platforms where this causes problems.

https://bugs.freedesktop.org/show_bug.cgi?id=62819

11 years agoDon't respect timezones for CKA_START_DATE or CKA_END_DATE
Stef Walter [Fri, 29 Mar 2013 12:17:29 +0000 (13:17 +0100)]
Don't respect timezones for CKA_START_DATE or CKA_END_DATE

The PKCS#11 specification does not note what timezone these dates
are in. In addition the time values are not represented in PKCS#11.

So don't reinterpret certificate dates, other than filling in the
century for dates that have a two digit year.

Lastly, these are low resolution optional fields so not being all
strict about timezones here is appropriate.

https://bugs.freedesktop.org/show_bug.cgi?id=62825

11 years agotrust: Fix logic for matching invalid NSS serial numbers
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.

11 years agoMore compatible path munging and handling code
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.

Includes some code from LRN <lrn1986@gmail.com>

https://bugs.freedesktop.org/show_bug.cgi?id=63062

11 years agoDon't use free() on memory allocated by LocalFree()
Stef Walter [Wed, 3 Apr 2013 08:43:03 +0000 (10:43 +0200)]
Don't use free() on memory allocated by LocalFree()

ihttps://bugs.freedesktop.org/show_bug.cgi?id=63046

11 years agoSeparate library init from message code
Stef Walter [Tue, 2 Apr 2013 18:40:53 +0000 (20:40 +0200)]
Separate library init from message code

Put library init/uninit code its into their own statically
linked library so that they don't get linked into the p11-kit
executable.

Refactor the message code so that the library initialization can
plug in its per thread message buffer.

https://bugs.freedesktop.org/show_bug.cgi?id=63046

11 years agoDon't use library locks from p11-kit tool
Stef Walter [Tue, 2 Apr 2013 16:33:12 +0000 (18:33 +0200)]
Don't use library locks from p11-kit tool

The global library p11_library_mutex is for libraries to use, so don't
use it from any code in common/, which is also used by the p11-kit tool

https://bugs.freedesktop.org/show_bug.cgi?id=63046

11 years agoAdd new script for setting up p11-kit for a maintainer
Stef Walter [Wed, 3 Apr 2013 08:30:25 +0000 (10:30 +0200)]
Add new script for setting up p11-kit for a maintainer

Add win32 cross build, and build out of tree

11 years agoFix build on Win32
Stef Walter [Wed, 3 Apr 2013 08:29:26 +0000 (10:29 +0200)]
Fix build on Win32

Don't reference an undefined macro

https://bugs.freedesktop.org/show_bug.cgi?id=63046

11 years agoFix documentation so it builds out of tree
Stef Walter [Wed, 3 Apr 2013 08:19:11 +0000 (10:19 +0200)]
Fix documentation so it builds out of tree

11 years agoFix build with automake 1.13
Stef Walter [Tue, 2 Apr 2013 14:33:04 +0000 (16:33 +0200)]
Fix build with automake 1.13

Also remove some generated files from the po/ directory.

11 years agoUse CKA_X_CERTIFICATE_VALUE for trust assertions
Stef Walter [Fri, 29 Mar 2013 08:42:37 +0000 (09:42 +0100)]
Use CKA_X_CERTIFICATE_VALUE for trust assertions

These don't contain the CKA_VALUE attribute for certificate data
but rather the CKA_X_CERTIFICATE_VALUE attribute.

https://bugs.freedesktop.org/show_bug.cgi?id=62896

11 years agoDon't complain when applications call C_Logout or C_Login
Stef Walter [Thu, 28 Mar 2013 16:54:39 +0000 (17:54 +0100)]
Don't complain when applications call C_Logout or C_Login

Some callers erroneously call our C_Logout function, like NSS.
So return appropriate error codes in these cases.

https://bugs.freedesktop.org/show_bug.cgi?id=62874

11 years agoRelease version 0.17.5 0.17.5
Stef Walter [Thu, 28 Mar 2013 12:34:01 +0000 (13:34 +0100)]
Release version 0.17.5

11 years agoDon't try to guess at overflowing time values on 32-bit systems
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.

https://bugs.freedesktop.org/show_bug.cgi?id=62825

11 years agoFix testing of murmur hash on bigendian systems
Stef Walter [Mon, 25 Mar 2013 20:16:28 +0000 (21:16 +0100)]
Fix testing of murmur hash on bigendian systems

The murmur hash produces different output depending on the architecture

https://bugzilla.redhat.com/show_bug.cgi?id=927394

11 years agoRelease 0.17.4 0.17.4
Stef Walter [Wed, 20 Mar 2013 15:27:20 +0000 (16:27 +0100)]
Release 0.17.4

11 years agoFix memory leaks reported by 'make leakcheck'
Stef Walter [Wed, 20 Mar 2013 21:20:25 +0000 (22:20 +0100)]
Fix memory leaks reported by 'make leakcheck'

11 years agoFix invalid memory accesses reported by 'make memcheck'
Stef Walter [Wed, 20 Mar 2013 19:59:26 +0000 (20:59 +0100)]
Fix invalid memory accesses reported by 'make memcheck'

These are things that showed up in valgrind while running the tests.

11 years agoAdd a bit of infrastructure for running valgrind
Stef Walter [Wed, 20 Mar 2013 19:58:49 +0000 (20:58 +0100)]
Add a bit of infrastructure for running valgrind

 * make memcheck: Runs basic memory checking
 * make leakcheck: Also runs leak checking

11 years agotrust: Predictable behavior with duplicate certificates in token
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.

https://bugs.freedesktop.org/show_bug.cgi?id=62548

11 years agotrust: Rework index to be faster and more usable
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.

11 years agoattrs: Print out the CKA_VALUE for certificates when debugging
Stef Walter [Wed, 20 Mar 2013 09:55:06 +0000 (10:55 +0100)]
attrs: Print out the CKA_VALUE for certificates when debugging

While it's true that we shouldn't be pritning out CKA_VALUE in
certain cases, like for keys, we obviously can do so for certificates.

We don't have keys anyway, but in the interest of being general
purpose use the class to determine whether CKA_VALUE can be printed

11 years agohash: Add the murmur2 hash and start using it
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.

11 years agohash: Rename file and functions for hashes
Stef Walter [Wed, 20 Mar 2013 07:59:49 +0000 (08:59 +0100)]
hash: Rename file and functions for hashes

We're going to be adding other hashes. Also build as part of a
different common library.

11 years agoRelease version 0.17.3 0.17.3
Stef Walter [Tue, 19 Mar 2013 18:19:46 +0000 (19:19 +0100)]
Release version 0.17.3

11 years agotrust: Use descriptive labels for tokens
Stef Walter [Tue, 19 Mar 2013 18:03:12 +0000 (19:03 +0100)]
trust: Use descriptive labels for tokens

Try to determine which one is the system trust input token,
and which one is the default token by using datadir and sysconfdir
respectively.

https://bugs.freedesktop.org/show_bug.cgi?id=62534

11 years agotrust: Remove the temporary built in distrust objects
Stef Walter [Tue, 19 Mar 2013 18:05:56 +0000 (19:05 +0100)]
trust: Remove the temporary built in distrust objects

These should now be loaded from the .p11-kit persist format.

11 years agoextract: Make extracted output directories read-only
Stef Walter [Tue, 19 Mar 2013 16:24:47 +0000 (17:24 +0100)]
extract: Make extracted output directories read-only

This is not a security feature or anything like that, but a hint
that the files are managed by the extract tool and should not be
modified manually.

11 years agotrust: Don't use POSIX or GNU basename()
Stef Walter [Tue, 19 Mar 2013 13:50:32 +0000 (14:50 +0100)]
trust: Don't use POSIX or GNU basename()

Both are nasty. Do our own, and test it a bit

https://bugs.freedesktop.org/show_bug.cgi?id=62479

11 years agoDo not export (de)constructor
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.

11 years agoRelease version 0.17.2 0.17.2
Stef Walter [Mon, 18 Mar 2013 22:20:14 +0000 (23:20 +0100)]
Release version 0.17.2

11 years agotrust: Fix trust tests on 32-bit builds
Stef Walter [Mon, 18 Mar 2013 22:16:42 +0000 (23:16 +0100)]
trust: Fix trust tests on 32-bit builds

11 years agotrust: Fix invalid varargs call in the builder
Stef Walter [Mon, 18 Mar 2013 22:16:22 +0000 (23:16 +0100)]
trust: Fix invalid varargs call in the builder

11 years agoRelease version 0.17.1 0.17.1
Stef Walter [Mon, 18 Mar 2013 21:27:48 +0000 (22:27 +0100)]
Release version 0.17.1

 * Fix distcheck bugs surrounding the strndup() workaround

11 years agotrust: Provide better debugging of trust module functions
Stef Walter [Mon, 18 Mar 2013 20:00:53 +0000 (21:00 +0100)]
trust: Provide better debugging of trust module functions

Make C_FindObjects() and C_GetAttributeValue() functions dump the
attributes that they're dealing with when in debug mode.

11 years agoattrs: Change p11_attrs_to_string() to allow static templates
Stef Walter [Mon, 18 Mar 2013 19:59:57 +0000 (20:59 +0100)]
attrs: Change p11_attrs_to_string() to allow static templates

Allow passing the number of attributes to print, which lets us use
this directly on templates passed in by callers of the PKCS#11 API.

11 years agotrust: Handle incorrectly encoded CKA_SERIAL_NUMBER lookups
Stef Walter [Mon, 18 Mar 2013 19:05:52 +0000 (20:05 +0100)]
trust: Handle incorrectly encoded CKA_SERIAL_NUMBER lookups

Handle lookups for trust objects (by NSS) which expect CKA_SERIAL_NUMBER
attributes without appropriate DER encoding.

In addition allow creation of NSS trust objects as PKCS#11 session
objects, so that we can test this behavior.

11 years agoAdd workaround for broken strndup() in firefox
Stef Walter [Mon, 18 Mar 2013 19:03:57 +0000 (20:03 +0100)]
Add workaround for broken strndup() in firefox

Unconditionally use our own strndup() until this issue is resolved
and in the stable versions of various distros.

See: https://bugzilla.mozilla.org/show_bug.cgi?id=826171

11 years agocompat: Fix trivial comment
Stef Walter [Mon, 18 Mar 2013 19:03:03 +0000 (20:03 +0100)]
compat: Fix trivial comment

11 years agoUse the nickname x-distrusted for CKA_X_DISTRUSTED
Stef Walter [Mon, 18 Mar 2013 15:21:33 +0000 (16:21 +0100)]
Use the nickname x-distrusted for CKA_X_DISTRUSTED

This is a non-standard PKCS#11 attribute, so has the X prefix
like the other ones we've added.

11 years agotrust: Better generation of nss objects and assertions for serial+issuer
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.

11 years agoRefine looking up of attributes in arrays
Stef Walter [Mon, 18 Mar 2013 12:13:24 +0000 (13:13 +0100)]
Refine looking up of attributes in arrays

There was a class of bugs for looking up invalid or empty
attributes in the internal PKCS#11 attribute arrays.

 * Refine what p11_attrs_find_valid() treats as valid
 * Rename p11_attrs_is_empty() to p11_attrs_terminator() for clarity

11 years agotrust: Remove file that's no longer used
Stef Walter [Sun, 17 Mar 2013 06:53:21 +0000 (07:53 +0100)]
trust: Remove file that's no longer used

11 years agoBump version number
Stef Walter [Fri, 15 Mar 2013 19:50:55 +0000 (20:50 +0100)]
Bump version number

11 years agoFix distcheck and documentation
Stef Walter [Fri, 15 Mar 2013 19:50:17 +0000 (20:50 +0100)]
Fix distcheck and documentation

11 years agotrust: Update frob-nss-tool so it can compare modules for trust info
Stef Walter [Fri, 15 Mar 2013 18:38:01 +0000 (19:38 +0100)]
trust: Update frob-nss-tool so it can compare modules for trust info

Can run with two modules now so that it can compare tokens NSS
trust info.

11 years agotrust: Support a p11-kit specific serialization format
Stef Walter [Fri, 15 Mar 2013 10:50:24 +0000 (11:50 +0100)]
trust: Support a p11-kit specific serialization format

This is documented in doc/internals/ subdirectory
Add tests for the format as well.

https://bugs.freedesktop.org/show_bug.cgi?id=62156

11 years agourl: Split out the URL encoding and decoding functions
Stef Walter [Mon, 11 Mar 2013 16:17:15 +0000 (17:17 +0100)]
url: Split out the URL encoding and decoding functions

We want to use these as the format for encoding binary data
in our PKCS#11 attribute persistence

https://bugs.freedesktop.org/show_bug.cgi?id=62156

11 years agolexer: Make a lexer for our config file format
Stef Walter [Mon, 11 Mar 2013 15:36:50 +0000 (16:36 +0100)]
lexer: Make a lexer for our config file format

This lexer will be used in our PKCS#11 persistence format as well.

https://bugs.freedesktop.org/show_bug.cgi?id=62156

11 years agotrust: Use a SHA-1 hash of subjectPublicKeyInfo as CKA_ID by default
Stef Walter [Fri, 15 Mar 2013 15:24:27 +0000 (16:24 +0100)]
trust: Use a SHA-1 hash of subjectPublicKeyInfo as CKA_ID by default

This is what's recommended by the spec, and allows stapled extensions
to hang off a predictable CKA_ID.

https://bugs.freedesktop.org/show_bug.cgi?id=62329

11 years agotrust: Add a builder which builds objects out of parsed data
Stef Walter [Thu, 14 Mar 2013 20:08:01 +0000 (21:08 +0100)]
trust: Add a builder which builds objects out of parsed data

The builder completes the objects from the parsed data and takes
over the responsibilities that the parser and adapter previously
shared.

This is necessary to prepare for arbitrary data coming from
the p11-kit specific input files.

https://bugs.freedesktop.org/show_bug.cgi?id=62329

11 years agoattrs: Add info functions for constant names and values
Stef Walter [Thu, 14 Mar 2013 16:18:48 +0000 (17:18 +0100)]
attrs: Add info functions for constant names and values

 * For retrieving the name and/or nick of constants
 * The nick is what we'll use in the file format

https://bugs.freedesktop.org/show_bug.cgi?id=62329

11 years agotrust: Refactor to include concept of the index
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.

https://bugs.freedesktop.org/show_bug.cgi?id=62329

11 years agoattrs: New p11_attrs_merge() function
Stef Walter [Thu, 14 Mar 2013 10:23:47 +0000 (11:23 +0100)]
attrs: New p11_attrs_merge() function

This takes one set of attributes and merges them into
another, without copying memory needlessly.

https://bugs.freedesktop.org/show_bug.cgi?id=62329

11 years agoasn1: Implement a parsed ASN.1 tree cache
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.

https://bugs.freedesktop.org/show_bug.cgi?id=62329

11 years agoextract: Combine trust policy when extracting
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

https://bugs.freedesktop.org/show_bug.cgi?id=61497

11 years agoextract: --comment option adds comments to PEM bundles
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.

https://bugs.freedesktop.org/show_bug.cgi?id=62029

11 years agoextract: Allow p11_save_write() to automatically calculate length
Stef Walter [Fri, 15 Mar 2013 07:18:42 +0000 (08:18 +0100)]
extract: Allow p11_save_write() to automatically calculate length

Also if automatically calculating length, then ignore input
that is NULL, as something that shouldn't be written out.

This allows easier chaining of optional output, such as comments.

https://bugs.freedesktop.org/show_bug.cgi?id=62029

11 years agop11-kit: New priority option and change trust-policy option
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.

https://bugs.freedesktop.org/show_bug.cgi?id=61978

11 years agotrust: Make each configured path its own token
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

https://bugs.freedesktop.org/show_bug.cgi?id=61499

11 years agodict: Allow removal of current item in a p11_dict iteration
Stef Walter [Wed, 6 Mar 2013 18:12:28 +0000 (19:12 +0100)]
dict: Allow removal of current item in a p11_dict iteration

 * This was already possible to do safely before
 * Document and test this behavior

https://bugs.freedesktop.org/show_bug.cgi?id=61499

11 years agotrust: Rework input path treatment
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.

https://bugs.freedesktop.org/show_bug.cgi?id=62327

11 years agopem: Fix a bug decoding some PEM files
Stef Walter [Fri, 15 Mar 2013 16:07:56 +0000 (17:07 +0100)]
pem: Fix a bug decoding some PEM files

When bringing over the BSD base64 code, there was a regression.
In addition add some tests for the base64 stuff.

11 years agoDon't overwrite the build directory when uploading documentation
Stef Walter [Sun, 10 Mar 2013 19:59:36 +0000 (20:59 +0100)]
Don't overwrite the build directory when uploading documentation

11 years agoFix up the system anchors/certificates configure arguments
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.