Ticket #5 (closed defect: fixed)

Opened 4 years ago

Last modified 2 years ago

engine_pkcs11 doesn't forward PIN

Reported by: ahasenack@… Owned by: opensc-devel@…
Priority: normal Component: engine_pkcs11
Version: 0.1.3 Severity: normal
Keywords: Cc:

Description

$ echo mypin | openssl rsautl -engine pkcs11 -in key.crypt -inkey 45 -keyform engine -decrypt -passin fd:0 reader-pcsc.c:495:pcsc_connect: SCardControl failed: Invalid parameter given. engine "pkcs11" set. PKCS#11 token PIN:

The pkcs11 engine isn't taking the PIN from openssl. Seems the cb_data structure is ignored and the engine asks for the PIN again.

I hope the patch below (which is not a proposed fix) helps to illustrate the issue:

--- engine_pkcs11.c.orig 2005-12-06 19:17:59.000000000 -0200 +++ engine_pkcs11.c 2005-12-06 19:18:02.000000000 -0200 @@ -101,6 +101,15 @@

static char *get_pin(UI_METHOD * ui_method, void *callback_data, char *sc_pin, int maxlen) {

UI *ui;

+ struct { + const void *password; + const char *prompt_info; + } *mycb = callback_data; + + if (mycb->password) { + sc_pin = set_pin(mycb->password); + return sc_pin; + }

ui = UI_new(); if (ui_method != NULL)

Attachments

p (0 bytes) - added by ahasenack@… 4 years ago.
better upload the illustrating patch

Change History

Changed 4 years ago by ahasenack@…

  • attachment p added

better upload the illustrating patch

Changed 4 years ago by ahasenack@…

Maybe this time it works...

--- engine_pkcs11.c.orig        2005-12-06 19:17:59.000000000 -0200
+++ engine_pkcs11.c     2005-12-06 19:18:02.000000000 -0200
@@ -101,6 +101,15 @@
 static char *get_pin(UI_METHOD * ui_method, void *callback_data, char *sc_pin, int maxlen)
 {
        UI *ui;
+       struct {
+               const void *password;
+               const char *prompt_info;
+       } *mycb = callback_data;
+
+       if (mycb->password) {
+               sc_pin = set_pin(mycb->password);
+               return sc_pin;
+       }

        ui = UI_new();
        if (ui_method != NULL)

Changed 2 years ago by aj

  • status changed from new to closed
  • resolution set to fixed

applied to trunk.

Note: See TracTickets for help on using tickets.