]> granicus.if.org Git - p11-kit/log
p11-kit
7 years agobuild: Include <stdint.h> for SIZE_MAX
Daiki Ueno [Wed, 16 Aug 2017 12:59:59 +0000 (14:59 +0200)]
build: Include <stdint.h> for SIZE_MAX

Fixes issue #95.

7 years agoRelease 0.23.8
Daiki Ueno [Mon, 14 Aug 2017 11:20:18 +0000 (13:20 +0200)]
Release 0.23.8

7 years agobuild: Include <stdint.h> for SIZE_MAX
Daiki Ueno [Tue, 15 Aug 2017 11:55:02 +0000 (13:55 +0200)]
build: Include <stdint.h> for SIZE_MAX

7 years agoclient: Fix order of cleanup
Daiki Ueno [Fri, 11 Aug 2017 13:39:20 +0000 (15:39 +0200)]
client: Fix order of cleanup

In C_GetFunctionList, state->virt is wrapped with a destroyer function
free().  Thus p11_rpc_transport_free must be called before
p11_virtual_unwrap.

7 years agotest: Add checks for duplicate vendor attributes
Daiki Ueno [Tue, 8 Aug 2017 12:52:44 +0000 (14:52 +0200)]
test: Add checks for duplicate vendor attributes

7 years agouri: Make vendor query attribute handling reliable
Daiki Ueno [Tue, 8 Aug 2017 12:52:41 +0000 (14:52 +0200)]
uri: Make vendor query attribute handling reliable

Previously we used p11_dict to keep track of vendor query attributes.
This had a couple of limitations: duplicate attributes are not allowed
while they are actually allowed in RFC 7512, and the order of
attributes is unpredictable.

This patch switches to using an array instead of p11_dict and ensures
that the attributes are sorted in alphabetical order.

Fixes #88.

7 years agocommon: New p11_array_insert function
Daiki Ueno [Tue, 8 Aug 2017 12:52:37 +0000 (14:52 +0200)]
common: New p11_array_insert function

7 years agocommon: Use reallocarray instead of realloc as appropriate
Daiki Ueno [Tue, 8 Aug 2017 12:52:24 +0000 (14:52 +0200)]
common: Use reallocarray instead of realloc as appropriate

reallocarray is a new POSIX function added in glibc 2.26, with
built-in overflow checks.  Take advantage of that function for
internal array allocation.

7 years agopkcs11.h: updated information
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 06:48:18 +0000 (08:48 +0200)]
pkcs11.h: updated information

The scute project no longer exists, and the PKCS#11 standard is
from OASIS group.

7 years agopkcs11.h: added OTP-related mechanisms
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 06:43:45 +0000 (08:43 +0200)]
pkcs11.h: added OTP-related mechanisms

7 years agopkcs11.h: added definitions of GOST CKA attributes
Nikos Mavrogiannopoulos [Tue, 1 Aug 2017 06:16:06 +0000 (08:16 +0200)]
pkcs11.h: added definitions of GOST CKA attributes

7 years agopkcs11.h: added definitions of GOST mechanisms
Nikos Mavrogiannopoulos [Mon, 31 Jul 2017 12:15:52 +0000 (14:15 +0200)]
pkcs11.h: added definitions of GOST mechanisms

This follows the definitions in PKCS#11 v2.40:
  http://docs.oasis-open.org/pkcs11/pkcs11-curr/v2.40/os/pkcs11-curr-v2.40-os.html

7 years agotest: Fix failure on 32-bit big endian platform
Daiki Ueno [Mon, 3 Jul 2017 13:40:16 +0000 (15:40 +0200)]
test: Fix failure on 32-bit big endian platform

The value given to p11_rpc_buffer_add_ulong_value() must be a pointer
of CK_ULONG.  Similarly, the value returned from
p11_rpc_buffer_get_ulong_value() must be converted to CK_ULONG before
comparison.

Reported by Andreas Metzler in:
https://lists.freedesktop.org/archives/p11-glue/2017-July/000665.html

7 years agotrust: Fix build error with -Werror=return-type
Daiki Ueno [Fri, 14 Jul 2017 08:14:14 +0000 (10:14 +0200)]
trust: Fix build error with -Werror=return-type

7 years agoconf: Introduce P11_KIT_NO_USER_CONFIG
Colin Walters [Fri, 7 Jul 2017 17:19:18 +0000 (13:19 -0400)]
conf: Introduce P11_KIT_NO_USER_CONFIG

Currently `ca-certificates.spec` in Fedora ends up doing in `%post`:
```
/usr/bin/p11-kit extract --format=openssl-bundle --filter=certificates --overwrite --comment $DEST/openssl/ca-bundle.trust.crt
```
etc.

And due to this bit of code in p11-kit, we end up looking for the home
directory for configuration.  In this case, `/root`.

It's categorically wrong to do this; the root user is distinct from
"the system".  This issue is equivalent to one I fixed in Pango:
https://git.gnome.org/browse/pango/commit/?id=aecbe27c1b08f517c0e05f03308d3ac55cef490c

Fast forward to today, and the reason I'm making this change is I'm working on
`rpm-ostree ex container`, which builds containers as *non-root* (like
gnome-continuous does, but now with RPMs), keeping the invoking uid. And this
bug causes the `ca-certificates` `%post` to fail because it's trying to look for
my uid 1000 which doesn't exist in the target rootfs' password database.

Again, there's no reason to be looking for a home directory for system triggers,
regadless of UID, so once this patch lands, I'll update `ca-certificates` to use
it, and traditional RPM `%post` will stop looking in `/root` too.

7 years agocommon: always use p11_dl_close wrapper
Fabian Groffen [Wed, 7 Jun 2017 12:37:27 +0000 (14:37 +0200)]
common: always use p11_dl_close wrapper

Solaris doesn't like it when dlclose is referenced using a define,
resulting in a linker error looking for a symbol version.  Simply
calling the function in a normal way (instead of storing its address)
solves this linking error.
The error message seen by GNU ld is:
  dlclose: invalid version 7 (max 0)

7 years agop11_get_upeer_id: implement case using ucred.h
Fabian Groffen [Wed, 7 Jun 2017 12:36:22 +0000 (14:36 +0200)]
p11_get_upeer_id: implement case using ucred.h

Solaris can retrieve this information via getpeerucred().

7 years agoconfigure: pull in -lnsl -lsocket for socket functions
Fabian Groffen [Wed, 7 Jun 2017 12:36:54 +0000 (14:36 +0200)]
configure: pull in -lnsl -lsocket for socket functions

Solaris has socket() etc. in these two libs.

7 years agoBe silent by default and do not print messages on stderr
Nikos Mavrogiannopoulos [Fri, 23 Jun 2017 14:33:14 +0000 (16:33 +0200)]
Be silent by default and do not print messages on stderr

As p11-kit is a library there are cases where it is not desirable
to log on stderr by default. See for example this report
https://bugzilla.redhat.com/show_bug.cgi?id=1464490
where wget prints an error due to an unconfigured pkcs11 module.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
7 years agodoc: Use correct PKCS#11 URI syntax
Daiki Ueno [Mon, 12 Jun 2017 13:38:21 +0000 (15:38 +0200)]
doc: Use correct PKCS#11 URI syntax

7 years agobuild: Allow use of _GNU_SOURCE
Daiki Ueno [Fri, 9 Jun 2017 12:44:04 +0000 (14:44 +0200)]
build: Allow use of _GNU_SOURCE

This reverts commit 6b457ffc, which forbids the use of GNU extension
for the incompatibility of strerror_r.  However, now that strerror_l
is used instead on glibc systems, it has no point to do that.

7 years agodebug: Add p11_debug_err to prevent use of strerror
Daiki Ueno [Mon, 12 Jun 2017 09:09:43 +0000 (11:09 +0200)]
debug: Add p11_debug_err to prevent use of strerror

7 years agocompat: Prefer strerror_l to strerror_r
Daiki Ueno [Fri, 9 Jun 2017 12:41:13 +0000 (14:41 +0200)]
compat: Prefer strerror_l to strerror_r

strerror_r is being obsolete in the next POSIX specification:
http://austingroupbugs.net/view.php?id=655

7 years agoRelease 0.23.7 0.23.7
Daiki Ueno [Mon, 29 May 2017 15:56:47 +0000 (17:56 +0200)]
Release 0.23.7

7 years agotrust: Suppress dead-assignment warnings from clang-analyzer
Daiki Ueno [Mon, 29 May 2017 15:16:58 +0000 (17:16 +0200)]
trust: Suppress dead-assignment warnings from clang-analyzer

7 years agorpc: Avoid use-after-free when creating socket base directory
Daiki Ueno [Mon, 29 May 2017 15:16:25 +0000 (17:16 +0200)]
rpc: Avoid use-after-free when creating socket base directory

Spotted by clang-analyzer.

7 years agorpc: Avoid calling memcmp() on NULL buffer
Daiki Ueno [Mon, 29 May 2017 15:15:19 +0000 (17:15 +0200)]
rpc: Avoid calling memcmp() on NULL buffer

Spotted by clang-analyzer.

7 years agoproxy: Don't call realloc() with size 0
Daiki Ueno [Mon, 29 May 2017 15:14:14 +0000 (17:14 +0200)]
proxy: Don't call realloc() with size 0

Spotted by clang-analyzer.

7 years agobuild: Delay building test programs until "make check"
Daiki Ueno [Mon, 29 May 2017 13:06:04 +0000 (15:06 +0200)]
build: Delay building test programs until "make check"

This is to disable clang-analyzer against test programs, which can
contain several false-positives.

7 years agotravis: Enable clang-analyzer
Daiki Ueno [Mon, 29 May 2017 09:52:19 +0000 (11:52 +0200)]
travis: Enable clang-analyzer

7 years agoserver: Avoid use-after-free
Daiki Ueno [Mon, 29 May 2017 11:20:15 +0000 (13:20 +0200)]
server: Avoid use-after-free

Reported by Mantas Mikulėnas in:
https://bugs.freedesktop.org/show_bug.cgi?id=101212

7 years agoRelease 0.23.6 0.23.6
Daiki Ueno [Fri, 26 May 2017 09:47:27 +0000 (11:47 +0200)]
Release 0.23.6

7 years agotest: Check the size of unsigned long
Daiki Ueno [Fri, 26 May 2017 12:47:35 +0000 (14:47 +0200)]
test: Check the size of unsigned long

7 years agorpc: Load advapi32.dll on the fly
Daiki Ueno [Fri, 26 May 2017 10:00:33 +0000 (12:00 +0200)]
rpc: Load advapi32.dll on the fly

7 years agoremote: Remove unnecessary declaration
Daiki Ueno [Fri, 26 May 2017 08:36:43 +0000 (10:36 +0200)]
remote: Remove unnecessary declaration

7 years agodoc: Clarify p11-kit server documentation
Daiki Ueno [Fri, 26 May 2017 08:30:12 +0000 (10:30 +0200)]
doc: Clarify p11-kit server documentation

7 years agoserver: Port to Windows
Daiki Ueno [Thu, 9 Mar 2017 16:45:31 +0000 (17:45 +0100)]
server: Port to Windows

Instead of a Unix domain socket on Unix, use a named pipe on Windows.

7 years agorpc: New p11_kit_remote_serve_tokens function
Daiki Ueno [Fri, 10 Mar 2017 08:53:50 +0000 (09:53 +0100)]
rpc: New p11_kit_remote_serve_tokens function

7 years agoremote: Name command line options consistently
Daiki Ueno [Fri, 10 Mar 2017 13:22:59 +0000 (14:22 +0100)]
remote: Name command line options consistently

7 years agorpc: Convert mechanism parameters for portability
Daiki Ueno [Tue, 23 May 2017 09:51:33 +0000 (11:51 +0200)]
rpc: Convert mechanism parameters for portability

This is similar to commit ba49b85e, but for mechanism parameters.

7 years agopkcs11: Define RSA-PSS mechanism parameter
Daiki Ueno [Tue, 23 May 2017 09:51:03 +0000 (11:51 +0200)]
pkcs11: Define RSA-PSS mechanism parameter

7 years agopkcs11: Make CK_RSA_PKCS_OAEP_PARAMS useful
Daiki Ueno [Tue, 23 May 2017 09:55:25 +0000 (11:55 +0200)]
pkcs11: Make CK_RSA_PKCS_OAEP_PARAMS useful

7 years agorpc: Fix typo in encoding CK_DATE value
Daiki Ueno [Tue, 23 May 2017 09:57:48 +0000 (11:57 +0200)]
rpc: Fix typo in encoding CK_DATE value

7 years agorpc: Factor out attribute value serializer definitions
Daiki Ueno [Tue, 23 May 2017 16:18:07 +0000 (18:18 +0200)]
rpc: Factor out attribute value serializer definitions

7 years agorpc: Add a comment why we call _get_attribute() twice
Daiki Ueno [Wed, 24 May 2017 09:03:24 +0000 (11:03 +0200)]
rpc: Add a comment why we call _get_attribute() twice

7 years agorpc: Convert attribute value for portability
Daiki Ueno [Thu, 11 May 2017 13:26:36 +0000 (15:26 +0200)]
rpc: Convert attribute value for portability

When using the RPC across multiple architectures, where data models
are different, say LP64 vs ILP32, there can be unwanted truncation of
attribute values.

This patch converts the values into portable format for the known
attributes.

Co-authored-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
7 years agorpc: Return early if call_id of request is ERROR
Daiki Ueno [Mon, 22 May 2017 13:44:50 +0000 (15:44 +0200)]
rpc: Return early if call_id of request is ERROR

Otherwise it will cause assertion failure in a few lines below.
Spotted by amrican fuzzy lop.

7 years agobuild: Add fuzzer using AFL
Daiki Ueno [Mon, 22 May 2017 13:31:23 +0000 (15:31 +0200)]
build: Add fuzzer using AFL

7 years agotrust: Simplify the check for the magic
Daiki Ueno [Thu, 18 May 2017 12:27:36 +0000 (14:27 +0200)]
trust: Simplify the check for the magic

Instead of reusing the CKA_X_GENERATED attribute, check the file
contents directly in the caller side.

7 years agotrust: Check magic comment in persist file for modifiablity
Daiki Ueno [Thu, 18 May 2017 09:11:45 +0000 (11:11 +0200)]
trust: Check magic comment in persist file for modifiablity

A persistent file written by the trust module starts with the line "#
This file has been auto-generated and written by p11-kit".  This can
be used as a magic word to determine whether the objects read from a
.p11-kit file are read-only.

7 years agoRevert "trust: Honor "modifiable" setting in persist file"
Daiki Ueno [Thu, 18 May 2017 08:45:26 +0000 (10:45 +0200)]
Revert "trust: Honor "modifiable" setting in persist file"

This reverts commit 8eed1e60b0921d05872e2f43eee9088cef038d7e, which
broke "trust anchor --remove".

7 years agoremote: Fix typo when writing a credential byte
Daiki Ueno [Thu, 9 Mar 2017 14:55:49 +0000 (15:55 +0100)]
remote: Fix typo when writing a credential byte

out_fd is not always 1 when p11_kit_remote_serve_module() is used for
writing a custom server.

7 years agocorrect text for --user-config option
Daniel Black [Sun, 5 Mar 2017 22:35:45 +0000 (09:35 +1100)]
correct text for --user-config option

7 years agoRelease 0.23.5 0.23.5
Daiki Ueno [Wed, 1 Mar 2017 08:58:40 +0000 (09:58 +0100)]
Release 0.23.5

7 years agobuild: Remove systemd unit files for now
Daiki Ueno [Tue, 28 Feb 2017 15:06:50 +0000 (16:06 +0100)]
build: Remove systemd unit files for now

Given that the remote proxy service shall be only used by NetworkManager
and not generally useful, revert commit
a4fb2bb587fb1a0146cf97f039b671d3258488f9 for now.

Once the necessary command that runs the proxy module is implemented in
p11-kit, maybe NetworkManager itself could install those files.

7 years agosystemd: Fix location of p11-kit-remote
Daiki Ueno [Fri, 24 Feb 2017 08:57:34 +0000 (09:57 +0100)]
systemd: Fix location of p11-kit-remote

The p11-kit-remote executable is now located under $libexecdir, but we
should use the p11-kit command to launch the subcommand.

7 years agofixed license in unix peer file
Nikos Mavrogiannopoulos [Mon, 27 Feb 2017 08:14:38 +0000 (09:14 +0100)]
fixed license in unix peer file

7 years agobuild: add missing includes for FreeBSD
Roman Bogorodskiy [Thu, 23 Feb 2017 05:57:28 +0000 (09:57 +0400)]
build: add missing includes for FreeBSD

Include signal.h for kill(2) and SIGKILL on FreeBSD.

7 years agobuild: check for getpeereid
Roman Bogorodskiy [Thu, 23 Feb 2017 05:52:38 +0000 (09:52 +0400)]
build: check for getpeereid

In common/unix-peer.c, we are checking if HAVE_GETPEEREID is defined,
however, we never actually check if getpeereid() is available, so
fix that by checking this function using AC_CHECK_FUNCS().

7 years agoRelease 0.23.4 0.23.4
Daiki Ueno [Fri, 17 Feb 2017 16:06:41 +0000 (17:06 +0100)]
Release 0.23.4

7 years agouri: Support vendor query attributes
Daiki Ueno [Mon, 20 Feb 2017 10:01:21 +0000 (11:01 +0100)]
uri: Support vendor query attributes

If an unknown attribute is present in the query part of the PKCS#11 URI,
the parser treated it as unrecognized and subsequent matches failed.

Instead, keep track of such attributes and provide a set of API to deal
with them.

7 years agorpc: Make it less verbose about connection failure
Daiki Ueno [Tue, 21 Feb 2017 14:50:53 +0000 (15:50 +0100)]
rpc: Make it less verbose about connection failure

The connection failure here is not fatal.  Use p11_debug() instead of
p11_message().

7 years agorpc: Try $XDG_CACHE_HOME before ~/.cache
Mantas Mikulėnas [Mon, 20 Feb 2017 21:38:40 +0000 (23:38 +0200)]
rpc: Try $XDG_CACHE_HOME before ~/.cache

This is unset on most systems, but might as well follow the Base
Directory spec properly.

7 years agotrust: Honor "modifiable" setting in persist file
Daiki Ueno [Fri, 17 Feb 2017 15:18:21 +0000 (16:18 +0100)]
trust: Honor "modifiable" setting in persist file

Previously, all objects read from p11-kit persist files are marked as
modifiable when parsing, regardless of the explicit "modifiable: false"
setting in the file.

Reported by Kai Engert in:
https://bugs.freedesktop.org/show_bug.cgi?id=99797

7 years agorpc: Add PKCS#11 module that connects to socket
Daiki Ueno [Wed, 11 Jan 2017 08:32:19 +0000 (09:32 +0100)]
rpc: Add PKCS#11 module that connects to socket

This patch adds a PKCS#11 module that connects to the p11-kit server
exposed on the filesystem.  The filename of the socket is determined in
the following order:

- $P11_KIT_SERVER_ADDRESS, if the envvar is available
- $XDG_RUNTIME_DIR/p11-kit/pkcs11, if the envvar is available
- /run/$(id -u)/p11-kit/pkcs11, if /run/$(id -u) exists
- /var/run/$(id -u)/p11-kit/pkcs11, if /var/run/$(id -u) exists
- ~/.cache/p11-kit/pkcs11.

Note that the program loading this module may have called setuid() and
secure_getenv() which we use for fetching envvars could return NULL.

7 years agoremote: Add API to serve a token
Daiki Ueno [Sun, 25 Dec 2016 02:03:47 +0000 (11:03 +0900)]
remote: Add API to serve a token

7 years agoremote, server: Recognize PKCS#11 URI
Daiki Ueno [Mon, 26 Dec 2016 00:33:44 +0000 (09:33 +0900)]
remote, server: Recognize PKCS#11 URI

7 years agop11-kit: Add 'p11-kit server' command
Nikos Mavrogiannopoulos [Wed, 24 Aug 2016 09:40:21 +0000 (11:40 +0200)]
p11-kit: Add 'p11-kit server' command

This adds a new tool to the p11-kit command called 'server', which
allows us to access a PKCS#11 module over a Unix domain socket.

Internally, it is implemented as a wrapper around 'p11-kit remote'.
Upon connection it executes 'p11-kit remote' in a forked process.

7 years agocommon: New p11_get_upeer_id() function
Nikos Mavrogiannopoulos [Wed, 24 Aug 2016 09:37:36 +0000 (11:37 +0200)]
common: New p11_get_upeer_id() function

7 years agorpc: New rpc_unix transport based on Unix socket
Nikos Mavrogiannopoulos [Wed, 24 Aug 2016 12:41:49 +0000 (14:41 +0200)]
rpc: New rpc_unix transport based on Unix socket

7 years agocommon: Add path encoding functions
Daiki Ueno [Wed, 25 Jan 2017 14:54:40 +0000 (15:54 +0100)]
common: Add path encoding functions

This adds p11_path_{encode,decode}(), following the escaping rule
described in:
https://dbus.freedesktop.org/doc/dbus-specification.html#addresses

Although they are merely a wrapper around p11_url_{decode,encode}(),
having dedicated functions hides the implementation details.

7 years agotravis: Enable mingw64 cross build
Daiki Ueno [Wed, 15 Feb 2017 16:35:07 +0000 (17:35 +0100)]
travis: Enable mingw64 cross build

7 years agotrust: Fix uninitialized value in anchor command
Daiki Ueno [Thu, 16 Feb 2017 14:54:41 +0000 (15:54 +0100)]
trust: Fix uninitialized value in anchor command

7 years agolibrary: Initialize p11_virtual_mutex for Windows
Daiki Ueno [Thu, 16 Feb 2017 13:25:49 +0000 (14:25 +0100)]
library: Initialize p11_virtual_mutex for Windows

7 years agotest: Fix modules test for Windows
Daiki Ueno [Thu, 16 Feb 2017 10:12:29 +0000 (11:12 +0100)]
test: Fix modules test for Windows

Synchronize the fixture module to the non-Unix one and enable
"/modules/test_filename".

7 years agotrust: Fix saving trust file on Windows
Daiki Ueno [Wed, 15 Feb 2017 17:26:19 +0000 (18:26 +0100)]
trust: Fix saving trust file on Windows

7 years agotest: Fix Windows test case for p11_path_expand
Daiki Ueno [Wed, 15 Feb 2017 14:14:01 +0000 (15:14 +0100)]
test: Fix Windows test case for p11_path_expand

7 years agorpc: Port exec transport to Windows
Daiki Ueno [Wed, 15 Feb 2017 11:07:31 +0000 (12:07 +0100)]
rpc: Port exec transport to Windows

On Windows, use _spawnv() to create a subprocess and two unidirectional
pipe created with _pipe() to communicate with it.  If we can assume
WinSock, it might be simpler to use a socketpair() replacement from:
https://github.com/ncm/selectable-socketpair.

7 years agobuild: Adjust executable/module names for Windows
Daiki Ueno [Wed, 15 Feb 2017 11:05:33 +0000 (12:05 +0100)]
build: Adjust executable/module names for Windows

Append EXEEXT or SHLEXT to the filename if needed.

7 years agobuild: Avoid undefined reference to rpc_exec_init
Daiki Ueno [Wed, 1 Feb 2017 15:39:35 +0000 (16:39 +0100)]
build: Avoid undefined reference to rpc_exec_init

7 years agobuild: Include <unistd.h> for execv
Daiki Ueno [Wed, 1 Feb 2017 15:39:18 +0000 (16:39 +0100)]
build: Include <unistd.h> for execv

7 years agobuild: Check *asprintf on all platforms
Daiki Ueno [Wed, 1 Feb 2017 15:37:37 +0000 (16:37 +0100)]
build: Check *asprintf on all platforms

7 years agoargv: Fix misinterpretation of backslash in quotes
Daiki Ueno [Wed, 15 Feb 2017 16:23:18 +0000 (17:23 +0100)]
argv: Fix misinterpretation of backslash in quotes

Don't append the backslash character twice to the output.  It is
interpolated a few lines below, if it is really required.

7 years agocompat: Fix character generation in mk{s,d}temp()
Daiki Ueno [Thu, 16 Feb 2017 10:35:18 +0000 (11:35 +0100)]
compat: Fix character generation in mk{s,d}temp()

7 years agoFix a typo in "x-cetrificate-value", see also https://bugs.freedesktop.org/show_bug...
Kai Engert [Thu, 2 Feb 2017 15:08:13 +0000 (16:08 +0100)]
Fix a typo in "x-cetrificate-value", see also https://bugs.freedesktop.org/show_bug.cgi?id=99600

7 years agoSupport loading new NSS attribute CKA_NSS_MOZILLA_CA_POLICY from .p11-kit files.
Kai Engert [Thu, 2 Feb 2017 15:01:01 +0000 (16:01 +0100)]
Support loading new NSS attribute CKA_NSS_MOZILLA_CA_POLICY from .p11-kit files.
See also NSS bug https://bugzilla.mozilla.org/show_bug.cgi?id=1334976
and p11-kit bug https://bugs.freedesktop.org/show_bug.cgi?id=99453

7 years agolibrary: Deinit p11_virtual_mutex
Daiki Ueno [Thu, 16 Feb 2017 08:13:53 +0000 (09:13 +0100)]
library: Deinit p11_virtual_mutex

Follow-up fix for commit 4d228aa0, which forgot to clear
p11_virtual_mutex on library finalization.

7 years agovirtual: Move mutex into p11_library_init()
Daiki Ueno [Tue, 14 Feb 2017 15:36:23 +0000 (16:36 +0100)]
virtual: Move mutex into p11_library_init()

We used to provide p11_virtual_fixed_{,un}init() to only initialize a
mutex used in virtual.c.  That required all the tests calling virtual
functions to call p11_virtual_fixed_{,un}init() in main().

For simplicity, move the mutex variable initialization into
p11_library_init().

7 years agotrust: Revert to the original 'extract' behavior
Daiki Ueno [Mon, 13 Feb 2017 15:32:01 +0000 (16:32 +0100)]
trust: Revert to the original 'extract' behavior

Since commit f4384a40, due to a missing ex->flags setting, the 'trust
extract' command didn't retrieve correlation between related objects and
that was causing assertion failure when writing PEM files.

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

7 years agofilter: New virtual wrapper for access control
Daiki Ueno [Tue, 13 Dec 2016 17:24:16 +0000 (18:24 +0100)]
filter: New virtual wrapper for access control

7 years agoiter: Enable iteration over slots/tokens/modules
Daiki Ueno [Sat, 17 Dec 2016 06:11:36 +0000 (07:11 +0100)]
iter: Enable iteration over slots/tokens/modules

While PKCS#11 URI can identify slots/tokens/modules, P11KitIter is only
capable of iterating over objects.

This patch adds new behaviors to P11KitIter to support iterations over
slots/tokens/modules, using the C coroutine trick as described in:
http://www.chiark.greenend.org.uk/~sgtatham/coroutines.html

7 years agouri: Relax pin-* parsing for compatibility
Daiki Ueno [Mon, 23 Jan 2017 09:02:56 +0000 (10:02 +0100)]
uri: Relax pin-* parsing for compatibility

While 'pin-source' and 'pin-value' are defined as query atttribute, they
were defined as path attribute in earlier drafts, and some
implementations still stick to it.

For backward compatibility, accept those in path attributes when
parsing (but not when formatting).

Reported by Andreas Metzler in:
https://lists.freedesktop.org/archives/p11-glue/2017-January/000637.html

7 years agotrust: Implement a 'trust dump' command
Stef Walter [Sun, 29 Jan 2017 14:10:37 +0000 (15:10 +0100)]
trust: Implement a 'trust dump' command

This dumps all the PKCS#11 objects in the internal .p11-kit
persistence format.

This is part of the trust command and tooling, even though
at some point it could go in the p11-kit command. The reason
for this is that the code related to the internal .p11-kit
objects is in the trust code, and consumed solely by the
trust related modules.

7 years agotrust: Don't encode spaces when writing .p11-kit format
Stef Walter [Sun, 29 Jan 2017 14:14:11 +0000 (15:14 +0100)]
trust: Don't encode spaces when writing .p11-kit format

These should not be encoded by default for readability in
strings.

7 years agotrust: Add an "all" filter option for trust commands
Stef Walter [Sun, 29 Jan 2017 14:13:50 +0000 (15:13 +0100)]
trust: Add an "all" filter option for trust commands

7 years agotrust: Make extraction and correlation of certificate info optional
Stef Walter [Sun, 29 Jan 2017 14:12:56 +0000 (15:12 +0100)]
trust: Make extraction and correlation of certificate info optional

This is so that the code can be shared by the upcoming 'trust dump'
command where correlation between related objects is not desired.

7 years agotrust: Load all attributes for each object when enumerating
Stef Walter [Sun, 29 Jan 2017 14:12:12 +0000 (15:12 +0100)]
trust: Load all attributes for each object when enumerating

We load all known attributes for each object we're enumerating
over in the 'trust list' and 'trust extract' commands.

7 years agovirtual: Make virtual-fixed internal API cleaner
Daiki Ueno [Wed, 25 Jan 2017 10:23:57 +0000 (11:23 +0100)]
virtual: Make virtual-fixed internal API cleaner

Add proper inclusion guard to virtual-fixed.h and move the declarations
of the (un)initialization functions there.

7 years agotest: Release transport mock module
Daiki Ueno [Wed, 25 Jan 2017 10:16:07 +0000 (11:16 +0100)]
test: Release transport mock module

To prevent leaks of fixed closures, p11_kit_module_release() needs to be
called on the mock module itself.

7 years agotest: Check exhaustion of fixed closures
Nikos Mavrogiannopoulos [Wed, 30 Nov 2016 14:20:24 +0000 (15:20 +0100)]
test: Check exhaustion of fixed closures