From b9a8a140cf09780671402e872130a51ec4f4b014 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 7 Jun 2011 12:58:38 +0000 Subject: Add p11_kit_space_strdup() function, and rename p11_kit_space_strlen() * Print out module info in p11-kit tool. --- tools/p11-kit.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'tools') 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 #include -#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); -- cgit v1.1