[pkg-opensc-commit] [libp11] 11/51: Removed implicit PKCS11_set_ui_method()

Eric Dorland eric at moszumanska.debian.org
Wed Dec 7 17:51:30 UTC 2016


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

eric pushed a commit to branch master
in repository libp11.

commit be22da7a12af25c758b11e85b17a1676526b5009
Author: MichaƂ Trojnara <Michal.Trojnara at stunnel.org>
Date:   Fri Oct 7 22:47:37 2016 +0200

    Removed implicit PKCS11_set_ui_method()
    
    The UI_METHOD provided via pkcs11_load_private_key() is likely to
    be invalid for CKU_CONTEXT_SPECIFIC logins.  We use the default UI
    method instead by executing UI_new_method(NULL).
---
 src/eng_back.c | 5 +----
 src/p11_key.c  | 8 +++-----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/src/eng_back.c b/src/eng_back.c
index dc11d42..434b522 100644
--- a/src/eng_back.c
+++ b/src/eng_back.c
@@ -96,13 +96,11 @@ static int get_pin(ENGINE_CTX *ctx, UI_METHOD *ui_method, void *callback_data)
 	UI *ui;
 
 	/* call ui to ask for a pin */
-	ui = UI_new();
+	ui = UI_new_method(ui_method);
 	if (ui == NULL) {
 		fprintf(stderr, "UI_new failed\n");
 		return 0;
 	}
-	if (ui_method != NULL)
-		UI_set_method(ui, ui_method);
 	if (callback_data != NULL)
 		UI_add_user_data(ui, callback_data);
 
@@ -808,7 +806,6 @@ static EVP_PKEY *pkcs11_load_key(ENGINE_CTX *ctx, const char *s_slot_key_id,
 	}
 
 	if (selected_key != NULL) {
-		PKCS11_set_ui_method(selected_key, ui_method, callback_data);
 		pk = isPrivate ?
 			PKCS11_get_private_key(selected_key) :
 			PKCS11_get_public_key(selected_key);
diff --git a/src/p11_key.c b/src/p11_key.c
index bdbdf0b..e8339fb 100644
--- a/src/p11_key.c
+++ b/src/p11_key.c
@@ -355,13 +355,11 @@ int pkcs11_authenticate(PKCS11_KEY *key)
 	}
 
 	/* Call UI to ask for a PIN */
-	if (kpriv->ui_method == NULL)
-		return PKCS11_UI_FAILED;
-	ui = UI_new();
+	ui = UI_new_method(kpriv->ui_method);
 	if (ui == NULL)
 		return PKCS11_UI_FAILED;
-	UI_set_method(ui, kpriv->ui_method);
-	UI_add_user_data(ui, kpriv->ui_user_data);
+	if (kpriv->ui_user_data != NULL)
+		UI_add_user_data(ui, kpriv->ui_user_data);
 	if (!UI_add_input_string(ui, "PKCS#11 key PIN: ",
 			UI_INPUT_FLAG_DEFAULT_PWD, pin, 1, MAX_PIN_LENGTH)) {
 		UI_free(ui);

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