[pkg-opensc-commit] [engine-pkcs11] 04/152: adapt to latest changes in libp11.
Eric Dorland
eric at moszumanska.debian.org
Mon Oct 19 03:11:08 UTC 2015
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository engine-pkcs11.
commit d76c531419d6b116f8d6835a110a09c2be2a9a2c
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date: Thu Sep 1 14:15:56 2005 +0000
adapt to latest changes in libp11.
---
src/engine_pkcs11.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 5becc83..d81a65f 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -325,18 +325,20 @@ X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
}
if (slot_nr == -1) {
- if (!(slot = PKCS11_find_token(ctx)))
+ if (!(slot = PKCS11_find_token(ctx, slot_list, count)))
fail("didn't find any tokens\n");
} else if (slot_nr >= 0 && slot_nr < count)
slot = slot_list + slot_nr;
else {
fprintf(stderr,"Invalid slot number: %d\n", slot_nr);
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
}
tok = slot->token;
if (tok == NULL) {
fprintf(stderr,"Found empty token; \n");
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
}
@@ -347,7 +349,7 @@ X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
if (PKCS11_enumerate_certs(tok, &certs, &count)) {
fail("unable to enumerate certificates\n");
-
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
}
@@ -369,6 +371,7 @@ X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
if (selected_cert == NULL) {
if (s_cert_id != NULL) {
fprintf(stderr,"No cert with ID \"%s\" found.\n", s_cert_id);
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
} else /* Take the first cert that was found */
selected_cert = &certs[0];
@@ -376,6 +379,7 @@ X509 *pkcs11_load_cert(ENGINE * e, const char *s_slot_cert_id)
x509 = X509_dup(selected_cert->x509);
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return x509;
}
@@ -503,18 +507,20 @@ EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
}
if (slot_nr == -1) {
- if (!(slot = PKCS11_find_token(ctx)))
+ if (!(slot = PKCS11_find_token(ctx, slot_list, count)))
fail("didn't find any tokens\n");
} else if (slot_nr >= 0 && slot_nr < count)
slot = slot_list + slot_nr;
else {
fprintf(stderr,"Invalid slot number: %d\n", slot_nr);
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
}
tok = slot->token;
if (tok == NULL) {
fprintf(stderr,"Found empty token; \n");
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
}
/* Removed for interop with some other pkcs11 libs. */
@@ -526,6 +532,7 @@ EVP_PKEY *pkcs11_load_key(ENGINE * e, const char *s_slot_key_id,
#endif
if (isPrivate && !tok->userPinSet && !tok->readOnly) {
fprintf(stderr,"Found slot without user PIN\n");
+ PKCS11_destroy_all_slots(ctx, slot_list, count);
return NULL;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/engine-pkcs11.git
More information about the pkg-opensc-commit
mailing list