summaryrefslogtreecommitdiff
path: root/trust
Commit message (Collapse)AuthorAgeFilesLines
* p11-kit: Managed PKCS#11 module loadingStef Walter2013-05-211-6/+19
| | | | | | | | | 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.
* Fix off by one in date parsing codeStef Walter2013-04-041-1/+1
| | | | | We didn't treat the two digit year 00 as a valid year, whereas it actually represents the year 2000. This is in a non-critical code path.
* Don't print erroneous debug messages when skipping filesStef Walter2013-04-041-3/+5
| | | | | The parser automatically skips over files that it cannot parse. Don't print confusing debug messages about DER parse failures when it does so.
* Don't respect timezones for CKA_START_DATE or CKA_END_DATEStef Walter2013-04-032-33/+81
| | | | | | | | | | | | | 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
* trust: Fix logic for matching invalid NSS serial numbersStef Walter2013-04-032-47/+180
| | | | | | | | Sometimes NSS queries for trust objects using invalid serial numbers that do not have their DER decoding. We fixed this earlier, but want to make sure there are no corner cases, accidentally not matching serial numbers that happen to start with the same bytes as a DER TLV would.
* More compatible path munging and handling codeStef Walter2013-04-034-6/+15
| | | | | | | | | | 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
* Separate library init from message codeStef Walter2013-04-0313-20/+13
| | | | | | | | | | | 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
* Fix build with automake 1.13Stef Walter2013-04-031-1/+1
| | | | Also remove some generated files from the po/ directory.
* Use CKA_X_CERTIFICATE_VALUE for trust assertionsStef Walter2013-03-292-8/+13
| | | | | | | These don't contain the CKA_VALUE attribute for certificate data but rather the CKA_X_CERTIFICATE_VALUE attribute. https://bugs.freedesktop.org/show_bug.cgi?id=62896
* Don't complain when applications call C_Logout or C_LoginStef Walter2013-03-282-2/+53
| | | | | | | Some callers erroneously call our C_Logout function, like NSS. So return appropriate error codes in these cases. https://bugs.freedesktop.org/show_bug.cgi?id=62874
* Don't try to guess at overflowing time values on 32-bit systemsStef Walter2013-03-282-2/+74
| | | | | | | | | 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 memory leaks reported by 'make leakcheck'Stef Walter2013-03-207-15/+58
|
* Fix invalid memory accesses reported by 'make memcheck'Stef Walter2013-03-202-1/+3
| | | | 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
* trust: Predictable behavior with duplicate certificates in tokenStef Walter2013-03-203-16/+224
| | | | | | | | If duplicate certificates are present in a token, we warn about this, and don't really recommend it. However we have predictable behavior where blacklist is prefered to anchor is preferred to unknown trust. https://bugs.freedesktop.org/show_bug.cgi?id=62548
* trust: Rework index to be faster and more usableStef Walter2013-03-209-179/+437
| | | | | | | | | The index now uses a sort of cross between a hash table and a bloom filter internally to select matching items. This is needed for the massive amount of lookups we want to do during loading. In addition make p11_index_find() and p11_index_replace() easier to use.
* attrs: Print out the CKA_VALUE for certificates when debuggingStef Walter2013-03-202-6/+12
| | | | | | | | 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-202-4/+3
| | | | | | | | | | | 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-204-18/+18
| | | | | We're going to be adding other hashes. Also build as part of a different common library.
* trust: Use descriptive labels for tokensStef Walter2013-03-198-27/+112
| | | | | | | | Try to determine which one is the system trust input token, and which one is the default token by using datadir and sysconfdir respectively. https://bugs.freedesktop.org/show_bug.cgi?id=62534
* trust: Remove the temporary built in distrust objectsStef Walter2013-03-191-148/+0
| | | | These should now be loaded from the .p11-kit persist format.
* trust: Don't use POSIX or GNU basename()Stef Walter2013-03-192-3/+6
| | | | | | Both are nasty. Do our own, and test it a bit https://bugs.freedesktop.org/show_bug.cgi?id=62479
* trust: Fix trust tests on 32-bit buildsStef Walter2013-03-181-2/+2
|
* trust: Fix invalid varargs call in the builderStef Walter2013-03-181-1/+1
|
* trust: Provide better debugging of trust module functionsStef Walter2013-03-181-5/+15
| | | | | Make C_FindObjects() and C_GetAttributeValue() functions dump the attributes that they're dealing with when in debug mode.
* attrs: Change p11_attrs_to_string() to allow static templatesStef Walter2013-03-181-1/+1
| | | | | 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.
* trust: Handle incorrectly encoded CKA_SERIAL_NUMBER lookupsStef Walter2013-03-183-1/+114
| | | | | | | | Handle lookups for trust objects (by NSS) which expect CKA_SERIAL_NUMBER attributes without appropriate DER encoding. In addition allow creation of NSS trust objects as PKCS#11 session objects, so that we can test this behavior.
* trust: Better generation of nss objects and assertions for serial+issuerStef Walter2013-03-183-225/+341
| | | | | | | In many cases certficates are distrusted by serial+issuer. Make sure this works, and fix various cases where we weren't generating compat NSS objects and compat trust assertions for these types of input.
* Refine looking up of attributes in arraysStef Walter2013-03-185-60/+52
| | | | | | | | 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
* trust: Remove file that's no longer usedStef Walter2013-03-171-301/+0
|
* Fix distcheck and documentationStef Walter2013-03-152-4/+6
|
* trust: Update frob-nss-tool so it can compare modules for trust infoStef Walter2013-03-151-35/+139
| | | | | 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-1512-41/+1059
| | | | | | | This is documented in doc/internals/ subdirectory Add tests for the 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-156-39/+88
| | | | | | | 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
* trust: Add a builder which builds objects out of parsed dataStef Walter2013-03-1515-1750/+3593
| | | | | | | | | | | The builder completes the objects from the parsed data and takes over the responsibilities that the parser and adapter previously shared. This is necessary to prepare for arbitrary data coming from the p11-kit specific input files. https://bugs.freedesktop.org/show_bug.cgi?id=62329
* trust: Refactor to include concept of the indexStef Walter2013-03-1514-384/+2097
| | | | | | | | | | * The index holds PKCS#11 objects whether for the token or for the session. * The index provides hook for a builder to expand or validate objects being added to the index. * In addition theres a change hook so that a builder can maintain state between objects, such as the compat NSS trust objects. https://bugs.freedesktop.org/show_bug.cgi?id=62329
* p11-kit: New priority option and change trust-policy optionStef Walter2013-03-151-3/+11
| | | | | | | | | | | | | | * Sort loaded modules appropriately using the 'priority' option. This allows us to have a predictable order for callers, when callers iterate through modules. * Modules default to having an 'priority' option of '0'. * If modules have the same order value, then sort by name. * The above assumes the role of ordering trust-policy sources. * Change the trust-policy option to a boolean * Some of this code will be rearranged when the managed branch is merged. https://bugs.freedesktop.org/show_bug.cgi?id=61978
* trust: Make each configured path its own tokenStef Walter2013-03-157-136/+460
| | | | | | | | | | | | | | | | | | | * Each source directory or file configured into the module or passed in as an initialization argument becomes its own token. Previously there was one token that contained certificates from all the configured paths. * These tokens are clearly labeled in the token info as to the directory or file that they represent. * Update PKCS#11 module logic to deal with multiple tokens, validate the slot ids and so on. * The order in which the paths are configured will become the order of trust priority. This is the same order in which they are listed through 'p11-kit list-modules' and C_GetSlotList. * Update the frob-token internal tool to only play with one path * Adjust tests where necessary to reflect the new state of things and add tests for modified trust module code https://bugs.freedesktop.org/show_bug.cgi?id=61499
* trust: Rework input path treatmentStef Walter2013-03-1515-54/+253
| | | | | | | | | | | | | | | | | | | | | * Accept a single --with-trust-paths argument to ./configure which cotnains all the input paths. * The --with-system-anchors and --with-system-certificates ./configure arguments are no longer supported. Since they were only present briefly, no provision is made for backwards compatibility. * Each input file is treated as containing anchors by default unless an input certificate contains detailed trust information. * The files in each input directory are not automatically treated as anchors unless a certificate contains detailed trust information. * The files in anchors/ subdirectory of each input directory are automatically marked as anchors. * The files in the blacklist/ subdirectory of each input directory are automatically marked as blacklisted. * Update tests and move around test certificates so we can test these changes. https://bugs.freedesktop.org/show_bug.cgi?id=62327
* pem: Fix a bug decoding some PEM filesStef Walter2013-03-151-0/+25
| | | | | When bringing over the BSD base64 code, there was a regression. In addition add some tests for the base64 stuff.
* trust: add a simple frob-nss-token tool to dump distrustStef Walter2013-03-082-0/+109
| | | | | Add a simple tool to dump NSS style distrust attributes from a module.
* trust: Use the new NSS PKCS#11 extension codesStef Walter2013-03-084-27/+27
| | | | | NSS had subtly changed the values of the distrust CK_TRUST codes so update them to stay in sync.
* Hard code distrust temporarily.Stef Walter2013-03-081-1/+149
| | | | | This is because we have no way to load this data into the trust module. Working on a real solution.
* trust: Refactor how we load builtin objectsStef Walter2013-03-081-11/+13
|
* Build with the libtasn1 CFLAGS properlyStef Walter2013-03-041-0/+1
| | | | | | Tweaks by: Roman Bogorodskiy <bogorodskiy@gmail.com> https://bugs.freedesktop.org/show_bug.cgi?id=61739
* Initialize modules correctly in testsStef Walter2013-03-034-1/+4
| | | | This fixes hangs when running tests on windows
* Fix syntax errors in OS_WIN32 ifdefsStef Walter2013-03-032-2/+6
|
* Abstract mmap() into a compat APIStef Walter2013-03-031-21/+7
| | | | | The Win32 for mmap() is very different from Unix, so abstract this into our own p11_mmap_xxx() functions.
* Use putenv() instead of setenv()Stef Walter2013-03-034-4/+4
| | | | Since older operating systems don't support setenv()
* Only do shared object and DLL initialization in librariesStef Walter2013-02-201-0/+55
| | | | | | 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.