Re: ssl 2.0

Hey all...

I've been having the same problem, but I didn't initially
know it was a SSLv2 thing. Here's the changes to HTSSL.c
to solve the problem, and fix two more bugs.

New HTSSL_init (does SSLv2 fallback and only loads error strings once):
PUBLIC BOOL HTSSL_init (void)
{
    if (!app_ctx) {
        SSL_METHOD * meth = NULL;
        
        /* Set up the SSL library and provide error messages */
        SSL_library_init();
        SSL_load_error_strings();
        
        /* The SSLv23 method tries SSLv3/TLSv1 but can fall back to
SSLv2 */
        meth = SSLv23_client_method();
//        meth = TLSv1_client_method();
        
        /* Set up the application context */
        if ((app_ctx = SSL_CTX_new(meth)) == NULL) {
            HTTRACE(PROT_TRACE, "HTSSLContext Could not create
context\n");
            return NO;
        }
        HTTRACE(PROT_TRACE, "HTSSLContext Created context %p" _
app_ctx);

        /* See the SSL states in our own callback */
#ifdef HTDEBUG
        SSL_CTX_set_info_callback(app_ctx, apps_ssl_info_callback);
#endif
        
        /* Set the certificate verification callback */
        SSL_CTX_set_verify(app_ctx, SSL_VERIFY_PEER, verify_callback);

        /* Not sure what this does */
        SSL_CTX_set_session_cache_mode(app_ctx, SSL_SESS_CACHE_CLIENT);
    }
    return YES;
}

Old HTSSL_addRef (doesn't compile unless debug):
PRIVATE void HTSSL_addRef(HTSSL * htssl)
{
    if (htssl) {
        (htssl->ref_count)++;
        if (PROT_TRACE)
            HTTrace("HTSSL....... New reference count = %d\n" _
htssl->ref_count);
    }
}

New HTSSL_addRef (compiles fine):
PRIVATE void HTSSL_addRef(HTSSL * htssl)
{
    if (htssl) {
        (htssl->ref_count)++;
        HTTRACE(PROT_TRACE, "HTSSL....... New reference count = %d\n" _
htssl->ref_count);
    }
}

I don't yet have cvs, so could someone else make these changes?

Thanks!
Brian Hawley

Received on Thursday, 13 January 2000 13:16:54 UTC