<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hi,<br>
      <br>
        I looked for "NO_UI" in the source code but did not find any
      references to it. I'll take a closer look and see if I can find
      some other flag, which disables the UI_METHOD function calls.<br>
      <br>
      By the way, I found your code for this in eap-tls.c very helpful
      and easy to follow. :)  I did have to make minor modifications for
      it to compile with the Visual Studio C++ compiler, though.<br>
      <br>
      Thanks,<br>
      George<br>
      <br>
      <br>
      <br>
      On 2021-01-26 4:29 a.m., Jan Just Keijser wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:1ed07614-f302-f935-3842-3ff3ea50e5e7@nikhef.nl">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <div class="moz-cite-prefix">On 26/01/21 05:28, George wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:ac90a321-3d80-79b4-47c3-d5a2474bc807@gmail.com">
        <meta http-equiv="content-type" content="text/html;
          charset=UTF-8">
        Hi,<br>
        <br>
            I'm trying to get OpenSSL 1.0.2u with the FIPS Object Module
        2.0.16  in Windows 10 to prompt the user for a smart card's PIN
        number every time the application is launched. However, I cannot
        seem to get it to work. My UI_METHOD callback functions are not
        being invoked.<br>
        <br>
        I'm using the following code as a reference:<br>
        <a class="moz-txt-link-freetext"
          href="https://github.com/jjkeijser/ppp/blob/eap-tls/pppd/eap-tls.c"
          moz-do-not-send="true">https://github.com/jjkeijser/ppp/blob/eap-tls/pppd/eap-tls.c</a><br>
        <br>
        I tried the following:<br>
        <br>
        <blockquote><font face="monospace">UI_METHOD* transfer_pin =
            UI_create_method("transfer_pin");<br>
            <br>
            int writer (UI *ui, UI_STRING *uis)<br>
            {<br>
                PW_CB_DATA* cb_data =
            (PW_CB_DATA*)UI_get0_user_data(ui);<br>
                UI_set_result(ui, uis, cb_data->password);<br>
                return 1;<br>
            };<br>
            int stub (UI* ui) {return 1;};<br>
            int stub_reader (UI *ui, UI_STRING *uis) {return 1;};<br>
            <br>
            UI_method_set_writer(transfer_pin,  writer);<br>
            UI_method_set_opener(transfer_pin,  stub);<br>
            UI_method_set_closer(transfer_pin,  stub);<br>
            UI_method_set_flusher(transfer_pin, stub);<br>
            UI_method_set_reader(transfer_pin,  stub_reader);<br>
            <br>
            pkey = ENGINE_load_private_key(pkey_engine, pkey_identifier,
            transfer_pin, &cb_data);<br>
          </font></blockquote>
        <br>
        <br>
        However, none of the callback functions "writer", "stub", or
        "stub_reader" actually get called. Do I need to do anything else
        to enable this functionality?  I would like to force the user to
        enter PIN number every time.<br>
        <br>
      </blockquote>
      <br>
      this depends on how openssl for windows was built ; some non-UNIX
      builds set the flag OPENSSL_NO_UI_CONSOLE  (or possibly
      OPENSSL_NO_UI) in which case all UI_methods are effectively
      disabled. If this flag is set for your build then you will have to
      rebuild OpenSSL.<br>
      <br>
      Apart from that, that code snippet above is not the cleanest code
      I have ever written  - some C/C++ compilers do not like functions
      defined insides an  "if { } " block; you might have to take the
      function "int writer { } " outside of the "if { } " block.<br>
      <br>
      HTH,<br>
      <br>
      JJK<br>
      <br>
      <br>
    </blockquote>
    <br>
  </body>
</html>