Hi all,
I'm using v0.9.7b to protoype an SSL server emulation on Windows (32bit).
However, I seem to have hit a problem which I can't solve, probably because I lack some understanding about the code.
Here's the problem:
I have set up a simple context with the certificates etc. as per the easy_tls demo, created an SSL* with this context, called SSLv23_server_method(), set ssl_write/read/connect to point to local functions, set up wbio and rbio with a new BIO created with the context, set the accept state and then called SSL_accept.
This works fine, to a point - the ssl_read method I have set up is called for the client hello, which it returns, and the server hello response is (internally) set up fine. The SSL library then flushes the data (calling buffer_ctrl() with BIO_CTRL_FLUSH). This calls BIO_write(), which calls my write method (a nop at the moment, just returns the length as if all were written), and is fine. It then drops to out of the loop having written all the data and calls BIO_ctrl() on b->next_bio, which in turn calls ssl_ctrl() with BIO_CTRL_FLUSH, which in turn calls BIO_copy_next_retry() - but *this* b->next_bio is NULL, and whole thing crashes!
I admit I'm completely new to this, but I've spent a couple of days trying various permutations in the hope that I can get it to both NOT crash and still call my methods, but have admitted defeat and now need help! I just can't see a way for it to stop calling the copy, nor a way of ensuring that next_bio would be set up correctly if it did!
Does anyone have any useful pointers they can give me?
Is there something I should be doing in my write function?
Is there something I should be setting up prior to calling SSL_accept that I'm not?
Any pointers much appreciated!
Cheers,
Stephen.