summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Our own unit testing frameworkStef Walter2013-05-2121-1006/+1162
| | | | | | | | * 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
* Pull the argv parsing code into its own fileStef Walter2013-05-213-0/+160
| | | | So it can be used from multiple code paths
* Support /xxx/yyy as an absolute path with Win32Stef Walter2013-05-212-5/+5
| | | | | Because win32 code doesn't just run on windows, wine runs with unix style paths.
* Add the log-calls module config optionStef Walter2013-05-215-20/+387
| | | | | If 'log-calls = yes' is set then all the PKCS#11 modules are logged to stderr.
* Manage C_CloseAllSessions function for multiple callersStef Walter2013-05-211-1/+1
| | | | | | Make C_CloseAllSessions work for different callers. Track the sessions that each caller opens and close just those when C_CloseAllSessiosn is called.
* Update the proxy module to use managed PKCS#11 modulesStef Walter2013-05-212-9/+11
| | | | | | | | | | 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.
* p11-kit: Managed PKCS#11 module loadingStef Walter2013-05-214-25/+54
| | | | | | | | | 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.
* Add subclassable CK_X_FUNCTION_LISTStef Walter2013-05-153-4/+1561
| | | | | | | | | | 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.
* Implement valgrind's hellgrind checks for threading problemsStef Walter2013-05-151-1/+1
| | | | | | | 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.
* Patch to make test-lexer depend on ASN.1manphiz@gmail.com2013-05-141-1/+1
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=64378
* Don't print erroneous debug messages when skipping filesStef Walter2013-04-041-6/+6
| | | | | The parser automatically skips over files that it cannot parse. Don't print confusing debug messages about DER parse failures when it does so.
* Update to MurmurHash3Stef Walter2013-04-035-84/+91
| | | | | | | 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
* Don't respect timezones for CKA_START_DATE or CKA_END_DATEStef Walter2013-04-032-338/+0
| | | | | | | | | | | | | 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
* More compatible path munging and handling codeStef Walter2013-04-038-73/+526
| | | | | | | | | | 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
* Don't use free() on memory allocated by LocalFree()Stef Walter2013-04-031-1/+1
| | | | ihttps://bugs.freedesktop.org/show_bug.cgi?id=63046
* Separate library init from message codeStef Walter2013-04-0311-102/+234
| | | | | | | | | | | 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
* Don't use library locks from p11-kit toolStef Walter2013-04-031-4/+0
| | | | | | | 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
* Fix build with automake 1.13Stef Walter2013-04-031-2/+2
| | | | Also remove some generated files from the po/ directory.
* Don't try to guess at overflowing time values on 32-bit systemsStef Walter2013-03-281-3/+3
| | | | | | | | | 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
* Fix testing of murmur hash on bigendian systemsStef Walter2013-03-251-37/+23
| | | | | | The murmur hash produces different output depending on the architecture https://bugzilla.redhat.com/show_bug.cgi?id=927394
* Fix memory leaks reported by 'make leakcheck'Stef Walter2013-03-205-1/+11
|
* Fix invalid memory accesses reported by 'make memcheck'Stef Walter2013-03-203-18/+31
| | | | These are things that showed up in valgrind while running the tests.
* Add a bit of infrastructure for running valgrindStef Walter2013-03-202-3/+2
| | | | | * make memcheck: Runs basic memory checking * make leakcheck: Also runs leak checking
* attrs: Print out the CKA_VALUE for certificates when debuggingStef Walter2013-03-203-14/+51
| | | | | | | | 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
* hash: Add the murmur2 hash and start using itStef Walter2013-03-207-30/+215
| | | | | | | | | | | 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.
* hash: Rename file and functions for hashesStef Walter2013-03-206-42/+42
| | | | | We're going to be adding other hashes. Also build as part of a different common library.
* trust: Don't use POSIX or GNU basename()Stef Walter2013-03-194-24/+131
| | | | | | Both are nasty. Do our own, and test it a bit https://bugs.freedesktop.org/show_bug.cgi?id=62479
* Release version 0.17.1Stef Walter2013-03-181-1/+21
| | | | * Fix distcheck bugs surrounding the strndup() workaround
* attrs: Change p11_attrs_to_string() to allow static templatesStef Walter2013-03-183-7/+15
| | | | | 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.
* compat: Fix trivial commentStef Walter2013-03-181-1/+1
|
* Use the nickname x-distrusted for CKA_X_DISTRUSTEDStef Walter2013-03-181-1/+1
| | | | | This is a non-standard PKCS#11 attribute, so has the X prefix like the other ones we've added.
* Refine looking up of attributes in arraysStef Walter2013-03-184-80/+91
| | | | | | | | 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
* Fix distcheck and documentationStef Walter2013-03-151-8/+8
|
* trust: Update frob-nss-tool so it can compare modules for trust infoStef Walter2013-03-152-0/+25
| | | | | Can run with two modules now so that it can compare tokens NSS trust info.
* trust: Support a p11-kit specific serialization formatStef Walter2013-03-153-0/+27
| | | | | | | This is documented in doc/internals/ subdirectory Add tests for the format as well. https://bugs.freedesktop.org/show_bug.cgi?id=62156
* url: Split out the URL encoding and decoding functionsStef Walter2013-03-155-0/+369
| | | | | | | 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
* lexer: Make a lexer for our config file formatStef Walter2013-03-155-0/+605
| | | | | | This lexer will be used in our PKCS#11 persistence format as well. https://bugs.freedesktop.org/show_bug.cgi?id=62156
* trust: Use a SHA-1 hash of subjectPublicKeyInfo as CKA_ID by defaultStef Walter2013-03-152-0/+27
| | | | | | | 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
* attrs: Add info functions for constant names and valuesStef Walter2013-03-156-232/+566
| | | | | | | * 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
* attrs: New p11_attrs_merge() functionStef Walter2013-03-153-6/+153
| | | | | | | This takes one set of attributes and merges them into another, without copying memory needlessly. https://bugs.freedesktop.org/show_bug.cgi?id=62329
* asn1: Implement a parsed ASN.1 tree cacheStef Walter2013-03-153-0/+177
| | | | | | | | | 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
* dict: Allow removal of current item in a p11_dict iterationStef Walter2013-03-152-0/+62
| | | | | | | * This was already possible to do safely before * Document and test this behavior https://bugs.freedesktop.org/show_bug.cgi?id=61499
* pem: Fix a bug decoding some PEM filesStef Walter2013-03-153-11/+221
| | | | | When bringing over the BSD base64 code, there was a regression. In addition add some tests for the base64 stuff.
* trust: Use the new NSS PKCS#11 extension codesStef Walter2013-03-082-67/+68
| | | | | NSS had subtly changed the values of the distrust CK_TRUST codes so update them to stay in sync.
* Don't shove messages into debug output if they're already displayedStef Walter2013-03-081-2/+2
|
* tools: Add a bit of debugging to the PEM extract handlerStef Walter2013-03-081-0/+1
|
* x509: Don't break when cA field of BasicConstraints is missingStef Walter2013-03-071-2/+9
| | | | | | | The field defaults to FALSE. It sucks that libtasn1 doesn't fill this in for us. https://bugs.freedesktop.org/show_bug.cgi?id=61975
* Build with the libtasn1 CFLAGS properlyStef Walter2013-03-042-0/+7
| | | | | | Tweaks by: Roman Bogorodskiy <bogorodskiy@gmail.com> https://bugs.freedesktop.org/show_bug.cgi?id=61739
* Redo mock.h header in order to relicenseStef Walter2013-03-041-667/+686
| | | | | Rewrite the mock.h header to relicense it. It is based on the BSD licensed mock.c file, so this isn't a big issue.
* Don't use wchar_t for storing unicode charactersStef Walter2013-03-031-35/+36
| | | | | On Win32 wchar_t is only 2 bytes, which breaks our UTF-8 conversion functions.