summaryrefslogtreecommitdiff
path: root/p11-kit/uri.c
Commit message (Collapse)AuthorAgeFilesLines
* uri: Make vendor query attribute handling reliableDaiki Ueno2017-08-081-24/+80
| | | | | | | | | | | | 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.
* uri: Support vendor query attributesDaiki Ueno2017-02-211-2/+98
| | | | | | | | 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.
* uri: Relax pin-* parsing for compatibilityDaiki Ueno2017-02-021-5/+26
| | | | | | | | | | | | 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
* uri: Support query attributes to specify moduleDaiki Ueno2017-01-191-9/+112
| | | | | Accept and produce 'module-name' and 'module-path' query attributes defined in RFC 7512.
* uri: Avoid typecasting confusion on s390xDaiki Ueno2017-01-171-2/+4
| | | | | | | | | 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
* uri: fix producing the query attributesLubomir Rintel2017-01-121-34/+47
| | | | Put the pin-* attributes where they belong: to the query part.
* uri: fix the query attribute parsingLubomir Rintel2017-01-121-11/+39
| | | | | | | | | | | | 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.
* uri: Fix buffer overflow in memcmp()Daiki Ueno2016-10-311-25/+32
| | | | | | | The commit 63644dc introduced several memcmp() calls without checking the length of the first argument. https://bugs.freedesktop.org/show_bug.cgi?id=97245
* uri: Support 'slot-id' path attributeDaiki Ueno2016-09-021-3/+75
| | | | | | Accept 'slot-id' path attribute defined in RFC 7512. https://bugs.freedesktop.org/show_bug.cgi?id=97245
* uri: Support slot info path attributesDaiki Ueno2016-09-021-0/+101
| | | | | | | Accept 'slot-description' and 'slot-manifacturer' path attributes defined in RFC 7512. https://bugs.freedesktop.org/show_bug.cgi?id=97245
* uri: Remove whitespace early when parsingDaiki Ueno2016-09-021-66/+78
| | | | | | | | | | | For every path/query component, p11_kit_uri_parse() allocates a small buffer to strip whitespace out. This patch removes any whitespace in the URI at the entry of the function to simplify the code. Note that RFC 7512 actually suggests to ignore whitespace at the extracting phase rather than the parsing phase. https://bugs.freedesktop.org/show_bug.cgi?id=97245
* Generate URIs compliant to the PKCS#11 URI draft in LCNikos Mavrogiannopoulos2015-02-201-1/+1
| | | | | | | | | | | | We continue to accept both the older style 'object-type' field in addition to the new 'type' field. However we start generating URIs in the new form. In other words we have backwards compatibility, but not forwards compatibility. Given the fact that PKCS#11 URIs are now standardizing this is an acceptable compromise. https://bugs.freedesktop.org/show_bug.cgi?id=86474
* Added support for pin-value PKCS#11 URI elementNikos Mavrogiannopoulos2015-02-201-0/+52
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=87582
* p11-kit: Remove duplicate WHITESPACE defineStef Walter2015-02-201-5/+3
|
* uri: Accept 'type' in additon to 'object-type' in PKCS#11 URIsStef Walter2014-11-141-2/+3
| | | | This was a later change to the PKCS#11 specification drafts
* Declare static variables const where it makes senseStef Walter2013-07-181-2/+2
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=985337
* url: Encode directly to a bufferStef Walter2013-05-271-13/+19
|
* Separate library init from message codeStef Walter2013-04-031-1/+1
| | | | | | | | | | | 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 memory leaks reported by 'make leakcheck'Stef Walter2013-03-201-4/+1
|
* url: Split out the URL encoding and decoding functionsStef Walter2013-03-151-108/+12
| | | | | | | 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
* Fix various clang analyzer warningsStef Walter2013-02-061-1/+0
| | | | | * Add annotations to our precondition functions so that they don't make the analyzer complain
* Allow internal use of token and module info matchingStef Walter2013-02-051-20/+35
|
* Add generic buffer codeStef Walter2013-02-041-56/+37
| | | | Represents a block of memory that can be added to, parsed and so on
* Use the stdbool.h C99 bool typeStef Walter2013-01-231-48/+70
| | | | | | It was getting really wild knowing whether a function returning an int would return -1 on failure or 0 or whether the int return value was actually a number etc..
* Add common functions for manipulating CK_ATTRIBUTE arraysStef Walter2013-01-091-151/+56
|
* Move debug and library code into the common/ subdirectoryStef Walter2013-01-091-3/+3
| | | | | | | | | | | Start using p11_ as our internal prefix rather than _p11_. We explicitly export p11_kit_ so this is fine as far as visibility. Move the threading, mutex, and module compat, dict, and array code into the common directory too. Take this opportunity to clean up a bit of internal API as well, since so many lines are being touched internally.
* Fix documentation warnings.Stef Walter2013-01-071-3/+6
| | | | | | * P11_KIT_URI_NO_MEMORY is an unexpected state, that will probably never actually be returned. But kept for API compatibility. * make distcheck doc fix
* Always encode the "id" attribute in URIsDan Winship2012-07-281-10/+14
| | | | | | Per recommendation of the spec. https://bugs.freedesktop.org/show_bug.cgi?id=52606
* Preconditions to check for input probs and out of memoryStef Walter2012-05-131-60/+52
| | | | | | * We don't try to guarantee completely robust and problem free behavior in cases where the caller or process isn't behaving. We consider these to be outside of our control.
* More fixes for non-static function namesStef Walter2011-10-241-1/+1
| | | | | * See previous commit * Initialize library before debug statements
* Rename non-static functions to have a _p11_xxx prefix.Stef Walter2011-10-241-1/+1
| | | | | | | * Work around issues with brain-dead linkers not respecting the libtool -export-symbol-regex argument https://bugs.freedesktop.org/show_bug.cgi?id=42020
* Ignore spaces in PKCS#11 URIsStef Walter2011-08-191-21/+64
| | | | | | * These should be able to occur anywhere and should be ignored according to RFC 3986. This is documented in the PKCS#11 URI specification.
* Update PKCS#11 URI code for new draft of specStef Walter2011-08-051-27/+56
| | | | | | | | | * pinfile attribute was renamed to pin-source * objecttype attribute was renamed to object-type * secretkey value was renamed to secret-key We continue to support parsing the old attribute names and values but generate URIs with the new ones.
* Add p11_kit_space_strdup() function, and rename p11_kit_space_strlen()Stef Walter2011-06-071-13/+2
| | | | * Print out module info in p11-kit tool.
* Fix URI parsing memory leaks.Stef Walter2011-06-071-0/+1
|
* Clear correct block of memory in p11_kit_uri_parse().Stef Walter2011-05-301-1/+1
|
* Cleanup URI typesStef Walter2011-05-301-18/+45
| | | | | * Support with/without library version. * Make names of types clearer.
* Add function p11_kit_uri_space_strlen() for figuring out the lengthStef Walter2011-05-301-3/+3
| | | | of space terminated strings.
* Allow use with CRYPTOKI_GNU style use of PKCS#11Stef Walter2011-05-301-1/+1
|
* Change around installation of headers, pkg-config, and file namesStef Walter2011-05-271-0/+1337
* Install headers to ${prefix}/include/p11-kit-1/p11-kit/ * This solves problems with other projects that have their own pkcs11.h files. * Change the pkg-config file name to p11-kit-1.pc * Change the source file names.