> I'm following the example client on:
> http://linux.die.net/man/3/bio_new_ssl_connect
>
> I am able to establish the ssl connection and send data, but when I go to do
> BIO_read, I get this error:
>
> error:140950D3:SSL routines:SSL3_READ_N:read bio not set
>
> I can see with wireshark that the server is sending back some data, but
> BIO_read returns -1.
>
with further debugging I find that the ssl object's rbio and wbio fields are
nulled out after calling:
i2d_CMS_bio_stream(output, cms, mem, flags));
Any idea why that would be?
Here's a distilled version of the code:
ctx = SSL_CTX_new(SSLv23_client_method());
output = BIO_new_ssl_connect(ctx);
BIO_get_ssl(output, &ssl);
SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
BIO_set_conn_hostname(output, host);
if(BIO_do_connect(output) <= 0)
//handle
if ((use_ssl) && (SSL_get_verify_result(ssl) != X509_V_OK))
//handle
if ((use_ssl) && (BIO_do_handshake(output) <= 0))
//handle
int flags = CMS_STREAM|CMS_NOSMIMECAP;
cms = CMS_sign(NULL, NULL, NULL, mem, flags);
if (!CMS_add1_signer(cms, scert, skey, NULL, flags))
//handle
printf ("ssl->rbio %p\n", ssl->rbio);
printf ("ssl->wbio %p\n", ssl->wbio);
if (!i2d_CMS_bio_stream(output, cms, mem, flags))
printf ("error writing output\n");
printf ("i2d_CMS_bio_stream");
printf ("ssl->rbio %p\n", ssl->rbio);
printf ("ssl->wbio %p\n", ssl->wbio);
output is:
ssl->rbio 0x1aadf60
ssl->wbio 0x1aadf60
i2d_CMS_bio_stream
ssl->rbio (nil)
ssl->wbio (nil)
So naturally, after that the next call to BIO_read (output) fails.
why would the bio's be getting set to null?
Is there some other flag or function I need to use to prevent this?
--
Chris Bare
[email protected]
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]