summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-06-07 12:58:38 +0000
committerStef Walter <stefw@collabora.co.uk>2011-06-07 12:58:38 +0000
commitb9a8a140cf09780671402e872130a51ec4f4b014 (patch)
tree63f7d4bbb427ef90f473b6c30e1567ff5281839a /tools
parentb315f99c90d01104d6baa91ca0f2cfb32c920abd (diff)
Add p11_kit_space_strdup() function, and rename p11_kit_space_strlen()
* Print out module info in p11-kit tool.
Diffstat (limited to 'tools')
-rw-r--r--tools/p11-kit.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/p11-kit.c b/tools/p11-kit.c
index 175b561..298c56d 100644
--- a/tools/p11-kit.c
+++ b/tools/p11-kit.c
@@ -41,7 +41,8 @@
#include <stdlib.h>
#include <unistd.h>
-#include "p11-kit.h"
+#include "p11-kit/p11-kit.h"
+#include "p11-kit/uri.h"
typedef int (*operation) (int argc, char *argv[]);
int verbose = 0;
@@ -54,6 +55,30 @@ usage (void)
exit (2);
}
+static void
+print_module_info (CK_FUNCTION_LIST_PTR module)
+{
+ CK_INFO info;
+ char *value;
+ CK_RV rv;
+
+ rv = (module->C_GetInfo) (&info);
+ if (rv != CKR_OK) {
+ warnx ("couldn't load module info: %s", p11_kit_strerror (rv));
+ return;
+ }
+
+ value = p11_kit_space_strdup (info.libraryDescription,
+ sizeof (info.libraryDescription));
+ printf ("\tlibrary-description: %s\n", value);
+ free (value);
+
+ value = p11_kit_space_strdup (info.manufacturerID,
+ sizeof (info.manufacturerID));
+ printf ("\tlibrary-manufacturer: %s\n", value);
+ free (value);
+}
+
static int
list_modules (int argc, char *argv[])
{
@@ -79,6 +104,7 @@ list_modules (int argc, char *argv[])
printf ("%s: %s\n",
name ? name : "(null)",
path ? path : "(null)");
+ print_module_info (module_list[i]);
free (name);
free (path);