summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2013-03-18 21:00:53 +0100
committerStef Walter <stefw@gnome.org>2013-03-18 21:55:18 +0100
commit6c47831b3bfc66e1e995fb27e80c23085bb41e08 (patch)
tree8100e23c7a6f59f5fec55d6ac68cba130ae68e40
parent128239732a5b7e184d5d9c505402630ee9215080 (diff)
downloadp11-kit-6c47831b3bfc66e1e995fb27e80c23085bb41e08.tar.gz
trust: Provide better debugging of trust module functions
Make C_FindObjects() and C_GetAttributeValue() functions dump the attributes that they're dealing with when in debug mode.
-rw-r--r--trust/module.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/trust/module.c b/trust/module.c
index 3ef4034..5759e91 100644
--- a/trust/module.c
+++ b/trust/module.c
@@ -972,10 +972,11 @@ sys_C_GetAttributeValue (CK_SESSION_HANDLE handle,
CK_ATTRIBUTE *result;
CK_ATTRIBUTE *attr;
p11_session *session;
+ char *string;
CK_ULONG i;
CK_RV rv;
- p11_debug ("in");
+ p11_debug ("in: %lu, %lu", handle, object);
p11_lock ();
@@ -1014,7 +1015,11 @@ sys_C_GetAttributeValue (CK_SESSION_HANDLE handle,
p11_unlock ();
- p11_debug ("out: 0x%lx", rv);
+ if (p11_debugging) {
+ string = p11_attrs_to_string (template, count);
+ p11_debug ("out: 0x%lx %s", rv, string);
+ free (string);
+ }
return rv;
}
@@ -1102,10 +1107,15 @@ sys_C_FindObjectsInit (CK_SESSION_HANDLE handle,
CK_BBOOL token;
FindObjects *find;
p11_session *session;
+ char *string;
CK_RV rv;
int n = 0;
- p11_debug ("in");
+ if (p11_debugging) {
+ string = p11_attrs_to_string (template, count);
+ p11_debug ("in: %lu, %s", handle, string);
+ free (string);
+ }
p11_lock ();
@@ -1177,7 +1187,7 @@ sys_C_FindObjects (CK_SESSION_HANDLE handle,
return_val_if_fail (count != NULL, CKR_ARGUMENTS_BAD);
- p11_debug ("in");
+ p11_debug ("in: %lu, %lu", handle, max_count);
p11_lock ();
@@ -1212,7 +1222,7 @@ sys_C_FindObjects (CK_SESSION_HANDLE handle,
p11_unlock ();
- p11_debug ("out: 0x%lx", rv);
+ p11_debug ("out: 0x%lx, %lu", handle, *count);
return rv;
}