[pkg-opensc-commit] [libp11] 07/13: Allow changing UI/data of an initialized context

Eric Dorland eric at moszumanska.debian.org
Mon May 22 03:43:00 UTC 2017


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

eric pushed a commit to annotated tag libp11-0.4.5
in repository libp11.

commit 738b8638a94c47c0f375264e549522e20bf428ef
Author: Michał Trojnara <Michal.Trojnara at stunnel.org>
Date:   Thu Mar 2 17:21:48 2017 +0100

    Allow changing UI/data of an initialized context
    
    Update the SET_USER_INTERFACE and SET_CALLBACK_DATA control commands
    to also modify an already initialized libp11 context.
---
 src/eng_back.c   | 6 ++++++
 src/libp11-int.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/eng_back.c b/src/eng_back.c
index ac8c025..2db6054 100644
--- a/src/eng_back.c
+++ b/src/eng_back.c
@@ -908,12 +908,18 @@ static int ctx_ctrl_set_init_args(ENGINE_CTX *ctx, const char *init_args_orig)
 static int ctx_ctrl_set_user_interface(ENGINE_CTX *ctx, UI_METHOD *ui_method)
 {
 	ctx->ui_method = ui_method;
+	if (ctx->pkcs11_ctx != NULL) /* libp11 is already initialized */
+		PKCS11_set_ui_method(ctx->pkcs11_ctx,
+			ctx->ui_method, ctx->callback_data);
 	return 1;
 }
 
 static int ctx_ctrl_set_callback_data(ENGINE_CTX *ctx, void *callback_data)
 {
 	ctx->callback_data = callback_data;
+	if (ctx->pkcs11_ctx != NULL) /* libp11 is already initialized */
+		PKCS11_set_ui_method(ctx->pkcs11_ctx,
+			ctx->ui_method, ctx->callback_data);
 	return 1;
 }
 
diff --git a/src/libp11-int.h b/src/libp11-int.h
index 78ab89a..f5b0f27 100644
--- a/src/libp11-int.h
+++ b/src/libp11-int.h
@@ -277,7 +277,7 @@ extern int pkcs11_enumerate_certs(PKCS11_TOKEN *token,
 	PKCS11_CERT **certs, unsigned int *ncerts);
 
 /* Set UI method to allow retrieving CKU_CONTEXT_SPECIFIC PINs interactively */
-extern int pkcs11_set_ui_method(PKCS11_CTX *key,
+extern int pkcs11_set_ui_method(PKCS11_CTX *ctx,
 	UI_METHOD *ui_method, void *ui_user_data);
 
 /* Initialize a token */

-- 
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