<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000099" bgcolor="#FFFFFF">
    On 10/06/2019 11:05, Jeremy Harris wrote:<br>
    <blockquote type="cite"
      cite="mid:03ec8f42-3ce9-54a5-1c42-401d7bae8395@wizmail.org">
      <pre class="moz-quote-pre" wrap="">On 10/06/2019 09:32, Viktor Dukhovni wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">On Mon, Jun 10, 2019 at 07:16:26AM +0000, shalu dhamija via openssl-users wrote:

</pre>
        <blockquote type="cite">
          <pre class="moz-quote-pre" wrap="">Actually while setting the callback, we can not pass the user-defined/application data.
</pre>
        </blockquote>
        <pre class="moz-quote-pre" wrap="">
You can however attach it to the SSL connection handle as "ex_data":
</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
I fail to see the point.  You don't need to pass the data, only a
pointer to the data.</pre>
    </blockquote>
    <br>
    Well ... obviously ...<br>
    <br>
    <blockquote type="cite"
      cite="mid:03ec8f42-3ce9-54a5-1c42-401d7bae8395@wizmail.org">
      <pre class="moz-quote-pre" wrap="">Any time you set the callback, you can set the callback-arg.</pre>
    </blockquote>
    <br>
    How? As Shalu quoted, the prototype of the call to set the callback
    is<br>
    <br>
    <pre><code>void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx,
                              int (*new_session_cb)(SSL *, SSL_SESSION *));</code></pre>
    <br>
    How do we specify a user-defined callback data pointer in that call?<br>
    <br>
    <blockquote type="cite"
      cite="mid:03ec8f42-3ce9-54a5-1c42-401d7bae8395@wizmail.org">
      <pre class="moz-quote-pre" wrap="">When the callback is called it is given the arg;</pre>
    </blockquote>
    <br>
    Where? According to the prototype which Shalu quoted the callback
    gets just a pointer to an SSL and a pointer to an SSL_SESSION;
    neither of those is a user-defined data pointer.<br>
    <br>
    <blockquote type="cite"
      cite="mid:03ec8f42-3ce9-54a5-1c42-401d7bae8395@wizmail.org">
      <pre class="moz-quote-pre" wrap="">if the arg was a pointer you can deref to get the data... which could
have been manipulated as needed in the interim.

Using the ex_data facility is not needed.
</pre>
    </blockquote>
    <br>
    I may be missing something, but I can't see any other way to do it.<br>
    <pre class="moz-signature" cols="72">-- 
J. J. Farrell
Not speaking for Oracle</pre>
  </body>
</html>