Query related to SSL_CTX_set_msg_callback_arg

J. J. Farrell jeremy.farrell at oracle.com
Mon Jun 10 14:21:29 UTC 2019

On 10/06/2019 11:05, Jeremy Harris wrote:
> On 10/06/2019 09:32, Viktor Dukhovni wrote:
>> On Mon, Jun 10, 2019 at 07:16:26AM +0000, shalu dhamija via openssl-users wrote:
>>> Actually while setting the callback, we can not pass the user-defined/application data.
>> You can however attach it to the SSL connection handle as "ex_data":
> I fail to see the point.  You don't need to pass the data, only a
> pointer to the data.

Well ... obviously ...

> Any time you set the callback, you can set the callback-arg.

How? As Shalu quoted, the prototype of the call to set the callback is

|void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*new_session_cb)(SSL *, 

How do we specify a user-defined callback data pointer in that call?

> When the callback is called it is given the arg;

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.

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

I may be missing something, but I can't see any other way to do it.

J. J. Farrell
Not speaking for Oracle

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20190610/ed8ec5ad/attachment.html>

More information about the openssl-users mailing list