On Mon, Mar 21, 2011, Victor Duchovni wrote: > Can you explain a bit more clearly why you can't initialize an > integer index or two when the application starts?
I can, but that's not the problem. Here's an example: initialize: SSL_load_error_strings(); ... ssl_ctx = SSL_CTX_new(); myidx = SSL_CTX_get_ex_new_index(); set up and start two client instances: a_ctx1->a_ssl_ctx = ssl_ctx; a_ctx2->a_ssl_ctx = ssl_ctx; client(a_ctx1); client(a_ctx2); (as threads so they run concurrently) client() has some code like this: SSL_CTX_set_ex_data(a_ctx->a_ssl_ctx, myidx, a_ctx->cb_arg); which means the "last call wins" to actually sets the application context for SSL_CTX, right? Hence doing something like this: SSL_CTX_set_info_callback(a_ctx->a_ssl_ctx, clt_cb) where clt_cb(SSL_CTX *ssl_ctx) retrieves the application context via: cb_arg = (cast...) SSL_CTX_get_ex_data(ssl_ctx, myidx); will get some "random" application context. However, the API works ok if: - different SSL_CTXs are used - callbacks are only set for SSL which are different for each client() invocation anyway. This means for the common use case the method should work properly. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org