Problems constructing a server BIO/SSL chain

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Problems constructing a server BIO/SSL chain

Martin Persson
Hello, I'm having trouble setting up a proper BIO chain for a server
application.
It seems that the SSL object isn't decrypting the data sent from the
client, since all I get is a string of weird charachters (almost
identical every time, so I guess it's initialization/handshake data of
some kind).

This is how I setup the server BIO (stripped down code version):

s->sbio = BIO_new_accept(s->shost);
BIO_do_accept(s->sbio); // Listen
BIO_do_accept(s->sbio); // Accept

// Shut down accept bio, and store new connection bio in the free'ed bio
temp_bio = BIO_pop(s->sbio);
BIO_free(s->sbio);
s->sbio = temp_bio;
temp_bio = NULL;

s->ssl = SSL_new(s->ctx);
SSL_set_accept_state(s->ssl);
BIO_set_ssl(s->sbio, s->ssl, 0);
BIO_do_handshake(s->sbio);

Is this the proper way of setting up a server BIO for a
single-connection server application? I had trouble finding
documentation that explain the creation and usage of BIO chains in a
proper way, so I think that my chain setup may be incorrect.

Thanks for your time
Martin Persson
[hidden email]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]