Re: How to empty a BIO buffer?

2014-09-09 Thread Richard Levitte
In message CALiegfmvaG-nc=putyxey20otoiow6op+lajohnoqxf86aw...@mail.gmail.com on Mon, 8 Sep 2014 18:19:09 +0200, Iñaki Baz Castillo i...@aliax.net said: ibc Why do I need to provide BIO_get_mem_data() with an already allocated ibc buffer? I've checked the function and I do not understand what it

Re: How to empty a BIO buffer?

2014-09-09 Thread Richard Levitte
And of course, I noticed this email after sending my own... sorry. In message CALiegf=BytJ-1ZDzcCw3=e2=6moritr87pjunro4cxorysy...@mail.gmail.com on Mon, 8 Sep 2014 18:41:40 +0200, Iñaki Baz Castillo i...@aliax.net said: ibc 2014-09-08 18:35 GMT+02:00 Kyle Hamilton aerow...@gmail.com: ibc The

Re: How to empty a BIO buffer?

2014-09-09 Thread Iñaki Baz Castillo
2014-09-09 10:46 GMT+02:00 Richard Levitte rich...@levitte.org: And of course, I noticed this email after sending my own... sorry. :) Thanks a lot. -- Iñaki Baz Castillo i...@aliax.net __ OpenSSL Project

Re: How to empty a BIO buffer?

2014-09-08 Thread Iñaki Baz Castillo
2014-09-08 14:44 GMT+02:00 Iñaki Baz Castillo i...@aliax.net: -- int read = BIO_read(sslBioToNetwork, (void*)myBuffer, MY_BUFFER_SIZE); // Use the read data -- with something like this: ---

Re: How to empty a BIO buffer?

2014-09-08 Thread Richard Levitte
In message CALiegf=+4vr1GU=mn4r0hng99orugtvez+xxjogpbkzx-uz...@mail.gmail.com on Mon, 8 Sep 2014 15:10:04 +0200, Iñaki Baz Castillo i...@aliax.net said: ibc 2014-09-08 14:44 GMT+02:00 Iñaki Baz Castillo i...@aliax.net: ibc -- ibc int read =

Re: How to empty a BIO buffer?

2014-09-08 Thread Iñaki Baz Castillo
2014-09-08 16:08 GMT+02:00 Richard Levitte rich...@levitte.org: Sorry, BIO_flush() isn't what you want (it doesn't reset the buffer to empty), BIO_reset() is. However, you need to be careful... if I were you, I would use the read data before resetting, as BIO_get_mem_data() gives you the

Re: How to empty a BIO buffer?

2014-09-08 Thread Iñaki Baz Castillo
2014-09-08 18:19 GMT+02:00 Iñaki Baz Castillo i...@aliax.net: This works fine: --- long read; // myBuffer is an already allocated buffer. char** data = (char**)myBuffer; read = BIO_get_mem_data(bio, data); // Use data and read values. BIO_reset(bio);

Re: How to empty a BIO buffer?

2014-09-08 Thread Kyle Hamilton
The allocated buffer needs to be sizeof(char *). What's happening is the address of the buffer (buffer[0]) gets written to the pointer-to-pointer-to-char, data. If data == NULL, you're asking to write the address of the buffer to unallocated memory. It's done this way because the return value

Re: How to empty a BIO buffer?

2014-09-08 Thread Iñaki Baz Castillo
2014-09-08 18:35 GMT+02:00 Kyle Hamilton aerow...@gmail.com: The allocated buffer needs to be sizeof(char *). What's happening is the address of the buffer (buffer[0]) gets written to the pointer-to-pointer-to-char, data. If data == NULL, you're asking to write the address of the buffer to