Preferred way of passing user context void* inside SSL*

Johannes Bauer dfnsonfsduifb at
Wed Oct 23 12:59:25 UTC 2019

Hi list,

yet another question. In my process with TLS13-PSK, I've noticed that
the PSK callback does not have a user-definable callback context value.
However, the callback is passed the SSL* which I created when the
session was established.

Is there a way for me to piggyback a void* inside the SSL structure so
that I can access it from within the callback?

I've noticed a couple of member variables that might be abused for this
purpose (async_cb_arg, allow_early_data_cb_data,
default_passwd_callback_userdata, msg_callback_arg) and think in my
usecase they hopefully should all be safe to use (I don't use async I/O,
no early data, no SRP, no msg callback) -- but is this the preferred way
to do it? I.e., hijack a different callback argument that isn't used?

Am I overlooking the supposed way of doing this? Or is this typically
done via global variables (which in my case I *really* would want to avoid)?


More information about the openssl-users mailing list