aboutsummaryrefslogtreecommitdiff
path: root/pkcs11-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'pkcs11-helper.c')
-rw-r--r--pkcs11-helper.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/pkcs11-helper.c b/pkcs11-helper.c
index 391d91f..4dd798e 100644
--- a/pkcs11-helper.c
+++ b/pkcs11-helper.c
@@ -5196,6 +5196,19 @@ _pkcs11h_certificate_private_op (
fOpSuccess = TRUE;
}
else {
+ /*
+ * OpenSC workaround
+ * It still allows C_FindObjectsInit when
+ * token is removed/inserted but fails
+ * private key operation.
+ * So we force logout.
+ * bug#108 at OpenSC trac
+ */
+ if (fLoginRetry && rv == CKR_DEVICE_REMOVED) {
+ fLoginRetry = FALSE;
+ _pkcs11h_logout (certificate->session);
+ }
+
if (!fLoginRetry) {
PKCS11H_DEBUG (
PKCS11H_LOG_DEBUG1,
@@ -5778,7 +5791,7 @@ pkcs11h_certificate_getCertificateBlob (
if (certificate_blob != NULL) {
if (
rv == CKR_OK &&
- certifiate_blob_size_max > certificate->id->certificate_blob_size
+ certifiate_blob_size_max < certificate->id->certificate_blob_size
) {
rv = CKR_BUFFER_TOO_SMALL;
}