summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* build: Move check_PROGRAMS into subdirectoriesDaiki Ueno2019-06-182-8/+8
|
* tests: Add tmpdir argument to p11_test_copy_setgidDaiki Ueno2019-06-183-5/+9
| | | | To prevent BUILDDIR being embedded in the library.
* tests: Skip tests calling getauxval(AT_SECURE) if binary is on /tmpDaiki Ueno2019-06-181-2/+3
|
* common: Make issetugid check simplerDaiki Ueno2019-06-181-5/+2
|
* common: Fix vasprintf emulationDaiki Ueno2019-06-181-1/+7
| | | | va_list must be saved when calling vsnprintf() in a loop.
* rpc: On UNIX wait on condition variable instead of FD if header is for a ↵Simon Haggett2019-06-141-0/+13
| | | | | | | | | | | | | | | | | | | | different thread. If rpc_socket_read() receives a header for a different thread, it tries to yield by releasing the read mutex and waiting on the socket's read FD. On Linux systems, this has been observed to cause a performance problem in cases where multiple threads are being used. Threads expecting a different header can rapidly unlock and relock the read mutex, as they resume when sock->read_code hasn't changed. This can result in contention on the read mutex, which delays the thread that is expecting to consume the header. This fix updates rpc_socket_read() on UNIX to wait on a condition variable instead of the socket's read FD. The condition variable is signalled when sock->read_code changes. This allows waiting threads to only resume once the header and payload have been consumed by their target thread. This fix only targets UNIX platforms, as the Windows version that p11-kit targets by default (Windows 2000) does not provide support for condition variables. Signed-off-by: Simon Haggett <simon.haggett@gmail.com>
* Fix Win32 p11_dl_error crashTom Sutcliffe2019-03-101-1/+4
| | | | | | Caused by returning a buffer that wasn't allocated with malloc and needed to be freed with LocalFree() instead. The fix is to strdup msg_buf so what's returned can be free()d.
* trust: Propagate library verbosity to module through init_argsDaiki Ueno2019-01-041-4/+4
| | | | | | Previously, even when the -v option is used with the 'trust' command, the messages from p11-kit-trust.so module were suppressed because the verbosity setting is not propagated to the module.
* build: Fix typo spotted by codespellDaiki Ueno2018-12-292-2/+2
|
* build: Simplify assertionsDaiki Ueno2018-11-231-6/+0
| | | | | Let it leak memory when we assert, so not to confuse static analyzers as if this is the normal case.
* build: Suppress cppcheck errorsDaiki Ueno2018-11-222-0/+6
|
* url: Prefer upper-case letters in hex characters when encodingDaiki Ueno2018-11-073-8/+46
| | | | | | | This makes it more compliant with RFC 3986, where the use of upper-case letters is recommended (as "SHOULD"). Suggested by Sumit Bose.
* build: Call va_end() always when leaving the functionDaiki Ueno2018-10-173-3/+11
|
* debug: Work around cppcheck false-positivesDaiki Ueno2018-10-171-3/+3
| | | | https://trac.cppcheck.net/ticket/8794
* common: use /proc only on LinuxLeonardo Brondani Schenkel2018-09-121-0/+2
| | | | | Non-Linux systems do not have /proc, so do not attempt to open it and eliminate an unnecessary access() syscall on those systems.
* pkcs11: Don't redefine CKM_CAMELLIA_KEY_GENDaiki Ueno2018-08-311-2/+1
| | | | Also reorder the CKM_CAMELLIA_* definitions.
* common: Factor out common initializer code into a headerDaiki Ueno2018-08-282-0/+95
|
* Revert "common: Prefer __register_atfork() to pthread_atfork() if possible"Daiki Ueno2018-08-171-18/+1
| | | | This reverts commit ce3cec7f8742254b8627b9db48973b81e91cbfc8.
* Revert "build: Link to libpthread, if pthread_atfork() needs to be used"Daiki Ueno2018-08-171-6/+4
| | | | This reverts commit 541d79cb651cfd3238b9aa41fce70208df8e9496.
* Update pkcs11 header to allow SoftHSMv2 to compileAlexander Bokovoy2018-08-171-18/+220
| | | | | Replace vendor-specific values with the IDs from PKCS11 v3.0 for those constants that were already standardized.
* build: Link to libpthread, if pthread_atfork() needs to be usedDaiki Ueno2018-08-101-4/+6
| | | | | | | | On non-glibc systems (e.g., FreeBSD), pthread_atfork() stub is provided as a nop and our fork detection mechanism doesn't work. Pull in the actual implementation from libpthread in that case. Signed-off-by: Daiki Ueno <dueno@redhat.com>
* common: Prefer __register_atfork() to pthread_atfork() if possibleDaiki Ueno2018-08-101-1/+18
|
* common: Use thread-local storage class when possibleDaiki Ueno2018-08-101-0/+22
| | | | | This eliminates the unconditional use of pthread_{get,set}specific() and pthread_key_{create,delete}(), which glibc doesn't provide the stubs.
* common, p11-kit, trust: Use pthread_once only when necessaryDaiki Ueno2018-08-102-1/+13
| | | | | | If the ELF constructor is usable, we don't really need the once-init function because it is guaranteed that the code runs only once in the constructor.
* common: Use static mutex initializer when possibleDaiki Ueno2018-08-103-6/+30
| | | | | This eliminates the use of pthread_mutexattr_* functions, which glibc doesn't provide the stubs.
* build: Make reallocarray detection robusterDaiki Ueno2018-07-161-1/+1
| | | | | | On NetBSD, reallocarray is not declared until _OPENBSD_SOURCE is defined. Reported by Patrick Welche in: https://lists.freedesktop.org/archives/p11-glue/2018-July/000691.html
* test: Avoid unnecessary memory allocationDaiki Ueno2018-05-301-4/+3
|
* common: Fix runtime directory detection when given prefix is longDaiki Ueno2018-05-301-7/+7
|
* common: Don't rely on issetugid() when it is brokenDaiki Ueno2018-05-301-1/+1
| | | | | | | | | | | On macOS and FreeBSD, issetugid() has different semantics from the original OpenBSD implementation and cannot reliably detect if the process made setuid/setgid: https://gist.github.com/nicowilliams/4daf74a3a0c86848d3cbd9d0cdb5e26e This should fix: https://bugs.freedesktop.org/show_bug.cgi?id=67451 https://bugs.freedesktop.org/show_bug.cgi?id=100287
* build: Don't use locale funcs if locale_t is not defined in locale.hDaiki Ueno2018-05-285-10/+16
| | | | | | On macOS, locale_t is not defined in <locale.h>. Although it is defined in <xlocale.h>, we rather not use locales at all for POSIX compliance.
* common: Make case conversion locale independentDaiki Ueno2018-05-254-4/+23
| | | | | | The tolower()/toupper() functions take into account of the current locale settings, which p11-kit doesn't want. Add replacement functions that work as if they are called under the C locale.
* common: Pacify clang-analyzerDaiki Ueno2018-05-071-3/+4
|
* library: Use dedicated locale object for printing errorDaiki Ueno2018-05-014-14/+42
|
* Revert "build: Check strerror_l() and uselocale() seperately"Daiki Ueno2018-05-012-14/+4
| | | | | | | | | This reverts commit 173ad93cc54057886b2055f3d73ea64a047127d1. We should rather use newlocale() when per-thread locale is not set. Otherwise uselocale() could return LC_GLOBAL_LOCALE on some platforms (e.g. musl-libc) and calling strerror_l() with it leads to an undefined behavior.
* build: Check strerror_l() and uselocale() seperatelyDaiki Ueno2018-04-192-4/+14
| | | | | | NetBSD deliberately doesn't support per-thread locale and our thread-safe replacement of strerror() using strerror_l() cannot be used. Fallback to strerror_r() in that case.
* test: Add test for p11_attrs_purge()Daiki Ueno2018-04-061-0/+29
|
* common: Fix compilation of runtime.c under mingwDaiki Ueno2018-03-292-10/+33
|
* common: Add assert_skip() and assert_todo()Daiki Ueno2018-03-292-15/+126
|
* common, client: Move runtime directory detection to libp11-commonDaiki Ueno2018-02-274-0/+290
|
* common: Make p11_test_directory_delete() work recursivelyDaiki Ueno2018-02-271-1/+11
|
* build: Delay compilation of test-related stuffDaiki Ueno2018-01-301-3/+6
|
* common: Re-add placeholder definition of p11_debugDaiki Ueno2017-08-181-0/+4
| | | | | This was mistakenly removed in commit efe6dc56c. Pointed by Lars Wendler in issue #97.
* build: Include <stdint.h> for SIZE_MAXDaiki Ueno2017-08-161-0/+1
| | | | Fixes issue #95.
* build: Include <stdint.h> for SIZE_MAXDaiki Ueno2017-08-151-0/+1
|
* common: New p11_array_insert functionDaiki Ueno2017-08-082-0/+20
|
* common: Use reallocarray instead of realloc as appropriateDaiki Ueno2017-08-084-4/+35
| | | | | | 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.
* pkcs11.h: updated informationNikos Mavrogiannopoulos2017-08-031-3/+3
| | | | | The scute project no longer exists, and the PKCS#11 standard is from OASIS group.
* pkcs11.h: added OTP-related mechanismsNikos Mavrogiannopoulos2017-08-031-0/+97
|
* pkcs11.h: added definitions of GOST CKA attributesNikos Mavrogiannopoulos2017-08-011-0/+3
|
* pkcs11.h: added definitions of GOST mechanismsNikos Mavrogiannopoulos2017-08-011-0/+12
| | | | | 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