]> granicus.if.org Git - p11-kit/log
p11-kit
8 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".

8 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.

8 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

8 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

8 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.

8 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.

8 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

8 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.

8 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().

8 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

8 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.

8 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().

8 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.

8 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

8 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.

8 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

8 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

8 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.

8 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

8 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

8 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.

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

8 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

8 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

8 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".

8 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

8 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

8 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.

8 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.

8 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

8 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

8 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

8 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.

8 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()

8 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

8 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

8 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.

8 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().

8 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

8 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

8 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

8 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

8 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.

8 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.

8 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

8 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.

8 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.

8 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.

8 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.

8 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

8 years agobuild: Make libffi closure optional
Daiki Ueno [Fri, 26 Aug 2016 15:20:06 +0000 (17:20 +0200)]
build: Make libffi closure optional

libffi's closure support is not available on all platforms and may fail
at run time if running under a stricter SELinux policy.  Fallback to
pre-compiled closures if it is not usable.

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

8 years agomaint: Add .dir-locals.el file for Emacs
Daiki Ueno [Mon, 23 Jan 2017 11:42:51 +0000 (12:42 +0100)]
maint: Add .dir-locals.el file for Emacs

8 years agotravis: Enable strict code compilation
Daiki Ueno [Mon, 23 Jan 2017 11:48:23 +0000 (12:48 +0100)]
travis: Enable strict code compilation

8 years agoFix compiler warnings on FreeBSD
Roman Bogorodskiy [Sat, 21 Jan 2017 17:49:42 +0000 (21:49 +0400)]
Fix compiler warnings on FreeBSD

 * common/compat.c: Fix "implicit declaration of function 'issetugid'"
   warning. On FreeBSD, it's required to define __BSD_VISIBLE to make
   issetugid(2) visible
 * common/test-message.c: Fix "implicit declaration of function
   'asprintf'" by including <stdio.h>
 * p11-kit/test-iter.c: Fix "format '%lu' expects argument of
   type 'long unsigned int', but argument 3 has type 'int'" by
   changing format string to "%d"

8 years agosystemd: add per-user remoting socket
Lubomir Rintel [Thu, 8 Dec 2016 17:20:37 +0000 (18:20 +0100)]
systemd: add per-user remoting socket

This allows daemons outside user's session to use per-user PKCS#11
modules. Useful for letting VPN daemons or wpa_supplicant use
certificates stored in user's GNOME keyring, etc.

8 years agocommon: use recursive pthread mutex for library lock
Lubomir Rintel [Tue, 3 Nov 2015 07:11:39 +0000 (08:11 +0100)]
common: use recursive pthread mutex for library lock

This allows us to do nested locking within one thread avoiding a lockup
when remoting the p11-kit-proxy.so module:

  #0  0x00007f190f35838d in __lll_lock_wait () from /lib64/libpthread.so.0
  #1  0x00007f190f351e4d in pthread_mutex_lock () from /lib64/libpthread.so.0
  #2  0x00007f190f98657f in C_GetFunctionList (list=0x7ffe7ec3f798) at p11-kit/proxy.c:2355
  #3  0x00007f190f993cc9 in dlopen_and_get_function_list (funcs=0x7ffe7ec3f798, path=0x7ffe7ec40926 "/usr/local/lib/p11-kit-proxy.so", mod=0x249e3d0) at p11-kit/modules.c:337
  #4  load_module_from_file_inlock (name=name@entry=0x0, path=path@entry=0x7ffe7ec40926 "/usr/local/lib/p11-kit-proxy.so", result=result@entry=0x7ffe7ec3f7e8) at p11-kit/modules.c:382
  #5  0x00007f190f99587f in p11_kit_module_load (module_path=module_path@entry=0x7ffe7ec40926 "/usr/local/lib/p11-kit-proxy.so", flags=flags@entry=0) at p11-kit/modules.c:2427
  #6  0x0000000000401c4b in serve_module_from_file (file=0x7ffe7ec40926 "/usr/local/lib/p11-kit-proxy.so") at p11-kit/remote.c:105
  #7  main (argc=1, argv=<optimized out>) at p11-kit/remote.c:169

The Windows NT mutex is aready recursive by default.

8 years agouri: Support query attributes to specify module
Daiki Ueno [Wed, 18 Jan 2017 09:18:23 +0000 (10:18 +0100)]
uri: Support query attributes to specify module

Accept and produce 'module-name' and 'module-path' query attributes
defined in RFC 7512.

8 years agouri: Avoid typecasting confusion on s390x
Daiki Ueno [Mon, 16 Jan 2017 13:06:30 +0000 (14:06 +0100)]
uri: Avoid typecasting confusion on s390x

Like memcpy(), the 'void *' argument of p11_buffer_add() points to the
memory area ordered in host's endianness.  Add typecast of int->char to
avoid the confusion.

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

8 years agouri: fix producing the query attributes
Lubomir Rintel [Wed, 28 Dec 2016 15:28:34 +0000 (16:28 +0100)]
uri: fix producing the query attributes

Put the pin-* attributes where they belong: to the query part.

8 years agouri: fix the query attribute parsing
Lubomir Rintel [Wed, 28 Dec 2016 15:11:21 +0000 (16:11 +0100)]
uri: fix the query attribute parsing

The pin-* attributes belong to the query part. We should not parse them
until we see a '?' and they're separated with a '&'.

This might be an important thing -- some of the query attributes may
have security implications reaching outside scope of the token itself, to the
host system itself. E.g. a pin-source may cause the consumer to access a file
or module-path (unimplemented) execute code. The user may want to just chop the
attribute part off if they want the consumer access the token and not take the
security considerations into account.

8 years agobuild: improve p11-kit-proxy symlink handling
Roman Bogorodskiy [Fri, 6 Jan 2017 20:06:34 +0000 (00:06 +0400)]
build: improve p11-kit-proxy symlink handling

 - Current command for creation of the p11-kit-proxy symlink
   uses shell brace expansion that isn't supported by all
   the shells (e.g. FreeBSD's /bin/sh does not support that).
   Replace it with the old-fashioned 'for' loop
 - Match extension of the source and the target, i.e. so links
   to so, dylib links to dylib (previously dylib linked to so)
 - Add an uninstall-local target to clean up the symlink

8 years agoRelease version 0.23.3 0.23.3
Daiki Ueno [Tue, 13 Dec 2016 09:17:51 +0000 (10:17 +0100)]
Release version 0.23.3

8 years agodoc: More tweaks for gtk-doc
Daiki Ueno [Mon, 19 Dec 2016 15:10:15 +0000 (16:10 +0100)]
doc: More tweaks for gtk-doc

8 years agodoc: Mention new API functions
Daiki Ueno [Mon, 19 Dec 2016 09:46:56 +0000 (10:46 +0100)]
doc: Mention new API functions

8 years agorpc: Fix typo flagged by lintian
Andreas Metzler [Thu, 15 Dec 2016 08:00:45 +0000 (09:00 +0100)]
rpc: Fix typo flagged by lintian

8 years agotest: Remove setgid()ed copy of frob-getenv
Daiki Ueno [Tue, 13 Dec 2016 09:35:49 +0000 (10:35 +0100)]
test: Remove setgid()ed copy of frob-getenv

Otherwise the file is left in builddir, after make distclean.

8 years agotest: Fix privatedir substitution in test-extract
Daiki Ueno [Tue, 13 Dec 2016 09:34:07 +0000 (10:34 +0100)]
test: Fix privatedir substitution in test-extract

Since $privatedir expands to "${libexecdir}/p11-kit", $libexecdir must
be substituted in the script beforehand.

8 years agopkcs11: Update CRYPTOKI_VERSION to 2.40
Daiki Ueno [Tue, 6 Dec 2016 10:47:07 +0000 (11:47 +0100)]
pkcs11: Update CRYPTOKI_VERSION to 2.40

8 years agopkcs11: Add CK_RSA_PKCS_OAEP_PARAMS definition
Daiki Ueno [Tue, 6 Dec 2016 10:38:04 +0000 (11:38 +0100)]
pkcs11: Add CK_RSA_PKCS_OAEP_PARAMS definition

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

8 years agopkcs11: Add CKA_COPYABLE definition
Daiki Ueno [Tue, 6 Dec 2016 10:04:28 +0000 (11:04 +0100)]
pkcs11: Add CKA_COPYABLE definition

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

8 years agopkcs11: Add AES key wrap mechanisms
Daiki Ueno [Tue, 6 Dec 2016 10:02:48 +0000 (11:02 +0100)]
pkcs11: Add AES key wrap mechanisms

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

8 years agoproxy: Remove redundant NULL check
Pankaj [Tue, 20 Sep 2016 16:09:49 +0000 (18:09 +0200)]
proxy: Remove redundant NULL check

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

8 years agomodules: Remove redundant NULL check
Pankaj [Tue, 20 Sep 2016 16:07:59 +0000 (18:07 +0200)]
modules: Remove redundant NULL check

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

8 years agoproxy: Check return value of calloc()
Pankaj [Tue, 20 Sep 2016 16:06:17 +0000 (18:06 +0200)]
proxy: Check return value of calloc()

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

8 years agomock: Check return value of calloc()
Pankaj [Tue, 20 Sep 2016 16:05:05 +0000 (18:05 +0200)]
mock: Check return value of calloc()

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

8 years agodoc: State 'p11-kit trust' is a deprecated form
Daiki Ueno [Tue, 6 Dec 2016 09:56:06 +0000 (10:56 +0100)]
doc: State 'p11-kit trust' is a deprecated form

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

8 years agotrust: Don't add CKA_TRUSTED to extension object
Daiki Ueno [Fri, 23 Sep 2016 09:10:21 +0000 (11:10 +0200)]
trust: Don't add CKA_TRUSTED to extension object

While 'trust anchor' command tries to add CKA_TRUSTED attribute to any
object, it is only valid for a certificate object.

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

8 years agocommon, trust: Avoid integer overflow
Daiki Ueno [Thu, 22 Sep 2016 12:47:18 +0000 (14:47 +0200)]
common, trust: Avoid integer overflow

This fixes issues pointed in:
https://bugzilla.redhat.com/show_bug.cgi?id=985445
except for p11-kit/conf.c:read_config_file(), which was rewritten using
mmap() and thus length calculation is no longer needed.

8 years agomove privatedir from libdir to libexecdir
Stanislav Brabec [Tue, 22 Nov 2016 13:44:21 +0000 (14:44 +0100)]
move privatedir from libdir to libexecdir

According to the GNU Coding Standards[1], private executables should be
installed to libexecdir, not libdir.

Move privatedir to libexecdir.

[1] https://www.gnu.org/prep/standards/

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

8 years agotrust: Avoid confusion in DER/PEM decoding
Daiki Ueno [Tue, 27 Sep 2016 09:30:23 +0000 (11:30 +0200)]
trust: Avoid confusion in DER/PEM decoding

Previously p11-kit-trust.so tried to interpret certificate as PEM format
first.  This could cause potential conflict if the certificate were
actually in DER format and contained a PEM marker strings.

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

8 years agodoc: Update documentation to point towards GitHub
Stef Walter [Tue, 29 Nov 2016 12:40:32 +0000 (13:40 +0100)]
doc: Update documentation to point towards GitHub

The p11-kit code has moved to GitHub. The documentation needs
an update.

8 years agotest-conf: don't create the setuid copy in /tmp
Lubomir Rintel [Mon, 28 Nov 2016 15:33:04 +0000 (16:33 +0100)]
test-conf: don't create the setuid copy in /tmp

The temporary directory is often mounted with nosuid, thus whatever runs
from there doesn't get AT_SECURE in auxv.

8 years agotrust: Clarify the error message of 'extract'
Daiki Ueno [Tue, 27 Sep 2016 13:30:09 +0000 (15:30 +0200)]
trust: Clarify the error message of 'extract'

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

8 years agotrust: Mention anchor --remove option in help
Daiki Ueno [Fri, 23 Sep 2016 09:15:16 +0000 (11:15 +0200)]
trust: Mention anchor --remove option in help

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

8 years agotrust: Reject invalid UTF-8 input
Daiki Ueno [Thu, 22 Sep 2016 12:11:16 +0000 (14:11 +0200)]
trust: Reject invalid UTF-8 input

Merge changes from utf8.c in FreeBSD's libc:
https://svnweb.freebsd.org/base/head/lib/libc/locale/utf8.c?revision=290494&view=markup#l196

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

8 years agopkg-config: Expose p11_trust_paths variable
Daiki Ueno [Thu, 22 Sep 2016 14:39:45 +0000 (16:39 +0200)]
pkg-config: Expose p11_trust_paths variable

The variable is mentioned in the manual but wasn't exposed from the
pkg-config.

8 years agobuild: Remove *.in files from EXTRA_DIST
Daiki Ueno [Thu, 22 Sep 2016 14:38:39 +0000 (16:38 +0200)]
build: Remove *.in files from EXTRA_DIST

The files created with AC_CONFIG_FILES are automatically added to the
distribution.

8 years agobuild: Don't update po files on every make run
Daiki Ueno [Fri, 21 Oct 2016 15:23:35 +0000 (17:23 +0200)]
build: Don't update po files on every make run

Update po/Makevars to the latest template and take advantage of
PO_DEPENDS_ON_POT = no.

8 years agotravis: Enable GCC sanitizers
Daiki Ueno [Mon, 31 Oct 2016 08:57:21 +0000 (09:57 +0100)]
travis: Enable GCC sanitizers

8 years agotravis: Disable silent rules
Daiki Ueno [Mon, 31 Oct 2016 09:09:01 +0000 (10:09 +0100)]
travis: Disable silent rules

8 years agotest: Remove /proxy/deinit-after-fork test
Daiki Ueno [Wed, 21 Sep 2016 12:50:38 +0000 (14:50 +0200)]
test: Remove /proxy/deinit-after-fork test

This test hasn't been working since the removal of the pthread_atfork()
deinit code.  To properly clean up, the child process needs to call
C_Initialize() and C_Finalize(), and it is already tested by
/proxy/initialize-child.

8 years agotest: Fix memleak in test-token cleanup
Daiki Ueno [Tue, 20 Sep 2016 14:48:16 +0000 (16:48 +0200)]
test: Fix memleak in test-token cleanup

GCC's asan spotted this:
  Direct leak of 338 byte(s) in 13 object(s) allocated from:
      #0 0x7f54f03fee20 in malloc (/lib64/libasan.so.3+0xc6e20)
      #1 0x445e8c in p11_path_build ../common/path.c:222
      #2 0x4385bd in expand_tempdir ../common/test.c:334
      #3 0x43869c in p11_test_directory ../common/test.c:361
      #4 0x4033e3 in setup_temp ../trust/test-token.c:79

8 years agomodules: Reset the init count on fork()
Daiki Ueno [Thu, 22 Sep 2016 07:16:48 +0000 (09:16 +0200)]
modules: Reset the init count on fork()

Reset mod->init_count when forkid has changed.  Otherwise C_Finalize
does not get called.

GCC's asan spotted this:
  Direct leak of 48 byte(s) in 1 object(s) allocated from:
      #0 0x7f89bc7bfe20 in malloc (/lib64/libasan.so.3+0xc6e20)
      #1 0x7f89bc47a1f1 in p11_dict_new ../common/dict.c:278
      #2 0x7f89bc42143d in managed_C_Initialize ../p11-kit/modules.c:1477
      #3 0x7f89bc464c72 in binding_C_Initialize ../p11-kit/virtual.c:121
      #4 0x7f89bc1b0a51 in ffi_closure_unix64_inner (/lib64/libffi.so.6+0x5a51)
      #5 0x7f89bc1b0dbf in ffi_closure_unix64 (/lib64/libffi.so.6+0x5dbf)
      #6 0x7f89bc44f9e8 in rpc_C_Initialize ../p11-kit/rpc-server.c:691

8 years agomodules: Fix memleak when loading remote module
Daiki Ueno [Wed, 21 Sep 2016 13:30:55 +0000 (15:30 +0200)]
modules: Fix memleak when loading remote module

Make sure to call p11_virtual_uninit() on managed module.  Otherwise the
associated lower_module will not be released.

GCC's asan spotted this:
  Direct leak of 56 byte(s) in 1 object(s) allocated from:
      #0 0x7f6c5368dfe0 in calloc (/lib64/libasan.so.3+0xc6fe0)
      #1 0x4436ba in p11_rpc_client_init ../p11-kit/rpc-client.c:2082
      #2 0x42c147 in p11_rpc_transport_new ../p11-kit/rpc-transport.c:850
      #3 0x415d95 in setup_module_for_remote_inlock ../p11-kit/modules.c:411

8 years agorpc: Fix memleak in rpc_socket cleanup
Daiki Ueno [Wed, 21 Sep 2016 13:06:41 +0000 (15:06 +0200)]
rpc: Fix memleak in rpc_socket cleanup

GCC's asan spotted this:
  Direct leak of 120 byte(s) in 1 object(s) allocated from:
      #0 0x7f8d4f221fe0 in calloc (/lib64/libasan.so.3+0xc6fe0)
      #1 0x427f55 in rpc_socket_new ../p11-kit/rpc-transport.c:100
      #2 0x42bc1b in rpc_exec_connect ../p11-kit/rpc-transport.c:767

8 years agouri: Port to PKCS#11 GNU calling convention
Daiki Ueno [Fri, 23 Sep 2016 11:27:18 +0000 (13:27 +0200)]
uri: Port to PKCS#11 GNU calling convention

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

8 years agouri: Fix buffer overflow in memcmp()
Daiki Ueno [Tue, 20 Sep 2016 10:15:07 +0000 (12:15 +0200)]
uri: Fix buffer overflow in memcmp()

The commit 63644dc introduced several memcmp() calls without checking
the length of the first argument.

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

8 years agotravis: Enable build on the CI
Daiki Ueno [Thu, 6 Oct 2016 14:09:29 +0000 (16:09 +0200)]
travis: Enable build on the CI

8 years agorpc: Send x-init-reserved to remote module
Daiki Ueno [Mon, 19 Sep 2016 14:36:19 +0000 (16:36 +0200)]
rpc: Send x-init-reserved to remote module

Signed-off-by: Stef Walter <stefw@redhat.com>
 * Fixed up indentation

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

8 years agotest: Fix p11_virtual_init() usage
Daiki Ueno [Tue, 20 Sep 2016 13:01:04 +0000 (15:01 +0200)]
test: Fix p11_virtual_init() usage

p11_virtual_init() should take a CK_FUNCTION_LIST as the 3rd argument,
if the 2nd argument is &p11_virtual_base.

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