[PATCH] do_not_fail_getattrval_pkcs11spy.patch

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] do_not_fail_getattrval_pkcs11spy.patch

Marc Bevand
Nils, here is a patch that fixes a minor issue in pkcs11-spy.

pkcs11-spy was not handling correctly some C_GetAttributeValue()
"partial" failures.

--
Marc Bevand                              http://epita.fr/~bevand_m
Computer Science School EPITA - System, Network and Security Dept.

pkcs11-spy was not handling correctly some C_GetAttributeValue() "partial"
failures.

 
Index: src/pkcs11/pkcs11-spy.c
===================================================================
--- src/pkcs11/pkcs11-spy.c (revision 2384)
+++ src/pkcs11/pkcs11-spy.c (working copy)
@@ -537,8 +537,15 @@
   spy_dump_ulong_in("hSession", hSession);
   spy_dump_ulong_in("hObject", hObject);
   spy_attribute_req_in("pTemplate", pTemplate, ulCount);
+  /* PKCS#11 says:
+   * ``Note that the error codes CKR_ATTRIBUTE_SENSITIVE,
+   *   CKR_ATTRIBUTE_TYPE_INVALID, and CKR_BUFFER_TOO_SMALL do not denote
+   *   true errors for C_GetAttributeValue.''
+   * That's why we ignore these error codes, because we want to display
+   * all other attributes anyway (they may have been returned correctly) */
   rv = po->C_GetAttributeValue(hSession, hObject, pTemplate, ulCount);
-  if (rv == CKR_OK) {
+  if (rv == CKR_OK || rv == CKR_ATTRIBUTE_SENSITIVE ||
+  rv == CKR_ATTRIBUTE_TYPE_INVALID || rv == CKR_BUFFER_TOO_SMALL) {
     spy_attribute_list_out("pTemplate", pTemplate, ulCount);
   }
   return retne(rv);

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] do_not_fail_getattrval_pkcs11spy.patch

Nils Larsch
Marc Bevand wrote:
> Nils, here is a patch that fixes a minor issue in pkcs11-spy.
>
> pkcs11-spy was not handling correctly some C_GetAttributeValue()
> "partial" failures.

ok, committed.

Thanks,
Nils
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel