summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-07-06 12:48:52 +0200
committerStef Walter <stefw@collabora.co.uk>2011-07-06 12:49:26 +0200
commit883b3ee76c686d14bbc1f20b0805d733a0c227ad (patch)
treee9993405141f54f06bb1dc608124dc2ec1bf38f6
parent1ff1a4895b2d5ff5fe559b96034fb1c3855d4b45 (diff)
More fine tuning of the pin APIs.
-rw-r--r--doc/p11-kit-sections.txt1
-rw-r--r--p11-kit/pin.c18
-rw-r--r--p11-kit/pin.h4
3 files changed, 20 insertions, 3 deletions
diff --git a/doc/p11-kit-sections.txt b/doc/p11-kit-sections.txt
index ab672c4..7d9a825 100644
--- a/doc/p11-kit-sections.txt
+++ b/doc/p11-kit-sections.txt
@@ -34,6 +34,7 @@ p11_kit_pin_new
p11_kit_pin_new_for_buffer
p11_kit_pin_new_for_string
p11_kit_pin_get_value
+p11_kit_pin_get_length
p11_kit_pin_ref
p11_kit_pin_unref
P11KitPinFlags
diff --git a/p11-kit/pin.c b/p11-kit/pin.c
index 5ede97a..572c138 100644
--- a/p11-kit/pin.c
+++ b/p11-kit/pin.c
@@ -509,7 +509,7 @@ p11_kit_pin_file_callback (const char *pinfile,
* A structure representing a PKCS\#11 PIN. There are no public fields
* visible in this structure. Use the various accessor functions.
*/
-struct _P11KitPin {
+struct p11_kit_pin {
int ref_count;
unsigned char *buffer;
size_t length;
@@ -617,7 +617,7 @@ p11_kit_pin_new_for_buffer (unsigned char *buffer, size_t length,
*
* The value returned is owned by the P11KitPin and should not be modified.
* It remains valid as long as a reference to the PIN is held. The PIN value
- * will contain an extra null-terminator character.
+ * will not contain an extra null-terminator character.
*
* Returns: the value for the PIN.
*/
@@ -630,6 +630,20 @@ p11_kit_pin_get_value (P11KitPin *pin, size_t *length)
}
/**
+ * p11_kit_pin_get_length
+ * @pin: the P11KitPin
+ *
+ * Get the length of the PIN value from a P11KitPin.
+ *
+ * Returns: the length of the PIN value.
+ */
+size_t
+p11_kit_pin_get_length (P11KitPin *pin)
+{
+ return pin->length;
+}
+
+/**
* p11_kit_pin_ref:
* @pin: the P11KitPin
*
diff --git a/p11-kit/pin.h b/p11-kit/pin.h
index 9d05331..07e7f6a 100644
--- a/p11-kit/pin.h
+++ b/p11-kit/pin.h
@@ -41,7 +41,7 @@
extern "C" {
#endif
-typedef struct _P11KitPin P11KitPin;
+typedef struct p11_kit_pin P11KitPin;
typedef enum {
P11_KIT_PIN_FLAGS_USER_LOGIN = 1,
@@ -72,6 +72,8 @@ void p11_kit_pin_unref (P11KitPin *pin);
const unsigned char * p11_kit_pin_get_value (P11KitPin *pin,
size_t *length);
+size_t p11_kit_pin_get_length (P11KitPin *pin);
+
typedef P11KitPin* (*p11_kit_pin_callback) (const char *pinfile,
P11KitUri *pin_uri,
const char *pin_description,