On Sun, Mar 20, 2011 at 10:42:28AM -0700, Claus Assmann wrote:

> It seems the official way to use an application
> context is via:
> 
> int SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
>        CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
> int SSL_set_ex_data(SSL *ssl, int idx, void *arg);
> void *SSL_get_ex_data(const SSL *ssl, int idx);
> 
> However, that still requires a global variable (for idx) as the
> example for SSL_CTX_set_verify(3) shows.
> 
> Is there some other API (or some "trick") that does not rely
> on a global variable?

What's the obstacle to a global variable that is initialized once and
never changes? You also only need to call:

        SSL_load_error_strings();
        OpenSSL_add_ssl_algorithms();

once, ... so there needs to be some once-only code in your application,
and setting a write-once global there does not seem burdensome.

I am not aware of any other mechanism for passing application context
into the session callback routines.

-- 
        Viktor.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to