Add user-defined argument in TLS 1.3 External PSK callback

brandon.murphy1996 brandon.murphy1996 at protonmail.com
Wed Apr 15 23:12:42 UTC 2020


Hi,

For my project, I need to perform a external PSK mode TLS 1.3 handshake. As per the documentation, I am setting up a callback on client my SSL object using the following:

SSL_set_psk_use_session_callback(ssl, psk_use_session_cb_func)

and the callback's formal arguments are:

typedef int (*SSL_psk_use_session_cb_func)(SSL *ssl, const EVP_MD *md,
                                            const unsigned char **id,
                                            size_t *idlen,
                                            SSL_SESSION **sess);


Currently, the psk_use_session_cb_func() contains a hardcoded PSK and identity value. However, I want to send an extra argument (preferably a custom struct) to this callback that will contain the pre-shared key and identity (ideally read from a config file). Is there any way this can be achieved?

PS: I also need to do it on the server using the find_session callback.

Thanks,
Brandon






More information about the openssl-users mailing list