[pkg-opensc-commit] [libp11] 152/239: make libp11 swallow CKR_CRYPTOKI_ALREADY_INITIALIZED if returned from C_Initialize(). It's an informational message and should not be bubbled up to the caller. By Daniel Smith.

Eric Dorland eric at moszumanska.debian.org
Sat Oct 17 06:21:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libp11.

commit ee4ad5eddb097ee774b8feb9237d4ada73b553a4
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date:   Tue Oct 20 12:16:11 2009 +0000

    make libp11 swallow CKR_CRYPTOKI_ALREADY_INITIALIZED if returned from
    C_Initialize(). It's an informational message and should not be bubbled
    up to the caller. By Daniel Smith.
---
 NEWS           | 3 ++-
 src/p11_load.c | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 0295ee8..b014c9b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,8 @@
 NEWS for Libp11 -- History of user visible changes
 
 New in 0.2.7; ???; ???
-* ADD NEWS ENRIES HERE
+* If CKR_CRYPTOKI_ALREADY_INITIALIZED is returned from C_Initialize(): ignore. 
+  (Needed for unloaded/reloaded engines e.g. in wpa_supplicant.) By David Smith.
 
 New in 0.2.6; 2009-07-22; Andreas Jellinghaus
 * Fix new version: add new symbol to export file
diff --git a/src/p11_load.c b/src/p11_load.c
index c0b2aeb..115f9f6 100644
--- a/src/p11_load.c
+++ b/src/p11_load.c
@@ -73,7 +73,10 @@ int PKCS11_CTX_load(PKCS11_CTX * ctx, const char *name)
 	memset(&args, 0, sizeof(args));
 	args.pReserved = priv->init_args;
 	rv = priv->method->C_Initialize(&args);
-	CRYPTOKI_checkerr(PKCS11_F_PKCS11_CTX_LOAD, rv);
+	if (rv && rv != CKR_CRYPTOKI_ALREADY_INITIALIZED) {
+		PKCS11err(PKCS11_F_PKCS11_CTX_LOAD, rv);
+		return -1;
+	}
 
 	/* Get info on the library */
 	rv = priv->method->C_GetInfo(&ck_info);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/libp11.git



More information about the pkg-opensc-commit mailing list