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.
Stef Walter [Wed, 6 Feb 2013 21:16:42 +0000 (22:16 +0100)]
Only do shared object and DLL initialization in libraries
Don't do library initialization on shared object load when not running
in a library. We'll want to plug into this and do different things
per library in the future.
Stef Walter [Wed, 23 Jan 2013 11:15:27 +0000 (12:15 +0100)]
Implement code for writing PEM
* Based on the gcr code
* Bring in base64 output code from BSD
* Make sure to output base64 lines of 64 character length since
this is what OpenSSL expects
Stef Walter [Wed, 23 Jan 2013 16:35:58 +0000 (17:35 +0100)]
Support for sane writing to files extracted
* Implement atomic writes of files
* Writing with checks that not overwriting anything unless desired
* Writing and overwriting of directory contents in a robust way
Stef Walter [Fri, 4 Jan 2013 12:57:28 +0000 (13:57 +0100)]
Implement trust assertion PKCS#11 objects
* Implement trust assertions for anchored and distrusted certs
* Pinned certificate trust assertions are not implemented yet
* Add an internal tool for pulling apart bits of certificates
Stef Walter [Thu, 3 Jan 2013 10:07:47 +0000 (11:07 +0100)]
Fill in certificate authority and trust data correctly
* Fill in CKA_CERTIFICATE_CATEGORY properly for authorities
based on the presence of BasicConstraints and/or v1 certificates
* Fill in CKA_TRUSTED and CKA_X_DISTRUSTED based on whether the
parser is running for anchors or blacklist
* In addition support the concept of blacklisted certificates mixed
in with the anchors (without any purposes) since that's what exists
in the real world.
* We do this after the various hooks have had a chance to mess
with the certificate extensions and such.
* Use stapled certificate extensions to represent loaded trust policy
* Build NSS trust objects from stapled certificate extensions
* Add further attribute debugging for NSS trust objects
* Use a custom certificate extension for the OpenSSL reject purpose data
* Use SubjectKeyIdentifier for OpenSSL keyid data
* Use ExtendedKeyUsage for OpenSSL trust purpose data
* Implement simple way to handle binary DER OIDs, using the DER TLV
length. DER OIDs are used in the CKA_OBJECT_ID value, and elsewhere.
* Split out the building of NSS trust objects from the main parser
Stef Walter [Thu, 24 Jan 2013 10:28:47 +0000 (11:28 +0100)]
Add basic checksum algorithms
The SHA-1 and MD5 digests here are used for checksums in legacy
protocols. We don't use them in cryptographic contexts at all.
These particular algorithms would be poor choices for that.
Stef Walter [Tue, 29 Jan 2013 10:43:09 +0000 (11:43 +0100)]
Make the p11-kit tool have distinct commands
* Change the -l argument into the list-modules command.
* Add proper functions for printing usage
* Support for external commands in the path or /usr/share/p11-kit
Stef Walter [Thu, 24 Jan 2013 13:36:59 +0000 (14:36 +0100)]
Further tweaks and cleanup for functions dealing with PKCS#11 attributes
* Check that the size is correct when looking for a boolean
or a ulong.
* Make sure that the length is not the invalid negative ulong.
* Functions for dumping out attribute contents
* Make it possible to use attributes in hash tables
Stef Walter [Wed, 23 Jan 2013 13:29:25 +0000 (14:29 +0100)]
Use the stdbool.h C99 bool type
It was getting really wild knowing whether a function returning
an int would return -1 on failure or 0 or whether the int return
value was actually a number etc..
Stef Walter [Wed, 2 Jan 2013 15:52:02 +0000 (16:52 +0100)]
Move the pkcs11.h header files into common directory
* Allows use of them across the whole project
* Put a stub file in the p11-kit/ directory, so we can still refer
to the headers using that path, which is what it will be at
when in the installed includes directory.
Stef Walter [Mon, 7 Jan 2013 10:01:09 +0000 (11:01 +0100)]
Fix documentation warnings.
* P11_KIT_URI_NO_MEMORY is an unexpected state, that will probably
never actually be returned. But kept for API compatibility.
* make distcheck doc fix
Stef Walter [Mon, 7 Jan 2013 08:20:25 +0000 (09:20 +0100)]
Guarantee that the key is freed when replaced
* When setting a key in a map that already exists, then free
the old key and replace with the new one.
* Fix related bug where key was not properly allocated
* Add tests for this
Stef Walter [Tue, 18 Sep 2012 14:26:06 +0000 (16:26 +0200)]
Refuse to load the p11-kit-proxy.so as a registered module
* Since p11-kit-proxy.so is a symlink to the libp11-kit.so library
we check that we are not calling into our known CK_FUNCTION_LIST
for the proxy code.
* Although such a configuration is invalid, detecting this directly
prevents strange initialization loop issues that are hard to debug.
Stef Walter [Tue, 18 Sep 2012 12:01:54 +0000 (14:01 +0200)]
Don't fail initialization if last initialized module fails
* We weren't resetting the result code after a failure,
so even though failures for critical modules didn't interrupt
the initialization loop, the result still leaked to callers.
* Also print an error message clearly indicating that a module
failed to initialize, regardless of whether critical or not.
Stef Walter [Thu, 6 Sep 2012 09:01:57 +0000 (11:01 +0200)]
Change the default of 'user-config' to merge.
* This allows user configured PKCS#11 modules by default.
* Admins can change this to 'none' in /etc/pkcs11/pkcs11.conf
to go back to the previous behavior.
* Posted to the mailing list.