Hello OpenSSL developers.

I have a little problem using OpenSSL  and CRYPTO_set_add_lock_callback to
use InterlockedIncrement API in Windows.

Current implementation of SSL_get1_session does not allow the use of
CRYPTO_set_add_lock_callback to set a custom add lock callback
implementation that uses InterlockedIncrement and InterlockedDecrement API.
An add lock callback that uses interlocked API does not need to get the
CRYPTO_LOCK_SSL_SESSION object.

SSL_SESSION *SSL_get1_session(SSL *ssl)
/* variant of SSL_get_session: caller really gets something */
{
        SSL_SESSION *sess;
        /* Need to lock this all up rather than just use CRYPTO_add so that
         * somebody doesn't free ssl->session between when we check it's
         * non-null and when we up the reference count. */
        CRYPTO_w_lock(CRYPTO_LOCK_SSL_SESSION);
        sess = ssl->session;
        if(sess)
                sess->references++;
        CRYPTO_w_unlock(CRYPTO_LOCK_SSL_SESSION);
        return(sess);
}

Do you think that this behavior can be changed in a future version of
OpenSSL to use the locking callback provided by
CRYPTO_set_add_lock_callback?

Best Regards,

Leandro Gustavo Biss Becker

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

Reply via email to